diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2023-07-13 23:18:08 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-07-19 09:53:00 +0300 |
commit | 584dff79618e45df64f4991fb82ff47e3e1045b5 (patch) | |
tree | 5870cb2c3379a07a0a27dd9e5f5f9f3c25112c71 | |
parent | acff5a9394197f33df11becb37600847470c6655 (diff) |
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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1286>
-rw-r--r-- | net/webrtc/src/webrtcsink/imp.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index d6332bc40..839affbc2 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -2397,7 +2397,18 @@ impl WebRTCSink { .iter_mut() .for_each(|(_, mut stream)| { if stream.sink_pad.upcast_ref::<gst::Pad>() == 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()); } else if stream.in_caps.is_none() { all_pads_have_caps = false; } |