diff --git a/generic/fmp4/src/fmp4mux/imp.rs b/generic/fmp4/src/fmp4mux/imp.rs index ef3134d5..a2a0eef8 100644 --- a/generic/fmp4/src/fmp4mux/imp.rs +++ b/generic/fmp4/src/fmp4mux/imp.rs @@ -513,14 +513,17 @@ impl FMP4Mux { // // Otherwise if the current PTS is a fragment duration in the future, send the next one // now. - let pts = segment.to_running_time(pts).expect("no running time"); let last_force_keyunit_time = match stream.last_force_keyunit_time { None => return Ok(None), - Some(last_force_keyunit_time) if last_force_keyunit_time > pts => return Ok(None), Some(last_force_keyunit_time) => last_force_keyunit_time, }; + let pts = segment.to_running_time(pts); + if pts.map_or(true, |pts| last_force_keyunit_time > pts) { + return Ok(None); + } + let fku_running_time = last_force_keyunit_time + settings.fragment_duration; gst::debug!( CAT,