From f16f8f69d57d0529b00dc69b4c70df5e63469aa3 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Mon, 25 Nov 2024 18:09:42 +0100 Subject: [PATCH] aws/transcriber: don't adjust late item duration It makes for a better user experience to simply adjust the pts of a late item, but to preserve its duration: for instance a speech synthesis element might use the duration as a hint for speeding up the audio. Future late items may also be similarly offset anyway. Part-of: --- net/aws/src/transcriber/imp.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/aws/src/transcriber/imp.rs b/net/aws/src/transcriber/imp.rs index 44d31fdf..4e953182 100644 --- a/net/aws/src/transcriber/imp.rs +++ b/net/aws/src/transcriber/imp.rs @@ -1511,7 +1511,7 @@ impl TranslationPadTask { /* Safe unwrap, we know we have an item */ let OutputItem { pts: item_pts, - mut duration, + duration, content, } = self.output_items.pop_front().unwrap(); @@ -1552,7 +1552,6 @@ impl TranslationPadTask { // The buffer we are about to push was expected to start // before the end of last item previously pushed to the stream. // => update it to fit in stream. - let delta = last_position - pts; gst::warning!( CAT, @@ -1584,8 +1583,6 @@ impl TranslationPadTask { } pts = last_position; - // FIXME if the resulting duration is zero, we might as well not push it. - duration = duration.saturating_sub(delta); { let buf_mut = buf.get_mut().unwrap();