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/1289>
This commit is contained in:
Mathieu Duponchelle 2023-08-01 00:28:52 +02:00
parent dbeb65da06
commit 9680805bdb

View file

@ -2804,6 +2804,13 @@ impl BaseWebRTCSink {
} }
let encoding_chain = encoding_chain_builder.build(&pipe.0, &encoding_chain_src)?; let encoding_chain = encoding_chain_builder.build(&pipe.0, &encoding_chain_src)?;
if let Some(ref enc) = encoding_chain.encoder {
element.emit_by_name::<bool>(
"encoder-setup",
&[&"discovery".to_string(), &stream_name, &enc],
);
}
let sink = gst_app::AppSink::builder() let sink = gst_app::AppSink::builder()
.callbacks( .callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
@ -3493,7 +3500,8 @@ impl ObjectImpl for BaseWebRTCSink {
.build(), .build(),
/** /**
* RsBaseWebRTCSink::encoder-setup: * RsBaseWebRTCSink::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 * @pad_name: The name of the corresponding input pad
* @encoder: The constructed encoder * @encoder: The constructed encoder
* *