summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuiling, Song <ruiling.song@intel.com>2018-01-24 10:14:51 +0800
committerLuca Barbato <lu_zero@gentoo.org>2018-01-25 11:13:34 +0100
commit559370f2c45110afd8308eec7194437736c323d4 (patch)
tree7f66a73ac32cfec18ab8bf553dee53705f4b5d0b
parenta2a9e4eea0e4fde2ed8d3405b4f33f655b600c2d (diff)
qsv: Skip the packet if decoding failure
MediaSDK may fail to decode some frame, just skip it. Otherwise, it will keep decoding the failure packet repeatedly without processing any packet afterwards. Signed-off-by: Ruiling Song <ruiling.song@intel.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavcodec/qsvdec_h2645.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c
index 83880dc085..78a7b613f9 100644
--- a/libavcodec/qsvdec_h2645.c
+++ b/libavcodec/qsvdec_h2645.c
@@ -153,8 +153,12 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data,
}
ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->buffer_pkt);
- if (ret < 0)
+ if (ret < 0){
+ /* Drop buffer_pkt when failed to decode the packet. Otherwise,
+ the decoder will keep decoding the failure packet. */
+ av_packet_unref(&s->buffer_pkt);
return ret;
+ }
s->buffer_pkt.size -= ret;
s->buffer_pkt.data += ret;