mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add comment about out-of-order timestamps in AtomParsers.parseStbl
PiperOrigin-RevId: 550596173
This commit is contained in:
parent
e5e3db954f
commit
449cf55523
1 changed files with 7 additions and 0 deletions
|
|
@ -691,6 +691,13 @@ import java.util.List;
|
||||||
long editDuration =
|
long editDuration =
|
||||||
Util.scaleLargeTimestamp(
|
Util.scaleLargeTimestamp(
|
||||||
track.editListDurations[i], track.timescale, track.movieTimescale);
|
track.editListDurations[i], track.timescale, track.movieTimescale);
|
||||||
|
// The timestamps array is in the order read from the media, which might not be strictly
|
||||||
|
// sorted, but will ensure that a) all sync frames are in-order and b) any out-of-order
|
||||||
|
// frames are after their respective sync frames. This means that although the result of
|
||||||
|
// this binary search might be slightly incorrect (due to out-of-order timestamps), the loop
|
||||||
|
// below that walks forward to find the next sync frame will result in a correct start
|
||||||
|
// index. The start index would also be correct if we walk backwards to the previous sync
|
||||||
|
// frame (https://github.com/google/ExoPlayer/issues/1659).
|
||||||
startIndices[i] =
|
startIndices[i] =
|
||||||
Util.binarySearchFloor(
|
Util.binarySearchFloor(
|
||||||
timestamps, editMediaTime, /* inclusive= */ true, /* stayInBounds= */ true);
|
timestamps, editMediaTime, /* inclusive= */ true, /* stayInBounds= */ true);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue