OSDN Git Service

Don't fill the out buffer when the audio decoder failed to decode and mAudioConfigCha...
authorMichael Chen <omxcodec@gmail.com>
Sun, 4 Nov 2012 03:04:01 +0000 (11:04 +0800)
committerMichael Chen <omxcodec@gmail.com>
Sun, 4 Nov 2012 03:04:01 +0000 (11:04 +0800)
libstagefright/codecs/ffmpegdec/adec/SoftFFmpegAudio.cpp

index 2bce75a..c2c16c7 100644 (file)
@@ -593,6 +593,17 @@ void SoftFFmpegAudio::onQueueFilled(OMX_U32 portIndex) {
             len = avcodec_decode_audio4(mCtx, mFrame, &gotFrm, &pkt);
            if (len < 0) {
                 LOGE("ffmpeg audio decoder failed to decode frame. (0x%x)", len);
+
+                /* if !mAudioConfigChanged, Don't fill the out buffer */
+                if (!mAudioConfigChanged) {
+                    inInfo->mOwnedByUs = false;
+                    inQueue.erase(inQueue.begin());
+                    inInfo = NULL;
+                    notifyEmptyBufferDone(inHeader);
+                    inHeader = NULL;
+                    continue;
+                }
+
                 inputBufferUsedLength = inHeader->nFilledLen;
                 /* if error, we skip the frame and play silence instead */
                 mPAudioBuffer = mSilenceBuffer;