From 9e3110988c1928867338e72bd8dcbeeff367eb85 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Wed, 22 Mar 2023 23:39:32 +0100 Subject: [PATCH] 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 558656deb5037a85d6213f2f9a857f4902c9502f for the initial passthrough=false case. Part-of: --- video/closedcaption/src/transcriberbin/imp.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs index 338eca6b..997c9451 100644 --- a/video/closedcaption/src/transcriberbin/imp.rs +++ b/video/closedcaption/src/transcriberbin/imp.rs @@ -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);