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:👿:FMP4Mux::drain_buffers:<fmp4mux0:sink_1> Don't have a complete GOP for the first stream on timeout in a live pipeline

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1127>
This commit is contained in:
Arun Raghavan 2023-03-09 23:28:29 -05:00
parent a12a8c566d
commit 04bb7b4db0

View file

@ -2928,7 +2928,22 @@ impl ElementImpl for FMP4Mux {
impl AggregatorImpl for FMP4Mux {
fn next_time(&self) -> Option<gst::ClockTime> {
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::<gst::ClockTime>()
.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(