[player] Only send startup metadata once

This commit is contained in:
ejurgensen 2020-04-22 22:15:57 +02:00
parent 6a03efa869
commit b9f6104f79
1 changed files with 11 additions and 2 deletions

View File

@ -234,6 +234,11 @@ struct player_session
size_t read_deficit; size_t read_deficit;
size_t read_deficit_max; size_t read_deficit_max;
// We send metadata when we start a session, everytime we end a track and if
// the input gives us a new metadata event. This value tracks if we have sent
// the starting metadata.
bool metadata_sent;
// Pointer to the head of the two-way linked list of items from the queue that // Pointer to the head of the two-way linked list of items from the queue that
// we are either playing or going to play. When an item has been played it is // we are either playing or going to play. When an item has been played it is
// removed from the list. The playing_now and reading_now pointers will point // removed from the list. The playing_now and reading_now pointers will point
@ -859,6 +864,7 @@ session_restart(void)
pb_session.pts.tv_sec = 0; pb_session.pts.tv_sec = 0;
pb_session.pts.tv_nsec = 0; pb_session.pts.tv_nsec = 0;
pb_session.read_deficit = 0; pb_session.read_deficit = 0;
pb_session.metadata_sent = 0;
} }
static void static void
@ -987,8 +993,11 @@ event_play_start()
{ {
DPRINTF(E_DBG, L_PLAYER, "event_play_start()\n"); DPRINTF(E_DBG, L_PLAYER, "event_play_start()\n");
if (!pb_session.playing_now->prev) if (!pb_session.metadata_sent)
{
outputs_metadata_send(pb_session.playing_now->item_id, true, metadata_finalize_cb); outputs_metadata_send(pb_session.playing_now->item_id, true, metadata_finalize_cb);
pb_session.metadata_sent = 1;
}
session_update_play_start(); session_update_play_start();