From 9707bb89e62d4eb186eb72e67a8493e5bb31a111 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Thu, 13 Jul 2023 22:18:08 +0200 Subject: [PATCH] webrtcsink: fix pipeline when input caps contain max-framerate GstVideoInfo uses max-framerate to compute its fps, but this leads to issues in videorate when framerate is actually 0/1. Fix this by stripping away max-framerate from input caps Part-of: --- net/webrtc/src/webrtcsink/imp.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index 2f94b1c6..262ad11b 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -3035,7 +3035,18 @@ impl BaseWebRTCSink { .iter_mut() .for_each(|(_, stream)| { if stream.sink_pad.upcast_ref::() == pad { - stream.in_caps = Some(e.caps().to_owned()); + // We do not want VideoInfo to consider max-framerate + // when computing fps, so we strip it away here + let mut caps = e.caps().to_owned(); + { + let mut_caps = caps.get_mut().unwrap(); + if let Some(s) = mut_caps.structure_mut(0) { + if s.has_name("video/x-raw") { + s.remove_field("max-framerate"); + } + } + } + stream.in_caps = Some(caps.to_owned()); } }); }