awstranscriber2: fix PTS calculation with non-zero segment start

The time we get from AWS is a running time, and needs to be brought back
to the segment time domain before comparison with segment position and
usage as PTS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2123>
This commit is contained in:
Mathieu Duponchelle 2025-03-07 13:57:08 +01:00
parent 1282593420
commit 4397b1e8e1

View file

@ -248,7 +248,23 @@ impl Transcriber {
}
}
let mut pts = aws_start_time + state.discont_accumulator + lateness;
let rtime = aws_start_time + state.discont_accumulator + lateness;
let Some(mut pts) = state
.in_segment
.as_ref()
.unwrap()
.position_from_running_time(rtime)
else {
gst::warning!(
CAT,
imp = self,
"received item with running time outside of segment ({})",
rtime
);
continue;
};
let duration = aws_end_time.saturating_sub(aws_start_time);
if let Some(position) = state.in_segment.as_ref().unwrap().position() {