From cc9833b5db0e96f12daddb90a747fd146627377d Mon Sep 17 00:00:00 2001 From: James Dong Date: Wed, 30 May 2012 10:26:31 -0700 Subject: [PATCH] Only send port settings changed if the number of channels and sample rate are both known to be valid. Change-Id: I9f8813eedc95db202488d8860cf485bdb8e69e11 related-to-bug: 6553089 --- media/libstagefright/codecs/aacdec/SoftAAC2.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp index 8dbff9e844..ff95f9f2d5 100644 --- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp +++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp @@ -293,12 +293,18 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) { info->mOwnedByUs = false; notifyEmptyBufferDone(header); - maybeConfigureDownmix(); - ALOGI("Initially configuring decoder: %d Hz, %d channels", - mStreamInfo->sampleRate, - mStreamInfo->numChannels); - notify(OMX_EventPortSettingsChanged, 1, 0, NULL); - mOutputPortSettingsChange = AWAITING_DISABLED; + // Only send out port settings changed event if both sample rate + // and numChannels are valid. + if (mStreamInfo->sampleRate && mStreamInfo->numChannels) { + maybeConfigureDownmix(); + ALOGI("Initially configuring decoder: %d Hz, %d channels", + mStreamInfo->sampleRate, + mStreamInfo->numChannels); + + notify(OMX_EventPortSettingsChanged, 1, 0, NULL); + mOutputPortSettingsChange = AWAITING_DISABLED; + } + return; } -- 2.11.0