OSDN Git Service

Only send port settings changed if the number of channels and sample rate are both...
authorJames Dong <jdong@google.com>
Wed, 30 May 2012 17:26:31 +0000 (10:26 -0700)
committerJames Dong <jdong@google.com>
Wed, 30 May 2012 20:02:05 +0000 (13:02 -0700)
Change-Id: I9f8813eedc95db202488d8860cf485bdb8e69e11
related-to-bug: 6553089

media/libstagefright/codecs/aacdec/SoftAAC2.cpp

index 8dbff9e..ff95f9f 100644 (file)
@@ -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;
     }