From 46bb0bfa57327489a1dc98be1724c369b01ee605 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 18 Mar 2024 15:00:02 +0100 Subject: [PATCH] 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: --- .../ext/adaptivedemux2/gstadaptivedemuxutils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemuxutils.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemuxutils.c index d75f631892..b127d10f12 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemuxutils.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemuxutils.c @@ -310,6 +310,9 @@ gst_adaptive_demux_loop_pause_and_lock (GstAdaptiveDemuxLoop * loop) g_rec_mutex_lock (&loop->context_lock); } + + if (!loop->context) + return FALSE; g_main_context_push_thread_default (loop->context); return TRUE; @@ -320,7 +323,8 @@ gst_adaptive_demux_loop_unlock_and_unpause (GstAdaptiveDemuxLoop * loop) { 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_mutex_lock (&loop->lock);