Loading media/libstagefright/codecs/aacdec/SoftAAC2.cpp +40 −17 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ OMX_ERRORTYPE SoftAAC2::internalGetParameter( aacParams->eChannelMode = OMX_AUDIO_ChannelModeStereo; if (!isConfigured() || !mStreamInfo->numChannels || !mStreamInfo->sampleRate) { if (!isConfigured()) { aacParams->nChannels = 1; aacParams->nSampleRate = 44100; aacParams->nFrameLength = 0; Loading Loading @@ -170,7 +170,7 @@ OMX_ERRORTYPE SoftAAC2::internalGetParameter( pcmParams->eChannelMapping[4] = OMX_AUDIO_ChannelLS; pcmParams->eChannelMapping[5] = OMX_AUDIO_ChannelRS; if (!isConfigured() || !mStreamInfo->numChannels || !mStreamInfo->sampleRate) { if (!isConfigured()) { pcmParams->nChannels = 1; pcmParams->nSamplingRate = 44100; } else { Loading Loading @@ -280,6 +280,9 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { info->mOwnedByUs = false; notifyEmptyBufferDone(header); ALOGI("Configuring decoder: %d Hz, %d channels", mStreamInfo->sampleRate, mStreamInfo->numChannels); notify(OMX_EventPortSettingsChanged, 1, 0, NULL); mOutputPortSettingsChange = AWAITING_DISABLED; return; Loading Loading @@ -377,7 +380,21 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { } // Check if stream info has changed /* * AAC+/eAAC+ streams can be signalled in two ways: either explicitly * or implicitly, according to MPEG4 spec. AAC+/eAAC+ is a dual * rate system and the sampling rate in the final output is actually * doubled compared with the core AAC decoder sampling rate. * * Explicit signalling is done by explicitly defining SBR audio object * type in the bitstream. Implicit signalling is done by embedding * SBR content in AAC extension payload specific to SBR, and hence * requires an AAC decoder to perform pre-checks on actual audio frames. * * Thus, we could not say for sure whether a stream is * AAC+/eAAC+ until the first data frame is decoded. */ if (mInputBufferCount <= 2) { if (mStreamInfo->sampleRate != prevSampleRate || mStreamInfo->numChannels != prevNumChannels) { ALOGI("Reconfiguring decoder: %d Hz, %d channels", Loading @@ -394,6 +411,12 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { mOutputPortSettingsChange = AWAITING_DISABLED; return; } } else if (!mStreamInfo->sampleRate || !mStreamInfo->numChannels) { ALOGW("Invalid AAC stream"); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, decoderErr, NULL); return; } size_t numOutBytes = mStreamInfo->frameSize * sizeof(int16_t) * mStreamInfo->numChannels; Loading Loading
media/libstagefright/codecs/aacdec/SoftAAC2.cpp +40 −17 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ OMX_ERRORTYPE SoftAAC2::internalGetParameter( aacParams->eChannelMode = OMX_AUDIO_ChannelModeStereo; if (!isConfigured() || !mStreamInfo->numChannels || !mStreamInfo->sampleRate) { if (!isConfigured()) { aacParams->nChannels = 1; aacParams->nSampleRate = 44100; aacParams->nFrameLength = 0; Loading Loading @@ -170,7 +170,7 @@ OMX_ERRORTYPE SoftAAC2::internalGetParameter( pcmParams->eChannelMapping[4] = OMX_AUDIO_ChannelLS; pcmParams->eChannelMapping[5] = OMX_AUDIO_ChannelRS; if (!isConfigured() || !mStreamInfo->numChannels || !mStreamInfo->sampleRate) { if (!isConfigured()) { pcmParams->nChannels = 1; pcmParams->nSamplingRate = 44100; } else { Loading Loading @@ -280,6 +280,9 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { info->mOwnedByUs = false; notifyEmptyBufferDone(header); ALOGI("Configuring decoder: %d Hz, %d channels", mStreamInfo->sampleRate, mStreamInfo->numChannels); notify(OMX_EventPortSettingsChanged, 1, 0, NULL); mOutputPortSettingsChange = AWAITING_DISABLED; return; Loading Loading @@ -377,7 +380,21 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { } // Check if stream info has changed /* * AAC+/eAAC+ streams can be signalled in two ways: either explicitly * or implicitly, according to MPEG4 spec. AAC+/eAAC+ is a dual * rate system and the sampling rate in the final output is actually * doubled compared with the core AAC decoder sampling rate. * * Explicit signalling is done by explicitly defining SBR audio object * type in the bitstream. Implicit signalling is done by embedding * SBR content in AAC extension payload specific to SBR, and hence * requires an AAC decoder to perform pre-checks on actual audio frames. * * Thus, we could not say for sure whether a stream is * AAC+/eAAC+ until the first data frame is decoded. */ if (mInputBufferCount <= 2) { if (mStreamInfo->sampleRate != prevSampleRate || mStreamInfo->numChannels != prevNumChannels) { ALOGI("Reconfiguring decoder: %d Hz, %d channels", Loading @@ -394,6 +411,12 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { mOutputPortSettingsChange = AWAITING_DISABLED; return; } } else if (!mStreamInfo->sampleRate || !mStreamInfo->numChannels) { ALOGW("Invalid AAC stream"); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, decoderErr, NULL); return; } size_t numOutBytes = mStreamInfo->frameSize * sizeof(int16_t) * mStreamInfo->numChannels; Loading