mirror of
https://github.com/samsonjs/media.git
synced 2026-04-08 11:45:51 +00:00
Fix byte order for HDR10+ static metadata
The implementation of writing HDR10+ static metadata assumed that the application would use default (big endian) byte order for this metadata but MediaCodec expects the order to match the specification CTA-861.3. PiperOrigin-RevId: 281050806
This commit is contained in:
parent
7f19b88506
commit
da9c985cce
2 changed files with 5 additions and 3 deletions
|
|
@ -10,6 +10,7 @@
|
|||
[embedded in Matroska streams](https://matroska.org/technical/specs/subtitles/index.html).
|
||||
* Use `ExoMediaDrm.Provider` in `OfflineLicenseHelper` to avoid `ExoMediaDrm`
|
||||
leaks ([#4721](https://github.com/google/ExoPlayer/issues/4721)).
|
||||
* Fix byte order of HDR10+ static metadata to match CTA-861.3.
|
||||
|
||||
### 2.11.0 (not yet released) ###
|
||||
|
||||
|
|
|
|||
|
|
@ -1912,9 +1912,9 @@ public class MatroskaExtractor implements Extractor {
|
|||
initializationData = new ArrayList<>(3);
|
||||
initializationData.add(codecPrivate);
|
||||
initializationData.add(
|
||||
ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(codecDelayNs).array());
|
||||
ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN).putLong(codecDelayNs).array());
|
||||
initializationData.add(
|
||||
ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(seekPreRollNs).array());
|
||||
ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN).putLong(seekPreRollNs).array());
|
||||
break;
|
||||
case CODEC_ID_AAC:
|
||||
mimeType = MimeTypes.AUDIO_AAC;
|
||||
|
|
@ -2116,6 +2116,7 @@ public class MatroskaExtractor implements Extractor {
|
|||
}
|
||||
|
||||
/** Returns the HDR Static Info as defined in CTA-861.3. */
|
||||
@Nullable
|
||||
private byte[] getHdrStaticInfo() {
|
||||
// Are all fields present.
|
||||
if (primaryRChromaticityX == Format.NO_VALUE || primaryRChromaticityY == Format.NO_VALUE
|
||||
|
|
@ -2128,7 +2129,7 @@ public class MatroskaExtractor implements Extractor {
|
|||
}
|
||||
|
||||
byte[] hdrStaticInfoData = new byte[25];
|
||||
ByteBuffer hdrStaticInfo = ByteBuffer.wrap(hdrStaticInfoData);
|
||||
ByteBuffer hdrStaticInfo = ByteBuffer.wrap(hdrStaticInfoData).order(ByteOrder.LITTLE_ENDIAN);
|
||||
hdrStaticInfo.put((byte) 0); // Type.
|
||||
hdrStaticInfo.putShort((short) ((primaryRChromaticityX * MAX_CHROMATICITY) + 0.5f));
|
||||
hdrStaticInfo.putShort((short) ((primaryRChromaticityY * MAX_CHROMATICITY) + 0.5f));
|
||||
|
|
|
|||
Loading…
Reference in a new issue