From 79f5bc96d9d5f2db2f38bfae5fe2946a35abd866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Thu, 17 Jul 2025 19:12:12 +0200 Subject: [PATCH] threadshare: udpsrc / tcpclientsrc: latency report Incoming packets might be pushed up to `context-wait` late if the scheduler just parked due to no tasks needing progress. Part-of: --- generic/threadshare/src/tcpclientsrc/imp.rs | 5 ++++- generic/threadshare/src/udpsrc/imp.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/generic/threadshare/src/tcpclientsrc/imp.rs b/generic/threadshare/src/tcpclientsrc/imp.rs index 513a639c1..dd837eea0 100644 --- a/generic/threadshare/src/tcpclientsrc/imp.rs +++ b/generic/threadshare/src/tcpclientsrc/imp.rs @@ -127,7 +127,10 @@ impl PadSrcHandler for TcpClientSrcPadHandler { use gst::QueryViewMut; let ret = match query.view_mut() { QueryViewMut::Latency(q) => { - q.set(false, gst::ClockTime::ZERO, gst::ClockTime::NONE); + let latency = + gst::ClockTime::try_from(imp.settings.lock().unwrap().context_wait).unwrap(); + gst::debug!(CAT, obj = pad, "Reporting latency {latency}"); + q.set(true, latency, gst::ClockTime::NONE); true } QueryViewMut::Scheduling(q) => { diff --git a/generic/threadshare/src/udpsrc/imp.rs b/generic/threadshare/src/udpsrc/imp.rs index 33c277c7e..fec350877 100644 --- a/generic/threadshare/src/udpsrc/imp.rs +++ b/generic/threadshare/src/udpsrc/imp.rs @@ -153,7 +153,10 @@ impl PadSrcHandler for UdpSrcPadHandler { use gst::QueryViewMut; let ret = match query.view_mut() { QueryViewMut::Latency(q) => { - q.set(true, gst::ClockTime::ZERO, gst::ClockTime::NONE); + let latency = + gst::ClockTime::try_from(imp.settings.lock().unwrap().context_wait).unwrap(); + gst::debug!(CAT, obj = pad, "Reporting latency {latency}"); + q.set(true, latency, gst::ClockTime::NONE); true } QueryViewMut::Scheduling(q) => {