OSDN Git Service

flush decoder when onPortFlushCompleted
authorMichael Chen <omxcodec@gmail.com>
Sat, 20 Oct 2012 16:39:10 +0000 (00:39 +0800)
committerMichael Chen <omxcodec@gmail.com>
Sat, 20 Oct 2012 16:39:10 +0000 (00:39 +0800)
libstagefright/codecs/ffmpegdec/vdec/SoftFFmpegVideo.cpp

index 2cec262..636d8f4 100644 (file)
@@ -659,6 +659,11 @@ void SoftFFmpegVideo::onQueueFilled(OMX_U32 portIndex) {
 }
 
 void SoftFFmpegVideo::onPortFlushCompleted(OMX_U32 portIndex) {
+    if (portIndex == 0 && mCtx) {
+        // Make sure that the next buffer output does not still
+        // depend on fragments from the last one decoded.
+        avcodec_flush_buffers(mCtx);
+    }
 }
 
 void SoftFFmpegVideo::onPortEnableCompleted(OMX_U32 portIndex, bool enabled) {