diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2022-12-15 19:52:47 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2022-12-15 19:52:47 +0300 |
commit | 9307acf7fa36bf49d762c0d180c9fb0e7bfcb13a (patch) | |
tree | b21f4fa25e23a6fafa49f7d34491e8dc02045e44 /mux | |
parent | ed429d570e7494367cd8ef0135885547c39008a4 (diff) |
mp4mux: Fix edit list shift for streams with initial DTS smaller earliest PTS but initial DTS positive
This would be a stream where the initial DTS is negative if the initial
PTS was zero, but it is offset so the initial DTS became positive now.
The edit list shift has to happen exactly the same way though.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1014>
Diffstat (limited to 'mux')
-rw-r--r-- | mux/mp4/src/mp4mux/boxes.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mux/mp4/src/mp4mux/boxes.rs b/mux/mp4/src/mp4mux/boxes.rs index 4309c9cd..9db658ee 100644 --- a/mux/mp4/src/mp4mux/boxes.rs +++ b/mux/mp4/src/mp4mux/boxes.rs @@ -1683,9 +1683,11 @@ fn write_elst( v.extend(duration.to_be_bytes()); // Media time - if let Some(gst::Signed::Negative(start_dts)) = stream.start_dts { - let shift = (stream.earliest_pts + start_dts) + if let Some(start_dts) = stream.start_dts { + let shift = (gst::Signed::Positive(stream.earliest_pts) - start_dts) .nseconds() + .positive() + .unwrap_or(0) .mul_div_round(timescale as u64, gst::ClockTime::SECOND.nseconds()) .context("too big track duration")?; |