webrtcsink: Set caps-change-mode=delayed on encoder capsfilter

Otherwise when changing the target caps (e.g. for reducing quality)
there is a race condition between buffers between the converter elements
and renegotiation.

For example, videoconvertscale might've output a 1920x1080 buffer, then
the capsfilter is configured to 1280x720, the buffer arrives in
videorate, videorate notices that renegotiation is pending, tries to
renegotiate and ends up with EMPTY caps because it can only change the
framerate but not the resolution.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1949>
This commit is contained in:
Sebastian Dröge 2024-11-28 23:11:20 +02:00 committed by GStreamer Marge Bot
parent c3de9e5927
commit f4d2bd1a5d

View file

@ -716,6 +716,7 @@ impl Codec {
gst::ElementFactory::make("capsfilter") gst::ElementFactory::make("capsfilter")
.property("caps", &caps) .property("caps", &caps)
.property_from_str("caps-change-mode", "delayed")
.build() .build()
.with_context(|| "Creating capsfilter caps") .with_context(|| "Creating capsfilter caps")
} }