mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-23 02:26:35 +00:00
fallbacksrc: Connect to notify::active-pad
after requesting pads
Requesting the first pad will emit the property because the first pad is then selected. That will cause the callback to be called, which tries to take the same mutex that is already locked during element setup and causes a deadlock.
This commit is contained in:
parent
7daab76f17
commit
d3d98c73ca
1 changed files with 11 additions and 10 deletions
|
@ -928,16 +928,6 @@ impl FallbackSrc {
|
|||
.add_many(&[&fallback_input, &switch, &clocksync_queue, &clocksync])
|
||||
.unwrap();
|
||||
|
||||
let element_weak = element.downgrade();
|
||||
switch.connect_notify(Some("active-pad"), move |_switch, _pspec| {
|
||||
let element = match element_weak.upgrade() {
|
||||
None => return,
|
||||
Some(element) => element,
|
||||
};
|
||||
|
||||
let src = element.imp();
|
||||
src.handle_switch_active_pad_change(&element);
|
||||
});
|
||||
switch.set_property("timeout", timeout.nseconds());
|
||||
switch.set_property("min-upstream-latency", min_latency.nseconds());
|
||||
switch.set_property("immediate-fallback", immediate_fallback);
|
||||
|
@ -955,6 +945,17 @@ impl FallbackSrc {
|
|||
switch_mainsink.set_property("priority", 0u32);
|
||||
// clocksync_queue sink pad is not connected to anything yet at this point!
|
||||
|
||||
let element_weak = element.downgrade();
|
||||
switch.connect_notify(Some("active-pad"), move |_switch, _pspec| {
|
||||
let element = match element_weak.upgrade() {
|
||||
None => return,
|
||||
Some(element) => element,
|
||||
};
|
||||
|
||||
let src = element.imp();
|
||||
src.handle_switch_active_pad_change(&element);
|
||||
});
|
||||
|
||||
let srcpad = switch.static_pad("src").unwrap();
|
||||
let templ = element
|
||||
.pad_template(if is_audio { "audio" } else { "video" })
|
||||
|
|
Loading…
Reference in a new issue