]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/utils.c
lavc/decode_video(): always unref the frame if there is no output in decode_video
[ffmpeg] / libavcodec / utils.c
index e9d673401733924e44cff42bc2908fcc6aa313d5..899b6e15eeb255d1709c7b164eeae8a4f5c9154f 100644 (file)
@@ -1416,9 +1416,6 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
 
         emms_c(); //needed to avoid an emms_c() call before every return;
 
-        if (ret < 0 && picture->buf[0])
-            av_frame_unref(picture);
-
         if (*got_picture_ptr) {
             if (!avctx->refcounted_frames) {
                 avci->to_free = *picture;
@@ -1427,7 +1424,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
             }
 
             avctx->frame_number++;
-        }
+        } else
+            av_frame_unref(picture);
     } else
         ret = 0;