From 5ae3c9318d7ebb53a096125d1fcbe1b1169d9d33 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Thu, 18 Aug 2022 16:36:45 +0200 Subject: [PATCH] adaptivedemux2: Fix download helper with libsoup 3.0.x libsoup 3.0.x dispatches using a single source attached when the session is created, so we need to create the session with the same context that our download thread is later using. 2.74 or 3.1 will dispatch a response using the context which sent the request. However, for any context other than the one that created the session, this will also create and destroy sources, so there's still some slight performance benefit. Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1384 Part-of: --- .../gst-plugins-good/ext/adaptivedemux2/downloadhelper.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/downloadhelper.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/downloadhelper.c index 3541364078..80b49751da 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/downloadhelper.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/downloadhelper.c @@ -609,10 +609,16 @@ downloadhelper_new (GstAdaptiveDemuxClock * clock) g_async_queue_new_full ((GDestroyNotify) g_object_unref); dh->transfer_requests_source = NULL; + /* libsoup 3.0 (not 2.74 or 3.1) dispatches using a single source attached + * when the session is created, so we need to ensure it matches here. */ + g_main_context_push_thread_default (dh->transfer_context); + /* Set 10 second timeout. Any longer is likely * an attempt to reuse an already closed connection */ dh->session = _soup_session_new_with_options ("timeout", 10, NULL); + g_main_context_pop_thread_default (dh->transfer_context); + return dh; } -- 2.34.1