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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1930>
This commit is contained in:
Mathieu Duponchelle 2024-11-25 18:09:42 +01:00 committed by GStreamer Marge Bot
parent 9972c83c60
commit f16f8f69d5

View file

@ -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();