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>
This commit is contained in:
Mathieu Duponchelle 2023-07-13 22:18:08 +02:00 committed by Sebastian Dröge
parent acff5a9394
commit 584dff7961

View file

@ -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;
}