summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/FFMPEGSoftCodec.cpp
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-20 23:19:52 -0500
committerSteve Kondik <steve@cyngn.com>2015-12-20 23:19:52 -0500
commitd3c005d58c4064b647f1cb8998e5b557e79aa521 (patch)
tree61fdefa8899da095ec500304beb126b34390f745 /media/libstagefright/FFMPEGSoftCodec.cpp
parente9990d5c032e2a29de51e1a361df409f269194c2 (diff)
downloadframeworks_av-d3c005d58c4064b647f1cb8998e5b557e79aa521.zip
frameworks_av-d3c005d58c4064b647f1cb8998e5b557e79aa521.tar.gz
frameworks_av-d3c005d58c4064b647f1cb8998e5b557e79aa521.tar.bz2
stagefright: Fix AAC profile selection
* Be consistent about AAC profile selection in both Stagefright an our custom plugin. * Also fix duplication in the override code. Change-Id: I9d2724ea8861bc9d7db6a100a2f633f81d243c6c
Diffstat (limited to 'media/libstagefright/FFMPEGSoftCodec.cpp')
-rw-r--r--media/libstagefright/FFMPEGSoftCodec.cpp49
1 files changed, 22 insertions, 27 deletions
diff --git a/media/libstagefright/FFMPEGSoftCodec.cpp b/media/libstagefright/FFMPEGSoftCodec.cpp
index 5ee168e..20c8359 100644
--- a/media/libstagefright/FFMPEGSoftCodec.cpp
+++ b/media/libstagefright/FFMPEGSoftCodec.cpp
@@ -223,37 +223,32 @@ const char* FFMPEGSoftCodec::overrideComponentName(
}
}
- return componentName;
-}
-
-void FFMPEGSoftCodec::overrideComponentName(
- uint32_t /*quirks*/, const sp<AMessage> &msg, AString* componentName, AString* mime, int32_t isEncoder) {
-
- int32_t wmvVersion = 0;
- if (!strncasecmp(mime->c_str(), MEDIA_MIMETYPE_VIDEO_WMV, strlen(MEDIA_MIMETYPE_VIDEO_WMV)) &&
- msg->findInt32(getMsgKey(kKeyWMVVersion), &wmvVersion)) {
- ALOGD("Found WMV version key %d", wmvVersion);
- if (wmvVersion != 2) {
- ALOGD("Use FFMPEG for unsupported WMV track");
- componentName->setTo("OMX.ffmpeg.wmv.decoder");
+ // Use FFMPEG for high-res formats which other decoders can't handle
+ int32_t bits = 16;
+ if (!isEncoder && meta->findInt32(kKeyBitsPerSample, &bits)) {
+ if (bits > 16) {
+ if (!strncasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC, strlen(MEDIA_MIMETYPE_AUDIO_AAC))) {
+ componentName = "OMX.ffmpeg.aac.decoder";
+ ALOGD("Use FFMPEG for high-res AAC format");
+ } else if (!strncasecmp(mime, MEDIA_MIMETYPE_AUDIO_FLAC, strlen(MEDIA_MIMETYPE_AUDIO_FLAC))) {
+ componentName = "OMX.ffmpeg.flac.decoder";
+ ALOGD("Use FFMPEG for high-res FLAC format");
+ }
}
}
- int32_t encodeOptions = 0;
- if (!isEncoder && !strncasecmp(mime->c_str(), MEDIA_MIMETYPE_AUDIO_WMA, strlen(MEDIA_MIMETYPE_AUDIO_WMA)) &&
- !msg->findInt32(getMsgKey(kKeyWMAEncodeOpt), &encodeOptions)) {
- ALOGD("Use FFMPEG for unsupported WMA track");
- componentName->setTo("OMX.ffmpeg.wma.decoder");
- }
+ return componentName;
+}
- // Google's decoder doesn't support MAIN profile
- 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) || (aacProfile == OMX_AUDIO_AACObjectLTP)) {
- ALOGD("Use FFMPEG for AAC Main/LTP profile");
- componentName->setTo("OMX.ffmpeg.aac.decoder");
- }
+void FFMPEGSoftCodec::overrideComponentName(
+ uint32_t quirks, const sp<AMessage> &msg, AString* componentName, AString* mime, int32_t isEncoder) {
+
+ sp<MetaData> meta = new MetaData;
+ convertMessageToMetaData(msg, meta);
+ const char *updated = overrideComponentName(
+ quirks, meta, mime->c_str(), isEncoder);
+ if (updated != NULL) {
+ componentName->setTo(updated);
}
}