]> git.sesse.net Git - ffmpeg/commitdiff
h264dec: reset nb_slice_ctx_queued for hwaccel decoding
authorAnton Khirnov <anton@khirnov.net>
Mon, 1 Aug 2016 05:42:30 +0000 (07:42 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 3 Aug 2016 08:56:52 +0000 (10:56 +0200)
Fixes hwaccel decoding of files with multiple slices.

Found-By: Mark Thompson <sw@jkqxz.net>
libavcodec/h264dec.c

index 0e318a50b1ac8ea010ab41f625a9d84ac910548b..2c5a7db33abf4306865afdc579c72aca3ef7b290 100644 (file)
@@ -564,9 +564,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
 
             max_slice_ctx = avctx->hwaccel ? 1 : h->nb_slice_ctx;
             if (h->nb_slice_ctx_queued == max_slice_ctx) {
-                if (avctx->hwaccel)
+                if (avctx->hwaccel) {
                     ret = avctx->hwaccel->decode_slice(avctx, nal->raw_data, nal->raw_size);
-                else
+                    h->nb_slice_ctx_queued = 0;
+                } else
                     ret = ff_h264_execute_decode_slices(h);
                 if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
                     goto end;