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

Commit 9119ddd1 authored by Iris Chang's avatar Iris Chang Committed by Marco Nelissen
Browse files

MKV supports MP3 audio whose CodecID is A_MS/ACM

CodecID for MKV MP3 audio is not only A_MPEG/L3, but also
AMS_ACM. When CodecID is AMS_ACM, we should check format ID and
the file is MP3 if format ID is 0x0055. Need to support this
MP3 type.

Bug: 123594233
Test: Test MKV file whose audio CodecID is AMS_ACM and format
ID is 0x0055, and check if the MP3 audio can be played.

Change-Id: I15129e276b19338dc4f3f09eee6020aca5a5fa8e
parent 5cca289e
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1557,6 +1557,21 @@ void MatroskaExtractor::addTracks() {
                } else if (!strcmp("A_FLAC", codecID)) {
                    AMediaFormat_setString(meta, AMEDIAFORMAT_KEY_MIME, MEDIA_MIMETYPE_AUDIO_FLAC);
                    err = addFlacMetadata(meta, codecPrivate, codecPrivateSize);
                } else if ((!strcmp("A_MS/ACM", codecID))) {
                    if ((NULL == codecPrivate) || (codecPrivateSize < 30)) {
                        ALOGW("unsupported audio: A_MS/ACM has no valid private data: %s, size: %zu",
                               codecPrivate == NULL ? "null" : "non-null", codecPrivateSize);
                        continue;
                    } else {
                        uint16_t ID = *(uint16_t *)codecPrivate;
                        if (ID == 0x0055) {
                            AMediaFormat_setString(meta,
                                    AMEDIAFORMAT_KEY_MIME, MEDIA_MIMETYPE_AUDIO_MPEG);
                        } else {
                            ALOGW("A_MS/ACM unsupported type , continue");
                            continue;
                        }
                    }
                } else {
                    ALOGW("%s is not supported.", codecID);
                    continue;