mirror of
https://github.com/androidx/media.git
synced 2025-05-14 11:09:53 +08:00
FragmentedMp4Extractor: Fix clearHeaderSize handling
PiperOrigin-RevId: 324560994
This commit is contained in:
parent
a04769f2d5
commit
42a7083b5c
@ -1753,14 +1753,13 @@ public class FragmentedMp4Extractor implements Extractor {
|
|||||||
// We need to account for the additional clear header by adding clearHeaderSize to
|
// We need to account for the additional clear header by adding clearHeaderSize to
|
||||||
// clearDataSize for the first subsample specified in the subsample encryption data.
|
// clearDataSize for the first subsample specified in the subsample encryption data.
|
||||||
scratch.reset(subsampleDataLength);
|
scratch.reset(subsampleDataLength);
|
||||||
scratch.readBytes(subsampleEncryptionData.getData(), /* offset= */ 0, subsampleDataLength);
|
byte[] scratchData = scratch.getData();
|
||||||
subsampleEncryptionData.skipBytes(subsampleDataLength);
|
subsampleEncryptionData.readBytes(scratchData, /* offset= */ 0, subsampleDataLength);
|
||||||
|
|
||||||
byte[] data = scratch.getData();
|
int clearDataSize = (scratchData[2] & 0xFF) << 8 | (scratchData[3] & 0xFF);
|
||||||
int clearDataSize = (data[2] & 0xFF) << 8 | (data[3] & 0xFF);
|
|
||||||
int adjustedClearDataSize = clearDataSize + clearHeaderSize;
|
int adjustedClearDataSize = clearDataSize + clearHeaderSize;
|
||||||
data[2] = (byte) ((adjustedClearDataSize >> 8) & 0xFF);
|
scratchData[2] = (byte) ((adjustedClearDataSize >> 8) & 0xFF);
|
||||||
data[3] = (byte) (adjustedClearDataSize & 0xFF);
|
scratchData[3] = (byte) (adjustedClearDataSize & 0xFF);
|
||||||
subsampleEncryptionData = scratch;
|
subsampleEncryptionData = scratch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user