fallbackswitch: Only notify active-pad property on state changes if it actually changed

This commit is contained in:
Sebastian Dröge 2022-04-08 20:23:28 +03:00
parent 452ea76a69
commit 96c28a5728

View file

@ -1140,18 +1140,21 @@ impl ElementImpl for FallbackSwitch {
}
gst::StateChange::ReadyToPaused => {
let mut state = self.state.lock();
let prev_active_pad = state.active_sinkpad.clone();
*state = State::default();
let pads = element.sink_pads();
if let Some(pad) = pads.first() {
state.active_sinkpad = Some(
pad.clone()
.downcast::<super::FallbackSwitchSinkPad>()
.unwrap(),
);
let pad = pad.downcast_ref::<super::FallbackSwitchSinkPad>().unwrap();
state.active_sinkpad = Some(pad.clone());
state.switched_pad = true;
state.discont_pending = true;
drop(state);
element.notify(PROP_ACTIVE_PAD);
if prev_active_pad.as_ref() != Some(pad) {
element.notify(PROP_ACTIVE_PAD);
}
}
for pad in pads {
let pad = pad.downcast_ref::<super::FallbackSwitchSinkPad>().unwrap();