From 5eccb180beb8a3ef265c0a2aef9d0d3fd56b5239 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 1 Oct 2024 16:33:40 +0200 Subject: [PATCH] transcriberbin: support both latency and transcribe-latency properties Also don't set translate-latency property if not present Part-of: --- video/closedcaption/src/transcriberbin/imp.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs index 38ac150b..5f2bcd0e 100644 --- a/video/closedcaption/src/transcriberbin/imp.rs +++ b/video/closedcaption/src/transcriberbin/imp.rs @@ -513,10 +513,17 @@ impl TranscriberBin { if let Some(ref transcriber) = pad_state.transcriber { let latency_ms = settings.latency.mseconds() as u32; - transcriber.set_property("transcribe-latency", latency_ms); - let translate_latency_ms = settings.translate_latency.mseconds() as u32; - transcriber.set_property("translate-latency", translate_latency_ms); + if transcriber.has_property("transcribe-latency", None) { + transcriber.set_property("transcribe-latency", latency_ms); + } else if transcriber.has_property("latency", None) { + transcriber.set_property("latency", latency_ms); + } + + if transcriber.has_property("translate-latency", None) { + let translate_latency_ms = settings.translate_latency.mseconds() as u32; + transcriber.set_property("translate-latency", translate_latency_ms); + } } pad_state .queue_passthrough