summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorDave Burke <daveburke@google.com>2012-05-23 00:00:53 -0700
committerDave Burke <daveburke@google.com>2012-05-25 09:38:29 -0700
commit1adacd921319ec52fac1a4596ab6eaf8689e6a7d (patch)
tree56d78d6e7a6e66d82095e3387dacc923eac85963 /media
parente737cda649acbfa43fc1b74612a83f2fac9aa449 (diff)
downloadframeworks_av-1adacd921319ec52fac1a4596ab6eaf8689e6a7d.zip
frameworks_av-1adacd921319ec52fac1a4596ab6eaf8689e6a7d.tar.gz
frameworks_av-1adacd921319ec52fac1a4596ab6eaf8689e6a7d.tar.bz2
Property to enable AAC 5.1 pass-through.
Bug: 6275957 Change-Id: I8debdce872fc8287a4f6340f1790e02c075886e3
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/codecs/aacdec/Android.mk2
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC2.cpp18
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC2.h1
3 files changed, 18 insertions, 3 deletions
diff --git a/media/libstagefright/codecs/aacdec/Android.mk b/media/libstagefright/codecs/aacdec/Android.mk
index b7c3788..1b2544a 100644
--- a/media/libstagefright/codecs/aacdec/Android.mk
+++ b/media/libstagefright/codecs/aacdec/Android.mk
@@ -24,7 +24,7 @@ ifeq ($(AAC_LIBRARY), fraunhofer)
libAACdec libMpegTPDec libSBRdec libPCMutils libFDK libSYS
LOCAL_SHARED_LIBRARIES := \
- libstagefright_omx libstagefright_foundation libutils
+ libstagefright_omx libstagefright_foundation libutils libcutils
LOCAL_MODULE := libstagefright_soft_aacdec
LOCAL_MODULE_TAGS := optional
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index 76c3854..791445c 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -19,6 +19,7 @@
#include "SoftAAC2.h"
+#include <cutils/properties.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/hexdump.h>
#include <media/stagefright/MediaErrors.h>
@@ -185,7 +186,6 @@ OMX_ERRORTYPE SoftAAC2::internalGetParameter(
default:
return SimpleSoftOMXComponent::internalGetParameter(index, params);
}
-
}
OMX_ERRORTYPE SoftAAC2::internalSetParameter(
@@ -247,6 +247,18 @@ bool SoftAAC2::isConfigured() const {
return mInputBufferCount > 0;
}
+void SoftAAC2::maybeConfigureDownmix() const {
+ if (mStreamInfo->numChannels > 2) {
+ char value[PROPERTY_VALUE_MAX];
+ if (!(property_get("media.aac_51_output_enabled", value, NULL) &&
+ (!strcmp(value, "1") || !strcasecmp(value, "true")))) {
+ ALOGI("Downmixing multichannel AAC to stereo");
+ aacDecoder_SetParam(mAACDecoder, AAC_PCM_OUTPUT_CHANNELS, 2);
+ mStreamInfo->numChannels = 2;
+ }
+ }
+}
+
void SoftAAC2::onQueueFilled(OMX_U32 portIndex) {
if (mSignalledError || mOutputPortSettingsChange != NONE) {
return;
@@ -281,7 +293,8 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) {
info->mOwnedByUs = false;
notifyEmptyBufferDone(header);
- ALOGI("Configuring decoder: %d Hz, %d channels",
+ maybeConfigureDownmix();
+ ALOGI("Initially configuring decoder: %d Hz, %d channels",
mStreamInfo->sampleRate,
mStreamInfo->numChannels);
notify(OMX_EventPortSettingsChanged, 1, 0, NULL);
@@ -422,6 +435,7 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) {
if (mInputBufferCount <= 2) {
if (mStreamInfo->sampleRate != prevSampleRate ||
mStreamInfo->numChannels != prevNumChannels) {
+ maybeConfigureDownmix();
ALOGI("Reconfiguring decoder: %d Hz, %d channels",
mStreamInfo->sampleRate,
mStreamInfo->numChannels);
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.h b/media/libstagefright/codecs/aacdec/SoftAAC2.h
index 29c9484..ac379f4 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.h
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.h
@@ -66,6 +66,7 @@ private:
void initPorts();
status_t initDecoder();
bool isConfigured() const;
+ void maybeConfigureDownmix() const;
DISALLOW_EVIL_CONSTRUCTORS(SoftAAC2);
};