[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.
This commit is contained in:
ejurgensen 2020-04-21 23:40:11 +02:00
parent e2205e2399
commit 4491928466

View File

@ -987,6 +987,9 @@ 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)
outputs_metadata_send(pb_session.playing_now->item_id, true, metadata_finalize_cb);
session_update_play_start(); session_update_play_start();
status_update(PLAY_PLAYING); status_update(PLAY_PLAYING);
@ -1899,8 +1902,6 @@ playback_start_bh(void *arg, int *retval)
if (ret < 0) if (ret < 0)
goto error; goto error;
outputs_metadata_send(pb_session.playing_now->item_id, true, metadata_finalize_cb);
status_update(PLAY_PLAYING); status_update(PLAY_PLAYING);
*retval = 0; *retval = 0;