You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix gapless playback for tracks with timescale rounding differences
When parsing an MP4 file with a simple edit list used for gapless trimming, the extractor calculates the track's duration in two different ways:
1. `duration` is calculated by summing the integer durations of all samples in the `stts` box.
2. `editEndTime` is calculated by scaling the single duration value from the `elst` box (which is in the movie's timescale) to the track's timescale.
This two-step scaling process can introduce small rounding errors. In some cases, the calculated `editEndTime` can be slightly larger than the `duration` (e.g., by 1-2 timescale units), even if the edit is valid and intended to end at the same time as the media.
This caused the sanity check `editEndTime <= duration` to fail, preventing gapless playback info from being applied.
This change introduces a small tolerance of 2 timescale units to this check, making it resilient to these rounding artifacts.
PiperOrigin-RevId: 789749132
0 commit comments