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