adaptivedemux2: Always wake up loop thread on unpause

Otherwise loop thread will sleep forever because
GstAdaptiveDemuxLoop.paused flag update is not signalled
when loop was marked as stopped already from other thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3057>
This commit is contained in:
Seungha Yang 2022-09-21 00:26:38 +09:00 committed by GStreamer Marge Bot
parent a03f3df626
commit a9144f5313

View file

@ -318,21 +318,23 @@ gst_adaptive_demux_loop_pause_and_lock (GstAdaptiveDemuxLoop * loop)
gboolean
gst_adaptive_demux_loop_unlock_and_unpause (GstAdaptiveDemuxLoop * loop)
{
gboolean stopped;
g_main_context_pop_thread_default (loop->context);
g_rec_mutex_unlock (&loop->context_lock);
g_mutex_lock (&loop->lock);
loop->paused = FALSE;
if (loop->stopped) {
g_mutex_unlock (&loop->lock);
return FALSE;
}
stopped = loop->stopped;
/* Wake up the loop to run again */
/* Wake up the loop to run again, regardless of stopped state */
g_cond_broadcast (&loop->cond);
g_mutex_unlock (&loop->lock);
if (stopped)
return FALSE;
return TRUE;
}