diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 5e4c9b78aa..6451fada36 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -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) ### diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java index 517c087e18..69bdb2cd46 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java @@ -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));