fallbackswitch: Notify active-pad without state lock held

Can otherwise deadlock.
This commit is contained in:
Vivia Nikolaidou 2022-04-11 12:58:51 +03:00 committed by Sebastian Dröge
parent b5a3a99825
commit 0ba6ebb10f

View file

@ -1236,11 +1236,12 @@ impl ElementImpl for FallbackSwitch {
pad.set_active(true).unwrap();
element.add_pad(&pad).unwrap();
let mut notify_active_pad = false;
if state.active_sinkpad.is_none() {
state.active_sinkpad = Some(pad.clone());
state.switched_pad = true;
state.discont_pending = true;
element.notify(PROP_ACTIVE_PAD);
notify_active_pad = true;
}
let mut pad_settings = pad.imp().settings.lock();
@ -1248,6 +1249,10 @@ impl ElementImpl for FallbackSwitch {
drop(pad_settings);
drop(state);
if notify_active_pad {
element.notify(PROP_ACTIVE_PAD);
}
let _ = element.post_message(gst::message::Latency::builder().src(element).build());
element.child_added(&pad, &pad.name());