]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/qsvdec_other.c
Merge commit '69caad8959982580504643d36aef22528e4aa6ce'
[ffmpeg] / libavcodec / qsvdec_other.c
index f6e08a2a8448eee6ebbde7014d4e9687866c016d..993c7a8e807f03b9a8cef68dc586d204c63a5ee7 100644 (file)
@@ -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;