Fix version and flags in the ctts box

The version and flags are stored in a single integer,
with the version in the higher 8 bits and the flags in
the lower 24 bits. The version should be 1 and the
flags should be 0.

Surprisingly the incorrect value was ignored by many
players and hence the bug was never caught.
With the bug, the video does not play on
`Samsung Galaxy S22 Ultra` and works well
after fixing the bug.

PiperOrigin-RevId: 684433371
This commit is contained in:
sheenachhabra 2024-10-10 07:16:38 -07:00 committed by Copybara-Service
parent 3818e103e6
commit 1729e11159
2 changed files with 3 additions and 2 deletions

View File

@ -898,7 +898,8 @@ import org.checkerframework.checker.nullness.qual.PolyNull;
ByteBuffer.allocate(
2 * BYTES_PER_INTEGER + 2 * compositionOffsets.size() * BYTES_PER_INTEGER);
contents.putInt(1); // version and flags.
int versionAndFlags = 1 << 24; // version (value 1, 8 bits) + flag (value 0, 24 bits)
contents.putInt(versionAndFlags);
// Total entry count is known only after processing all the composition offsets, so put in
// a placeholder for total entry count and store its index.

View File

@ -1,2 +1,2 @@
ctts (88 bytes):
Data = length 80, hash FC850C18
Data = length 80, hash D9A9F376