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.
This commit is contained in:
Sebastian Dröge 2022-10-27 14:47:16 +03:00
parent 627bf756b1
commit 938f4e4f1c

View file

@ -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() {