togglerecord: Notify main_stream_cond on release_pad

Otherwise, it would deadlock when releasing first the primary stream and
then the secondary one, because it will wait in the "secondary stream"
handling for the main stream to be fed, which will never happen.
This commit is contained in:
Vivia Nikolaidou 2021-08-25 16:54:29 +03:00 committed by Sebastian Dröge
parent b62b5f9643
commit add7fd2693

View file

@ -2041,9 +2041,6 @@ impl ElementImpl for ToggleRecord {
Some(stream) => stream.clone(),
};
stream.srcpad.set_active(false).unwrap();
stream.sinkpad.set_active(false).unwrap();
pads.remove(&stream.sinkpad).unwrap();
pads.remove(&stream.srcpad).unwrap();
@ -2054,6 +2051,13 @@ impl ElementImpl for ToggleRecord {
drop(pads);
drop(other_streams_guard);
let main_state = self.main_stream.state.lock();
self.main_stream_cond.notify_all();
drop(main_state);
stream.srcpad.set_active(false).unwrap();
stream.sinkpad.set_active(false).unwrap();
element.remove_pad(&stream.sinkpad).unwrap();
element.remove_pad(&stream.srcpad).unwrap();
}