awstranscriber2: fix initial position

Wait until we have received a first buffer before pushing gaps on
timeout, as we don't have a valid start time before that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2072>
This commit is contained in:
Mathieu Duponchelle 2025-02-25 17:51:02 +01:00
parent d0db66d61e
commit 6b9e3fd772

View file

@ -329,7 +329,9 @@ impl Transcriber {
if let Some(upstream_latency) = upstream_latency {
let (upstream_live, upstream_min, _) = upstream_latency;
if upstream_live {
// Don't push a gap before we've even received a first buffer,
// as we haven't set in_segment.position to a start time yet
if upstream_live && state.last_input_rtime.is_some() {
if let Some(now) = now {
let seqnum = state.seqnum;
let in_segment = state.in_segment.as_mut().unwrap();
@ -603,6 +605,10 @@ impl Transcriber {
gst::trace!(CAT, imp = self, "storing last input running time {rtime}");
if state.last_input_rtime.is_none() {
state.in_segment.as_mut().unwrap().set_position(Some(pts));
}
state.last_input_rtime = Some(rtime);
}