Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ae31f36 authored by Harish Mahendrakar's avatar Harish Mahendrakar Committed by Wonsik Kim
Browse files

MPEG4Extractor: Overwrite opus version as 1

mp4 Opus Specific box says Version should be 0.
OpusHead requires this to 1.

MPEG4Extractor now validates that version before
overwriting it with 1.

Bug: 133448278
Test: Extract an mp4 file with opus track
Test: Mux the extracted file to ogg
Test: Extract opus from the muxed ogg file

Change-Id: Iee31eed69ea906b8f34f75f01a4d2c77b3e32077
parent 71cbb9d4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1754,6 +1754,15 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                // http://wiki.xiph.org/OggOpus#ID_Header
                strncpy((char *)opusInfo, "OpusHead", 8);

                // Version shall be 0 as per mp4 Opus Specific Box
                // (https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2)
                if (opusInfo[8]) {
                    return ERROR_MALFORMED;
                }
                // Force version to 1 as per OpusHead definition
                // (http://wiki.xiph.org/OggOpus#ID_Header)
                opusInfo[8] = 1;

                // Read Opus Specific Box values
                size_t opusOffset = 10;
                uint16_t pre_skip = U16_AT(&opusInfo[opusOffset]);