From 907fca2aa23c001d455442bb141d59ac3315a273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Wed, 30 Jul 2025 16:24:48 +0200 Subject: [PATCH] threadshare: fix regression in ts-proxysrc This [MR] introduced a race condition when the `ts-proxysink` started pushing items before `ts-prosysrc` had started. This commit reverts the changes to `ProxySrcTask::start`: wake up the pending queue when starting the task. Also applies this to `ts-queue` even though the race condition is less likely to happen. [MR]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2400 Part-of: --- generic/threadshare/src/proxy/imp.rs | 5 +++++ generic/threadshare/src/queue/imp.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/generic/threadshare/src/proxy/imp.rs b/generic/threadshare/src/proxy/imp.rs index ece0b8cc2..6490a0f3e 100644 --- a/generic/threadshare/src/proxy/imp.rs +++ b/generic/threadshare/src/proxy/imp.rs @@ -796,7 +796,12 @@ impl TaskImpl for ProxySrcTask { let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); + if let Some(pending_queue) = shared_ctx.pending_queue.as_mut() { + pending_queue.notify_more_queue_space(); + } + self.dataqueue.start(); + shared_ctx.last_res = Ok(gst::FlowSuccess::Ok); gst::log!(SRC_CAT, obj = self.element, "Task started"); diff --git a/generic/threadshare/src/queue/imp.rs b/generic/threadshare/src/queue/imp.rs index 040ba46a4..5298641df 100644 --- a/generic/threadshare/src/queue/imp.rs +++ b/generic/threadshare/src/queue/imp.rs @@ -269,7 +269,12 @@ impl TaskImpl for QueueTask { let queue = self.element.imp(); let mut last_res = queue.last_res.lock().unwrap(); + if let Some(pending_queue) = queue.pending_queue.lock().unwrap().as_mut() { + pending_queue.notify_more_queue_space(); + } + self.dataqueue.start(); + *last_res = Ok(gst::FlowSuccess::Ok); gst::log!(CAT, obj = self.element, "Task started");