mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-29 06:50:59 +00:00
mp4mux: Don't write gap edit lists if their duration would be zero
The track might start later than the earliest track by less than one timescale units, in which case writing an empty gap edit list would be useless and confusing. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1014>
This commit is contained in:
parent
f8024f072f
commit
ed429d570e
1 changed files with 18 additions and 12 deletions
|
@ -1646,16 +1646,18 @@ fn write_elst(
|
|||
let min_earliest_pts = header.streams.iter().map(|s| s.earliest_pts).min().unwrap();
|
||||
|
||||
if min_earliest_pts != stream.earliest_pts {
|
||||
let gap = (stream.earliest_pts - min_earliest_pts)
|
||||
.nseconds()
|
||||
.mul_div_round(timescale as u64, gst::ClockTime::SECOND.nseconds())
|
||||
.context("too big gap")?;
|
||||
|
||||
if gap > 0 {
|
||||
// Entry count
|
||||
v.extend(2u32.to_be_bytes());
|
||||
|
||||
// First entry for the gap
|
||||
|
||||
// Edit duration
|
||||
let gap = (stream.earliest_pts - min_earliest_pts)
|
||||
.nseconds()
|
||||
.mul_div_round(timescale as u64, gst::ClockTime::SECOND.nseconds())
|
||||
.context("too big gap")?;
|
||||
v.extend(gap.to_be_bytes());
|
||||
|
||||
// Media time
|
||||
|
@ -1668,6 +1670,10 @@ fn write_elst(
|
|||
// Entry count
|
||||
v.extend(1u32.to_be_bytes());
|
||||
}
|
||||
} else {
|
||||
// Entry count
|
||||
v.extend(1u32.to_be_bytes());
|
||||
}
|
||||
|
||||
// Edit duration
|
||||
let duration = (stream.end_pts - stream.earliest_pts)
|
||||
|
|
Loading…
Reference in a new issue