OSDN Git Service

ffmpeg: video: Check if the codec is still open before flushing
authorDiogo Ferreira <diogo@underdev.org>
Fri, 27 Nov 2015 10:37:47 +0000 (10:37 +0000)
committerGerrit Code Review <gerrit@cyanogenmod.org>
Fri, 27 Nov 2015 12:48:15 +0000 (04:48 -0800)
This might be called whilst the codec has already finished decoding
and is not available for flushing.

Fixes the adaptative HEVC CTS tests.

Change-Id: I80ad95b23a4ba230256ffb7c6df6af4d99ef65a6

omx/SoftFFmpegVideo.cpp

index 60b2cd8..e78749f 100644 (file)
@@ -713,7 +713,7 @@ void SoftFFmpegVideo::onQueueFilled(OMX_U32 portIndex __unused) {
 void SoftFFmpegVideo::onPortFlushCompleted(OMX_U32 portIndex) {
     ALOGV("ffmpeg video decoder flush port(%u)", portIndex);
     if (portIndex == kInputPortIndex) {
-        if (mCtx) {
+        if (mCtx && avcodec_is_open(mCtx)) {
             //Make sure that the next buffer output does not still
             //depend on fragments from the last one decoded.
             avcodec_flush_buffers(mCtx);