adaptivedemux2: Handle context going away

This issue can happen when the scheduler loop was stopped (and context went
away). We no longer want to push/pop main context threads.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6392>
This commit is contained in:
Edward Hervey 2024-03-18 15:00:02 +01:00 committed by GStreamer Marge Bot
parent 8438c3f567
commit 46bb0bfa57

View file

@ -310,6 +310,9 @@ gst_adaptive_demux_loop_pause_and_lock (GstAdaptiveDemuxLoop * loop)
g_rec_mutex_lock (&loop->context_lock); g_rec_mutex_lock (&loop->context_lock);
} }
if (!loop->context)
return FALSE;
g_main_context_push_thread_default (loop->context); g_main_context_push_thread_default (loop->context);
return TRUE; return TRUE;
@ -320,7 +323,8 @@ gst_adaptive_demux_loop_unlock_and_unpause (GstAdaptiveDemuxLoop * loop)
{ {
gboolean stopped; gboolean stopped;
g_main_context_pop_thread_default (loop->context); if (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);