webrtcsink: Move videorate before videoconvert and videoscale

Since videorate has drop-only=true, this could reduce the number of
frames to convert and scale.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2402>
This commit is contained in:
Xavier Claessens 2025-07-24 18:21:12 -04:00 committed by GStreamer Marge Bot
parent 44a632811e
commit 78c8d4df55

View file

@ -593,7 +593,7 @@ fn make_converter_for_video_caps(caps: &gst::Caps, codec: &Codec) -> Result<gst:
let ret = gst::Bin::default();
let (head, mut tail) = {
let (mut head, tail) = {
if let Some(feature) = caps.features(0) {
if feature.contains(NVMM_MEMORY_FEATURE)
// NVIDIA V4L2 encoders require NVMM memory as input and that requires using the
@ -677,19 +677,19 @@ fn make_converter_for_video_caps(caps: &gst::Caps, codec: &Codec) -> Result<gst:
}
};
ret.add_pad(&gst::GhostPad::with_target(&head.static_pad("sink").unwrap()).unwrap())
.unwrap();
if video_info.fps().numer() != 0 {
let vrate = make_element("videorate", None)?;
vrate.set_property("drop-only", true);
vrate.set_property("skip-to-first", true);
ret.add(&vrate)?;
tail.link(&vrate)?;
tail = vrate;
vrate.link(&head)?;
head = vrate;
}
ret.add_pad(&gst::GhostPad::with_target(&head.static_pad("sink").unwrap()).unwrap())
.unwrap();
ret.add_pad(&gst::GhostPad::with_target(&tail.static_pad("src").unwrap()).unwrap())
.unwrap();