diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2022-10-27 14:47:16 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2022-10-27 15:35:17 +0300 |
commit | 8e2a6500aa7c3fac141ab99f347df73b3ad0f70e (patch) | |
tree | 74ea5c75bdbfaa004d01f977115adf0409f77a23 /mux | |
parent | e2685779944bb39aa16970accf95b584625320b6 (diff) |
fmp4mux: Clip negative PTS to zero/last PTS instead of erroring out
This can happen at the beginning of a stream if upstream is
rtpjitterbuffer and it has problems figuring out timestamps in the
beginning due to resetting / skew.
Diffstat (limited to 'mux')
-rw-r--r-- | mux/fmp4/src/fmp4mux/imp.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/mux/fmp4/src/fmp4mux/imp.rs b/mux/fmp4/src/fmp4mux/imp.rs index 5414649d..3a233ccf 100644 --- a/mux/fmp4/src/fmp4mux/imp.rs +++ b/mux/fmp4/src/fmp4mux/imp.rs @@ -312,10 +312,11 @@ impl FMP4Mux { gst::error!(CAT, obj: stream.sinkpad, "Couldn't convert PTS to running time"); gst::FlowError::Error })? - .positive_or_else(|_| { - gst::error!(CAT, obj: stream.sinkpad, "Negative PTSs are not supported"); - gst::FlowError::Error - })?; + .positive() + .unwrap_or_else(|| { + gst::warning!(CAT, obj: stream.sinkpad, "Negative PTSs are not supported"); + gst::ClockTime::ZERO + }); let mut end_pts = segment .to_running_time_full(end_pts_position) @@ -323,10 +324,11 @@ impl FMP4Mux { gst::error!(CAT, obj: stream.sinkpad, "Couldn't convert end PTS to running time"); gst::FlowError::Error })? - .positive_or_else(|_| { - gst::error!(CAT, obj: stream.sinkpad, "Negative PTSs are not supported"); - gst::FlowError::Error - })?; + .positive() + .unwrap_or_else(|| { + gst::warning!(CAT, obj: stream.sinkpad, "Negative PTSs are not supported"); + gst::ClockTime::ZERO + }); // Enforce monotonically increasing PTS for intra-only streams if !delta_frames.requires_dts() { |