webrtcsink: fix TWCC extension adding

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1310>
This commit is contained in:
Robert Ayrapetyan 2023-08-22 21:56:05 +00:00
parent ba9fa989ff
commit e83238b681

View file

@ -677,10 +677,13 @@ impl EncodingChainBuilder {
* provide feedback for audio packets.
*/
if let Some(idx) = self.twcc {
let twcc_extension =
gst_rtp::RTPHeaderExtension::create_from_uri(RTP_TWCC_URI).unwrap();
twcc_extension.set_id(idx);
pay.emit_by_name::<()>("add-extension", &[&twcc_extension]);
if let Some(twcc_extension) = gst_rtp::RTPHeaderExtension::create_from_uri(RTP_TWCC_URI)
{
twcc_extension.set_id(idx);
pay.emit_by_name::<()>("add-extension", &[&twcc_extension]);
} else {
anyhow::bail!("Failed to add TWCC extension, make sure 'gst-plugins-good:rtpmanager' is installed");
}
}
elements.push(pay);