fmp4mux: Don't overflow negative composition offset calculation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/982>
This commit is contained in:
Sebastian Dröge 2022-11-19 19:24:04 +02:00
parent ae4b49c668
commit e3f645af19

View file

@ -1175,10 +1175,16 @@ impl FMP4Mux {
let pts = buffer.pts;
let dts = buffer.dts.unwrap();
Some(i64::try_from((pts - dts).nseconds()).map_err(|_| {
Some(
i64::try_from(
(gst::Signed::Positive(pts) - gst::Signed::Positive(dts))
.nseconds(),
)
.map_err(|_| {
gst::error!(CAT, obj: stream.sinkpad, "Too big PTS/DTS difference");
gst::FlowError::Error
})?)
})?,
)
};
buffers.push_back(Buffer {