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

Commit 9c971b7f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Skip incorrect MPEG audio frame"

parents c952e4a9 56849dfd
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -1526,6 +1526,7 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitMPEGAudio() {
                header, &frameSize, &samplingRate, &numChannels,
                &bitrate, &numSamples)) {
        ALOGE("Failed to get audio frame size");
        mBuffer->setRange(0, 0);
        return NULL;
    }

@@ -1550,6 +1551,22 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitMPEGAudio() {
        return NULL;
    }

    if (mFormat != NULL) {
        const char *mime;
        if (mFormat->findCString(kKeyMIMEType, &mime)) {
            if ((layer == 1) && strcmp (mime, MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_I)) {
                ALOGE("Audio layer is not MPEG_LAYER_I");
                return NULL;
            } else if ((layer == 2) && strcmp (mime, MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II)) {
                ALOGE("Audio layer is not MPEG_LAYER_II");
                return NULL;
            } else if ((layer == 3) && strcmp (mime, MEDIA_MIMETYPE_AUDIO_MPEG)) {
                ALOGE("Audio layer is not AUDIO_MPEG");
                return NULL;
            }
        }
    }

    accessUnit->meta()->setInt64("timeUs", timeUs);
    accessUnit->meta()->setInt32("isSync", 1);