From 0f2e18987be3eb2b43e054bd7ade07f7f8361983 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Mon, 24 Jul 2023 22:51:07 +0900 Subject: [PATCH] transcriberbin: Configure audioresample in front of transcriber Allows any samplerate and make it negotiable. Fixing a scenario where transcriberbin is configured with passthrough enabled, (and negotiated samplerate is not supported by transcriber) and then setting passthrough=false later during playback. Part-of: --- video/closedcaption/src/transcriberbin/imp.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs index 6ecd9d08..3e8c283d 100644 --- a/video/closedcaption/src/transcriberbin/imp.rs +++ b/video/closedcaption/src/transcriberbin/imp.rs @@ -38,6 +38,7 @@ struct State { audio_queue_passthrough: gst::Element, video_queue: gst::Element, audio_tee: gst::Element, + transcriber_resample: gst::Element, transcriber_aconv: gst::Element, transcriber: gst::Element, transcriber_queue: gst::Element, @@ -99,6 +100,7 @@ impl TranscriberBin { state.transcription_bin.add_many(&[ &aqueue_transcription, + &state.transcriber_resample, &state.transcriber_aconv, &state.transcriber, &state.transcriber_queue, @@ -111,6 +113,7 @@ impl TranscriberBin { gst::Element::link_many(&[ &aqueue_transcription, + &state.transcriber_resample, &state.transcriber_aconv, &state.transcriber, &state.transcriber_queue, @@ -457,6 +460,7 @@ impl TranscriberBin { let tttocea608 = gst::ElementFactory::make("tttocea608") .name("tttocea608") .build()?; + let transcriber_resample = gst::ElementFactory::make("audioresample").build()?; let transcriber_aconv = gst::ElementFactory::make("audioconvert").build()?; let transcriber = gst::ElementFactory::make("awstranscriber") .name("transcriber") @@ -474,6 +478,7 @@ impl TranscriberBin { internal_bin, audio_queue_passthrough, video_queue, + transcriber_resample, transcriber_aconv, transcriber, transcriber_queue,