[FFmpeg-devel] [PATCH 5/6] lavc/qsvdec: Reset decoder if MFX_ERR_UNDEFINED_BEHAVIOR is caught, because this error may get decoder stuck.
Nablet Developer
sdk at nablet.com
Thu Aug 25 10:07:18 EEST 2016
From: ChaoX A Liu <chaox.a.liu at intel.com>
Signed-off-by: ChaoX A Liu <chaox.a.liu at intel.com>
---
libavcodec/qsvdec.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 47dd818..2075a23 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -370,13 +370,18 @@ static int do_qsv_decode(AVCodecContext *avctx, QSVContext *q,
av_usleep(500);
} while (1);
- if (MFX_WRN_VIDEO_PARAM_CHANGED==ret) {
+ if (MFX_WRN_VIDEO_PARAM_CHANGED == ret) {
/* TODO: handle here minor sequence header changing */
- } else if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM==ret) {
+ } else if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM == ret) {
av_fifo_reset(q->input_fifo);
flush = q->reinit_pending = 1;
continue;
- }
+ } else if (MFX_ERR_UNDEFINED_BEHAVIOR == ret)
+ /*
+ * Decoder may get stuck with this errorcode.
+ * Reset decoder to avoid that.
+ */
+ ff_qsv_decode_reset(avctx, q);
if (sync) {
QSVFrame *out_frame = find_frame(q, outsurf);
--
2.5.0
More information about the ffmpeg-devel
mailing list