webrtcsink: don't forget to setup encoders for discoveries

The "encoder-setup" signal must also be emitted for the encoders
used in discovery pipelines in order for the default settings to
be applied.

This otherwise meant that for instance the x264 encoder would
use a 60 frames latency, greatly delaying startup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1330>
This commit is contained in:
Mathieu Duponchelle 2023-08-01 00:28:52 +02:00 committed by Sebastian Dröge
parent 0f2e18987b
commit 3eab53be85

View file

@ -2209,7 +2209,7 @@ impl WebRTCSink {
&[&Option::<String>::None, &name, &codec.caps],
);
let (_, _, pay) = setup_encoding(
let (enc, _, pay) = setup_encoding(
&pipe.0,
&capsfilter,
caps,
@ -2219,6 +2219,8 @@ impl WebRTCSink {
true,
)?;
element.emit_by_name::<bool>("encoder-setup", &[&"discovery".to_string(), &name, &enc]);
let sink = make_element("fakesink", None)?;
pipe.0.add(&sink).unwrap();
@ -2761,7 +2763,8 @@ impl ObjectImpl for WebRTCSink {
.build(),
/**
* RsWebRTCSink::encoder-setup:
* @consumer_id: Identifier of the consumer
* @consumer_id: Identifier of the consumer, or "discovery"
* when the encoder is used in a discovery pipeline.
* @pad_name: The name of the corresponding input pad
* @encoder: The constructed encoder
*