mirror of
https://github.com/androidx/media.git
synced 2025-05-14 02:59:52 +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
|
||||
// clearDataSize for the first subsample specified in the subsample encryption data.
|
||||
scratch.reset(subsampleDataLength);
|
||||
scratch.readBytes(subsampleEncryptionData.getData(), /* offset= */ 0, subsampleDataLength);
|
||||
subsampleEncryptionData.skipBytes(subsampleDataLength);
|
||||
byte[] scratchData = scratch.getData();
|
||||
subsampleEncryptionData.readBytes(scratchData, /* offset= */ 0, subsampleDataLength);
|
||||
|
||||
byte[] data = scratch.getData();
|
||||
int clearDataSize = (data[2] & 0xFF) << 8 | (data[3] & 0xFF);
|
||||
int clearDataSize = (scratchData[2] & 0xFF) << 8 | (scratchData[3] & 0xFF);
|
||||
int adjustedClearDataSize = clearDataSize + clearHeaderSize;
|
||||
data[2] = (byte) ((adjustedClearDataSize >> 8) & 0xFF);
|
||||
data[3] = (byte) (adjustedClearDataSize & 0xFF);
|
||||
scratchData[2] = (byte) ((adjustedClearDataSize >> 8) & 0xFF);
|
||||
scratchData[3] = (byte) (adjustedClearDataSize & 0xFF);
|
||||
subsampleEncryptionData = scratch;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user