From 84f6484140098826b3f074d806e0eb052198df43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 22 Aug 2022 15:20:10 +0300 Subject: [PATCH] fmp4mux: Consider invalid running times as zero and before anything else The code tried to do this before but didn't consider the case where the first pad has a valid running time, in which case the buffer with the invalid running time would never be dequeued and the muxer would never output anything. --- generic/fmp4/src/fmp4mux/imp.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/generic/fmp4/src/fmp4mux/imp.rs b/generic/fmp4/src/fmp4mux/imp.rs index aa74ab03..7d9aa730 100644 --- a/generic/fmp4/src/fmp4mux/imp.rs +++ b/generic/fmp4/src/fmp4mux/imp.rs @@ -225,7 +225,12 @@ impl FMP4Mux { let running_time = match segment.to_running_time(buffer.dts_or_pts()) { None => { gst::trace!(CAT, obj: &stream.sinkpad, "Stream has no valid running time"); - if earliest_stream.is_none() { + if earliest_stream + .as_ref() + .map_or(true, |(_, _, earliest_running_time)| { + *earliest_running_time > gst::ClockTime::ZERO + }) + { earliest_stream = Some((idx, stream, gst::ClockTime::ZERO)); } continue;