Merge "Skip incorrect MPEG audio frame"

gugelfrei
TreeHugger Robot 5 years ago committed by Android (Google) Code Review
commit 9c971b7f39

@ -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);

Loading…
Cancel
Save