mp4mux: Make use of i64::TryFrom<gst::Signed<u64>> impl

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/979>
This commit is contained in:
Sebastian Dröge 2022-11-18 12:25:06 +02:00
parent 9903d536b5
commit 3003987c3a

View file

@ -594,18 +594,10 @@ impl MP4Mux {
let pts = gst::Signed::Positive(pts);
let dts = dts.unwrap(); // set above
if pts > dts {
Some(i64::try_from((pts - dts).nseconds().positive().unwrap()).map_err(|_| {
gst::error!(CAT, obj: stream.sinkpad, "Too big PTS/DTS difference");
gst::FlowError::Error
})?)
} else {
let diff = i64::try_from((dts - pts).nseconds().positive().unwrap()).map_err(|_| {
gst::error!(CAT, obj: stream.sinkpad, "Too big PTS/DTS difference");
gst::FlowError::Error
})?;
Some(-diff)
}
Some(i64::try_from((pts - dts).nseconds()).map_err(|_| {
gst::error!(CAT, obj: stream.sinkpad, "Too big PTS/DTS difference");
gst::FlowError::Error
})?)
} else {
None
};