transcriberbin: fix initial transcription bin setup

When passthrough=false at construction and the transcription bin
is linked after receiving video caps (and not on state change),
there could be a race where transcription-bin was linked with
tee but state change of the transcription-bin was not finished.

If upstream pushed a buffer at that point, it got a flushing flow
return and stopped streaming.

This is the same issue and the same fix as 558656deb5
for the initial passthrough=false case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1142>
This commit is contained in:
Mathieu Duponchelle 2023-03-22 23:39:32 +01:00
parent ac52ea4d8e
commit 9e3110988c

View file

@ -261,10 +261,6 @@ impl TranscriberBin {
state.transcriber.set_property("latency", latency_ms);
if !settings.passthrough {
let audio_tee_pad = state.audio_tee.request_pad_simple("src_%u").unwrap();
let transcription_sink_pad = state.transcription_bin.static_pad("sink").unwrap();
audio_tee_pad.link(&transcription_sink_pad).unwrap();
state
.transcription_bin
.link_pads(Some("src"), &state.cccombiner, Some("caption"))
@ -272,6 +268,10 @@ impl TranscriberBin {
state.transcription_bin.set_locked_state(false);
state.transcription_bin.sync_state_with_parent().unwrap();
let audio_tee_pad = state.audio_tee.request_pad_simple("src_%u").unwrap();
let transcription_sink_pad = state.transcription_bin.static_pad("sink").unwrap();
audio_tee_pad.link(&transcription_sink_pad).unwrap();
}
drop(settings);