fallbacksrc: Request the main pad first from fallbackswitch

By default the first created pad is the active one before the
fallbackswitch is actually processing data.
This commit is contained in:
Sebastian Dröge 2022-04-08 20:24:03 +03:00
parent 96c28a5728
commit 08379ab389

View file

@ -932,11 +932,6 @@ impl FallbackSrc {
switch.set_property("min-upstream-latency", min_latency.nseconds());
switch.set_property("immediate-fallback", immediate_fallback);
let fallback_srcpad = fallback_input.static_pad("src").unwrap();
let switch_fallbacksink = switch.request_pad_simple("sink_%u").unwrap();
fallback_srcpad.link(&switch_fallbacksink).unwrap();
switch_fallbacksink.set_property("priority", 1u32);
gst::Element::link_pads(&clocksync_queue, Some("src"), &clocksync, Some("sink")).unwrap();
let clocksync_srcpad = clocksync.static_pad("src").unwrap();
@ -945,6 +940,11 @@ impl FallbackSrc {
switch_mainsink.set_property("priority", 0u32);
// clocksync_queue sink pad is not connected to anything yet at this point!
let fallback_srcpad = fallback_input.static_pad("src").unwrap();
let switch_fallbacksink = switch.request_pad_simple("sink_%u").unwrap();
fallback_srcpad.link(&switch_fallbacksink).unwrap();
switch_fallbacksink.set_property("priority", 1u32);
let element_weak = element.downgrade();
switch.connect_notify(Some("active-pad"), move |_switch, _pspec| {
let element = match element_weak.upgrade() {