speechmatics: fix state cycling

The static source pad is added to the dynamic srcpads collection for
convenience, so when the state transitions back to NULL and state is
reset to its default, we need to make sure to re-add the static source
pad to the collection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2072>
This commit is contained in:
Mathieu Duponchelle 2025-02-25 16:29:37 +01:00
parent 6b9e3fd772
commit 5d83d27798

View file

@ -1534,8 +1534,19 @@ impl Transcriber {
});
}
let srcpads = state.srcpads.clone();
*state = State::default();
for srcpad in &srcpads {
let mut sstate = srcpad.imp().state.lock().unwrap();
let unsynced_pad = sstate.unsynced_pad.take();
*sstate = TranscriberSrcPadState::default();
sstate.unsynced_pad = unsynced_pad;
}
state.srcpads = srcpads;
gst::info!(
CAT,
imp = self,
@ -1551,6 +1562,10 @@ impl Transcriber {
let mut state = self.state.lock().unwrap();
if !state.connected {
return None;
}
if state.start_time.is_none() {
state.start_time = Some(now);
for pad in state.srcpads.iter() {