@@ -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);