diff options
author | Dave Burke <daveburke@google.com> | 2012-04-12 17:09:00 -0700 |
---|---|---|
committer | Dave Burke <daveburke@google.com> | 2012-04-17 18:48:42 -0700 |
commit | 095c2da8d6c2058b02142c940f6e6346d6581780 (patch) | |
tree | b71ae20e524e816542771d1cb761049eafe7b9fa /media/libstagefright/codecs/aacdec | |
parent | 99a80e10f2d0e88c0509a298bdd1df0308b55a7b (diff) | |
download | frameworks_av-095c2da8d6c2058b02142c940f6e6346d6581780.zip frameworks_av-095c2da8d6c2058b02142c940f6e6346d6581780.tar.gz frameworks_av-095c2da8d6c2058b02142c940f6e6346d6581780.tar.bz2 |
Make AAC 5.1 work
Fix bug with pausing audio
Change-Id: Icd6b095dac8d1a68b027de853d11ae02cc070b10
Diffstat (limited to 'media/libstagefright/codecs/aacdec')
-rw-r--r-- | media/libstagefright/codecs/aacdec/Android.mk | 7 | ||||
-rw-r--r-- | media/libstagefright/codecs/aacdec/SoftAAC2.cpp | 42 | ||||
-rw-r--r-- | media/libstagefright/codecs/aacdec/SoftAAC2.h | 1 |
3 files changed, 18 insertions, 32 deletions
diff --git a/media/libstagefright/codecs/aacdec/Android.mk b/media/libstagefright/codecs/aacdec/Android.mk index 5b3d216..b7c3788 100644 --- a/media/libstagefright/codecs/aacdec/Android.mk +++ b/media/libstagefright/codecs/aacdec/Android.mk @@ -1,6 +1,6 @@ LOCAL_PATH:= $(call my-dir) -AAC_LIBRARY = pv +AAC_LIBRARY = fraunhofer ifeq ($(AAC_LIBRARY), fraunhofer) include $(CLEAR_VARS) @@ -12,7 +12,8 @@ ifeq ($(AAC_LIBRARY), fraunhofer) frameworks/av/media/libstagefright/include \ frameworks/native/include/media/openmax \ external/aac/libAACdec/include \ - external/aac/libCDK/include \ + external/aac/libPCMutils/include \ + external/aac/libFDK/include \ external/aac/libMpegTPDec/include \ external/aac/libSBRdec/include \ external/aac/libSYS/include @@ -20,7 +21,7 @@ ifeq ($(AAC_LIBRARY), fraunhofer) LOCAL_CFLAGS := LOCAL_STATIC_LIBRARIES := \ - libAACdec libMpegTPDec libSBRdec libCDK libSYS + libAACdec libMpegTPDec libSBRdec libPCMutils libFDK libSYS LOCAL_SHARED_LIBRARIES := \ libstagefright_omx libstagefright_foundation libutils diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp index 4589d37..27cf5b9 100644 --- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp +++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp @@ -26,23 +26,6 @@ namespace android { -static Mutex gAACLibraryLock; -static int gAACLibraryCount = 0; - -void initializeAACLibrary() { - Mutex::Autolock autoLock(gAACLibraryLock); - if (gAACLibraryCount++ == 0) { - CDKprolog(); - } -} - -void cleanupAACLibrary() { - Mutex::Autolock autoLock(gAACLibraryLock); - if (--gAACLibraryCount == 0) { - CDKepilog(); - } -} - template<class T> static void InitOMXParams(T *params) { params->nSize = sizeof(T); @@ -63,17 +46,16 @@ SoftAAC2::SoftAAC2( mIsADTS(false), mInputBufferCount(0), mSignalledError(false), + mInputDiscontinuity(false), mAnchorTimeUs(0), mNumSamplesOutput(0), mOutputPortSettingsChange(NONE) { - initializeAACLibrary(); initPorts(); CHECK_EQ(initDecoder(), (status_t)OK); } SoftAAC2::~SoftAAC2() { aacDecoder_Close(mAACDecoder); - cleanupAACLibrary(); } void SoftAAC2::initPorts() { @@ -102,7 +84,7 @@ void SoftAAC2::initPorts() { def.eDir = OMX_DirOutput; def.nBufferCountMin = kNumBuffers; def.nBufferCountActual = def.nBufferCountMin; - def.nBufferSize = 8192; + def.nBufferSize = 8192 * 2; def.bEnabled = OMX_TRUE; def.bPopulated = OMX_FALSE; def.eDomain = OMX_PortDomainAudio; @@ -183,6 +165,10 @@ OMX_ERRORTYPE SoftAAC2::internalGetParameter( pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear; pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF; pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF; + pcmParams->eChannelMapping[2] = OMX_AUDIO_ChannelCF; + pcmParams->eChannelMapping[3] = OMX_AUDIO_ChannelLFE; + pcmParams->eChannelMapping[4] = OMX_AUDIO_ChannelLS; + pcmParams->eChannelMapping[5] = OMX_AUDIO_ChannelRS; if (!isConfigured()) { pcmParams->nChannels = 1; @@ -360,15 +346,17 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { INT_PCM *outBuffer = reinterpret_cast<INT_PCM *>(outHeader->pBuffer + outHeader->nOffset); bytesValid[0] = inBufferLength[0]; + int flags = mInputDiscontinuity ? AACDEC_INTR : 0; int prevSampleRate = mStreamInfo->sampleRate; decoderErr = aacDecoder_Fill(mAACDecoder, - inBuffer, - inBufferLength, - bytesValid); + inBuffer, + inBufferLength, + bytesValid); decoderErr = aacDecoder_DecodeFrame(mAACDecoder, outBuffer, outHeader->nAllocLen, - /* flags */ 0); + flags); + mInputDiscontinuity = false; /* * AAC+/eAAC+ streams can be signalled in two ways: either explicitly @@ -447,13 +435,9 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { void SoftAAC2::onPortFlushCompleted(OMX_U32 portIndex) { if (portIndex == 0) { - // Make sure that the next buffer output does not still // depend on fragments from the last one decoded. - aacDecoder_DecodeFrame(mAACDecoder, - NULL, - 0, - AACDEC_FLUSH); + mInputDiscontinuity = true; } } diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.h b/media/libstagefright/codecs/aacdec/SoftAAC2.h index 828b34e..d93685c 100644 --- a/media/libstagefright/codecs/aacdec/SoftAAC2.h +++ b/media/libstagefright/codecs/aacdec/SoftAAC2.h @@ -52,6 +52,7 @@ private: bool mIsADTS; size_t mInputBufferCount; bool mSignalledError; + bool mInputDiscontinuity; int64_t mAnchorTimeUs; int64_t mNumSamplesOutput; |