webrtcsink: Refactor value retrieval to avoid lock poisoning

When setting an incorrect property name in settings,
start_stream_discovery_if_needed would panic because it attempts to
unwrap a poisoned lock for settings.

This refactor avoids that situation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1598>
This commit is contained in:
Francisco Javier Velázquez-García 2024-05-29 18:28:02 +03:00 committed by Backport Bot
parent 3cdb350626
commit 205cc10e6e

View file

@ -4113,8 +4113,8 @@ impl ObjectImpl for BaseWebRTCSink {
);
let this = element.imp();
let settings = this.settings.lock().unwrap();
configure_encoder(&enc, settings.cc_info.start_bitrate);
let start_bitrate = this.settings.lock().unwrap().cc_info.start_bitrate;
configure_encoder(&enc, start_bitrate);
// Return false here so that latter handlers get called
Some(false.to_value())