From 53ac41b011537674ae823bc38df2fea7b369c894 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Wed, 16 Dec 2015 12:02:04 -0800 Subject: stagefright: Fix some aac file cannot be played back The AACExtractor does not pass the aacprofile via kKeyAACAOT and google aac decoder does not support LTP profile. Solve by setting the kKeyAACAOT profile and use ffmpeg when it is aac LTP profile. Change-Id: I79762bd23e3bcc34f2ea56e35686162f1630c06b --- media/libstagefright/AACExtractor.cpp | 1 + media/libstagefright/FFMPEGSoftCodec.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/media/libstagefright/AACExtractor.cpp b/media/libstagefright/AACExtractor.cpp index 1353e3f..2115eb4 100644 --- a/media/libstagefright/AACExtractor.cpp +++ b/media/libstagefright/AACExtractor.cpp @@ -167,6 +167,7 @@ AACExtractor::AACExtractor( channel = (header[0] & 0x1) << 2 | (header[1] >> 6); mMeta = MakeAACCodecSpecificData(profile, sf_index, channel); + mMeta->setInt32(kKeyAACAOT, profile + 1); off64_t streamSize, numFrames = 0; size_t frameSize = 0; diff --git a/media/libstagefright/FFMPEGSoftCodec.cpp b/media/libstagefright/FFMPEGSoftCodec.cpp index ddb688a..5ee168e 100644 --- a/media/libstagefright/FFMPEGSoftCodec.cpp +++ b/media/libstagefright/FFMPEGSoftCodec.cpp @@ -217,8 +217,8 @@ const char* FFMPEGSoftCodec::overrideComponentName( int32_t aacProfile = 0; if (!isEncoder && !strncasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC, strlen(MEDIA_MIMETYPE_AUDIO_AAC)) && meta->findInt32(kKeyAACAOT, &aacProfile)) { - if (aacProfile == OMX_AUDIO_AACObjectMain) { - ALOGD("Use FFMPEG for AAC MAIN profile"); + if ((aacProfile == OMX_AUDIO_AACObjectMain) || (aacProfile == OMX_AUDIO_AACObjectLTP)) { + ALOGD("Use FFMPEG for AAC Main/LTP profile"); componentName = "OMX.ffmpeg.aac.decoder"; } } @@ -250,8 +250,8 @@ void FFMPEGSoftCodec::overrideComponentName( int32_t aacProfile = 0; if (!isEncoder && !strncasecmp(mime->c_str(), MEDIA_MIMETYPE_AUDIO_AAC, strlen(MEDIA_MIMETYPE_AUDIO_AAC)) && msg->findInt32(getMsgKey(kKeyAACAOT), &aacProfile)) { - if (aacProfile == OMX_AUDIO_AACObjectMain) { - ALOGD("Use FFMPEG for AAC MAIN profile"); + if ((aacProfile == OMX_AUDIO_AACObjectMain) || (aacProfile == OMX_AUDIO_AACObjectLTP)) { + ALOGD("Use FFMPEG for AAC Main/LTP profile"); componentName->setTo("OMX.ffmpeg.aac.decoder"); } } -- cgit v1.1