summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorDave Burke <daveburke@google.com>2012-05-25 10:02:32 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-25 10:02:32 -0700
commit6350e21e8947398a94402bc2969d13d407fbc3fb (patch)
tree2d3fa57414cf932b6ddbd7196ffc2472fa0e5729 /media
parentc9d0294e0526510267a0c4148a0dbc0449bed223 (diff)
parent1adacd921319ec52fac1a4596ab6eaf8689e6a7d (diff)
downloadframeworks_av-6350e21e8947398a94402bc2969d13d407fbc3fb.zip
frameworks_av-6350e21e8947398a94402bc2969d13d407fbc3fb.tar.gz
frameworks_av-6350e21e8947398a94402bc2969d13d407fbc3fb.tar.bz2
Merge "Property to enable AAC 5.1 pass-through." into jb-dev
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);
};