From 04bb7b4db0fcf84283c07297b1577dd97564a0f9 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Thu, 9 Mar 2023 23:28:29 -0500 Subject: [PATCH] fmp4: Return a running time in get_next_time() We were currently returning a value based on the next chunk PTS, but the expectation in GstAggregator is that we return a running time. This resulted in spurious wakeups and warnings like: 0:00:01.501685123 1552995 0x55899715c1e0 WARN fmp4mux mux/fmp4/src/fmp4mux/imp.rs:1818:gstfmp4::fmp4mux::imp::FMP4Mux::drain_buffers: Don't have a complete GOP for the first stream on timeout in a live pipeline Part-of: --- mux/fmp4/src/fmp4mux/imp.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mux/fmp4/src/fmp4mux/imp.rs b/mux/fmp4/src/fmp4mux/imp.rs index 08c39d1b..38e48dd0 100644 --- a/mux/fmp4/src/fmp4mux/imp.rs +++ b/mux/fmp4/src/fmp4mux/imp.rs @@ -2928,7 +2928,22 @@ impl ElementImpl for FMP4Mux { impl AggregatorImpl for FMP4Mux { fn next_time(&self) -> Option { let state = self.state.lock().unwrap(); - state.chunk_start_pts.opt_add(state.timeout_delay) + let agg = self.obj(); + let segment = agg + .src_pad() + .segment() + .downcast::() + .expect("TIME segment"); + + state + .chunk_start_pts + .opt_add(state.timeout_delay) + .and_then(|mut t| { + if !agg.class().as_ref().variant.is_single_stream() { + t += SEGMENT_OFFSET; + } + segment.to_running_time(t) + }) } fn sink_query(