summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2014-10-01 21:37:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-01 21:37:11 +0000
commitd0b9efe7d8300e48f7a99c1dd746d60060206b3c (patch)
treeff063a11d672bb71bbced27740eeac82216ed054
parent3af67d03bbc30c368821caf8b74ae7fb91ee7db7 (diff)
parent2965f4eb7dceaf1173f0e2d93c11c28293aeead7 (diff)
downloadframeworks_av-d0b9efe7d8300e48f7a99c1dd746d60060206b3c.zip
frameworks_av-d0b9efe7d8300e48f7a99c1dd746d60060206b3c.tar.gz
frameworks_av-d0b9efe7d8300e48f7a99c1dd746d60060206b3c.tar.bz2
Merge "add AAC audio decoder params for PCM limiter enable" into lmp-dev
-rw-r--r--include/media/stagefright/ACodec.h3
-rw-r--r--media/libstagefright/ACodec.cpp12
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC2.cpp4
3 files changed, 16 insertions, 3 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index da4c20c..df0dc58 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -267,7 +267,8 @@ private:
bool encoder,
int32_t numChannels, int32_t sampleRate, int32_t bitRate,
int32_t aacProfile, bool isADTS, int32_t sbrMode,
- int32_t maxOutputChannelCount, const drcParams_t& drc);
+ int32_t maxOutputChannelCount, const drcParams_t& drc,
+ int32_t pcmLimiterEnable);
status_t setupAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate);
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 4589ed1..d6fba98 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1359,6 +1359,7 @@ status_t ACodec::configureCodec(
int32_t isADTS, aacProfile;
int32_t sbrMode;
int32_t maxOutputChannelCount;
+ int32_t pcmLimiterEnable;
drcParams_t drc;
if (!msg->findInt32("is-adts", &isADTS)) {
isADTS = 0;
@@ -1373,6 +1374,10 @@ status_t ACodec::configureCodec(
if (!msg->findInt32("aac-max-output-channel_count", &maxOutputChannelCount)) {
maxOutputChannelCount = -1;
}
+ if (!msg->findInt32("aac-pcm-limiter-enable", &pcmLimiterEnable)) {
+ // value is unknown
+ pcmLimiterEnable = -1;
+ }
if (!msg->findInt32("aac-encoded-target-level", &drc.encodedTargetLevel)) {
// value is unknown
drc.encodedTargetLevel = -1;
@@ -1396,7 +1401,8 @@ status_t ACodec::configureCodec(
err = setupAACCodec(
encoder, numChannels, sampleRate, bitRate, aacProfile,
- isADTS != 0, sbrMode, maxOutputChannelCount, drc);
+ isADTS != 0, sbrMode, maxOutputChannelCount, drc,
+ pcmLimiterEnable);
}
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB)) {
err = setupAMRCodec(encoder, false /* isWAMR */, bitRate);
@@ -1561,7 +1567,8 @@ status_t ACodec::selectAudioPortFormat(
status_t ACodec::setupAACCodec(
bool encoder, int32_t numChannels, int32_t sampleRate,
int32_t bitRate, int32_t aacProfile, bool isADTS, int32_t sbrMode,
- int32_t maxOutputChannelCount, const drcParams_t& drc) {
+ int32_t maxOutputChannelCount, const drcParams_t& drc,
+ int32_t pcmLimiterEnable) {
if (encoder && isADTS) {
return -EINVAL;
}
@@ -1691,6 +1698,7 @@ status_t ACodec::setupAACCodec(
presentation.nHeavyCompression = drc.heavyCompression;
presentation.nTargetReferenceLevel = drc.targetRefLevel;
presentation.nEncodedTargetLevel = drc.encodedTargetLevel;
+ presentation.nPCMLimiterEnable = pcmLimiterEnable;
status_t res = mOMX->setParameter(mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
if (res == OK) {
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index e701e9e..1b6eac4 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -368,6 +368,10 @@ OMX_ERRORTYPE SoftAAC2::internalSetParameter(
aacPresParams->nEncodedTargetLevel);
updateDrcWrapper = true;
}
+ if (aacPresParams->nPCMLimiterEnable >= 0) {
+ aacDecoder_SetParam(mAACDecoder, AAC_PCM_LIMITER_ENABLE,
+ (aacPresParams->nPCMLimiterEnable != 0));
+ }
if (updateDrcWrapper) {
mDrcWrap.update();
}