summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
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/libstagefright/codecs/aacdec/SoftAAC2.cpp
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/libstagefright/codecs/aacdec/SoftAAC2.cpp')
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC2.cpp18
1 files changed, 16 insertions, 2 deletions
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);