Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6350e21e authored by Dave Burke's avatar Dave Burke Committed by Android (Google) Code Review
Browse files

Merge "Property to enable AAC 5.1 pass-through." into jb-dev

parents c9d0294e 1adacd92
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+16 −2
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ private:
    void initPorts();
    status_t initDecoder();
    bool isConfigured() const;
    void maybeConfigureDownmix() const;

    DISALLOW_EVIL_CONSTRUCTORS(SoftAAC2);
};