mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
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:
parent
a03f3df626
commit
a9144f5313
1 changed files with 7 additions and 5 deletions
|
@ -318,21 +318,23 @@ gst_adaptive_demux_loop_pause_and_lock (GstAdaptiveDemuxLoop * loop)
|
||||||
gboolean
|
gboolean
|
||||||
gst_adaptive_demux_loop_unlock_and_unpause (GstAdaptiveDemuxLoop * loop)
|
gst_adaptive_demux_loop_unlock_and_unpause (GstAdaptiveDemuxLoop * loop)
|
||||||
{
|
{
|
||||||
|
gboolean stopped;
|
||||||
|
|
||||||
g_main_context_pop_thread_default (loop->context);
|
g_main_context_pop_thread_default (loop->context);
|
||||||
g_rec_mutex_unlock (&loop->context_lock);
|
g_rec_mutex_unlock (&loop->context_lock);
|
||||||
|
|
||||||
g_mutex_lock (&loop->lock);
|
g_mutex_lock (&loop->lock);
|
||||||
loop->paused = FALSE;
|
loop->paused = FALSE;
|
||||||
|
|
||||||
if (loop->stopped) {
|
stopped = loop->stopped;
|
||||||
g_mutex_unlock (&loop->lock);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wake up the loop to run again */
|
/* Wake up the loop to run again, regardless of stopped state */
|
||||||
g_cond_broadcast (&loop->cond);
|
g_cond_broadcast (&loop->cond);
|
||||||
g_mutex_unlock (&loop->lock);
|
g_mutex_unlock (&loop->lock);
|
||||||
|
|
||||||
|
if (stopped)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue