From 486d2959dbd64d8f1bca7f624be0f4be0b9e20be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Cardoso?= Date: Fri, 8 Mar 2024 19:14:37 -0300 Subject: [PATCH] src: stream: sink: Use pipeline clock for the WebRTC's RTP --- src/stream/sink/webrtc_sink.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/stream/sink/webrtc_sink.rs b/src/stream/sink/webrtc_sink.rs index 27ef9e5c..b8ba5108 100644 --- a/src/stream/sink/webrtc_sink.rs +++ b/src/stream/sink/webrtc_sink.rs @@ -342,6 +342,20 @@ impl WebRTCSink { rx.recv()?? }; + // Configure RTP + let webrtcbin = webrtcbin.downcast::().unwrap(); + webrtcbin + .iterate_elements() + .filter(|e| e.name().starts_with("rtpbin")) + .into_iter() + .for_each(|res| { + let Ok(rtp_bin) = res else { return }; + + // Use the pipeline clock time. This will ensure that the timestamps from the source are correct. + rtp_bin.set_property_from_str("ntp-time-source", "clock-time"); + }); + let webrtcbin = webrtcbin.upcast::(); + let webrtcbin_sink_pad = webrtcbin .request_pad_simple("sink_%u") .context("Failed requesting sink pad for webrtcsink")?;