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

Commit 1c824832 authored by Mansi Patel's avatar Mansi Patel Committed by Steve Kondik
Browse files

libstagefright: Add support to decode mp3 data in mp4 container.

Change-Id: Id72d47e774d59ee1a9cf0c3533386f94f5d3cbe7
parent e2bb31d7
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -237,6 +237,9 @@ static const char *FourCC2MIME(uint32_t fourcc) {
        case FOURCC('m', 'p', '4', 'a'):
            return MEDIA_MIMETYPE_AUDIO_AAC;

        case FOURCC('.', 'm', 'p', '3'):
            return MEDIA_MIMETYPE_AUDIO_MPEG;

        case FOURCC('s', 'a', 'm', 'r'):
            return MEDIA_MIMETYPE_AUDIO_AMR_NB;

@@ -725,6 +728,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
        }

        case FOURCC('m', 'p', '4', 'a'):
        case FOURCC('.', 'm', 'p', '3'):
        case FOURCC('s', 'a', 'm', 'r'):
        case FOURCC('s', 'a', 'w', 'b'):
        {
@@ -767,7 +771,15 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
            mLastTrack->meta->setInt32(kKeySampleRate, sample_rate);

            off_t stop_offset = *offset + chunk_size;
            if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_MPEG,
                        FourCC2MIME(chunk_type))) {
               // ESD is not required in mp3
               *offset = stop_offset;
            }
           else
           {
               *offset = data_offset + sizeof(buffer);
           }
            while (*offset < stop_offset) {
                status_t err = parseChunk(offset, depth + 1);
                if (err != OK) {