threadshare/inputselector: Send a reconfigure event when the active pad changes

This commit is contained in:
Sebastian Dröge 2020-03-19 11:29:32 +02:00
parent 4c0ba5c374
commit dcf2befe52

View file

@ -550,14 +550,29 @@ impl ObjectImpl for InputSelector {
let pad = value.get::<gst::Pad>().expect("type checked upstream");
let mut state = self.state.lock().unwrap();
let pads = self.pads.lock().unwrap();
if let Some(pad) = pad {
let mut old_pad = None;
if let Some(ref pad) = pad {
if pads.sink_pads.get(&pad).is_some() {
state.active_sinkpad = Some(pad);
old_pad = state.active_sinkpad.clone();
state.active_sinkpad = Some(pad.clone());
state.switched_pad = true;
}
} else {
state.active_sinkpad = None;
}
drop(pads);
drop(state);
if let Some(old_pad) = old_pad {
if Some(&old_pad) != pad.as_ref() {
let _ = old_pad.push_event(gst::Event::new_reconfigure().build());
}
}
if let Some(pad) = pad {
let _ = pad.push_event(gst::Event::new_reconfigure().build());
}
}
_ => unimplemented!(),
}