From 4491928466eaa2267728773070b2344bf117bef9 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Tue, 21 Apr 2020 23:40:11 +0200 Subject: [PATCH] [player] Don't send metadata before the input has started Otherwise we have a race condition between the worker and the input thread. If the worker returns with metadata before the input thread has started reading, then pb_session.pts will still be zero, which means metadata->pts will be zero in finalize_cb(). That is an invalid time to give the outputs. --- src/player.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/player.c b/src/player.c index a5dee1ae..c9984ecd 100644 --- a/src/player.c +++ b/src/player.c @@ -987,6 +987,9 @@ event_play_start() { DPRINTF(E_DBG, L_PLAYER, "event_play_start()\n"); + if (!pb_session.playing_now->prev) + outputs_metadata_send(pb_session.playing_now->item_id, true, metadata_finalize_cb); + session_update_play_start(); status_update(PLAY_PLAYING); @@ -1899,8 +1902,6 @@ playback_start_bh(void *arg, int *retval) if (ret < 0) goto error; - outputs_metadata_send(pb_session.playing_now->item_id, true, metadata_finalize_cb); - status_update(PLAY_PLAYING); *retval = 0;