[FFmpeg-devel] [PATCH] lavc/qsvdec: release packet if mpeg2/vp8/vc1 decoding failure

Zhong Li zhong.li at intel.com
Wed Aug 15 12:48:26 EEST 2018


H264/265 have been fixed such an issue with commit
559370f2c45110afd8308eec7194437736c323d4.
Similar fixing is needed for other codecs.

Signed-off-by: Zhong Li <zhong.li at intel.com>
---
 libavcodec/qsvdec_other.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
index 3c872dc..472be71 100644
--- a/libavcodec/qsvdec_other.c
+++ b/libavcodec/qsvdec_other.c
@@ -138,8 +138,13 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data,
         }
 
         ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->input_ref);
-        if (ret < 0)
+        if (ret < 0) {
+            /* Drop input packet when failed to decode the packet. Otherwise,
+               the decoder will keep decoding the failure packet. */
+            av_packet_unref(&s->input_ref);
+
             return ret;
+        }
 
         s->input_ref.size -= ret;
         s->input_ref.data += ret;
-- 
2.7.4



More information about the ffmpeg-devel mailing list