[FFmpeg-cvslog] h264dec: reset nb_slice_ctx_queued for hwaccel decoding

Anton Khirnov git at videolan.org
Thu Mar 16 02:45:41 EET 2017


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Aug  1 07:42:30 2016 +0200| [d3e4d406b020b0464486318aceda08bd8f69ca41] | committer: Anton Khirnov

h264dec: reset nb_slice_ctx_queued for hwaccel decoding

Fixes hwaccel decoding of files with multiple slices.

Found-By: Mark Thompson <sw at jkqxz.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3e4d406b020b0464486318aceda08bd8f69ca41
---

 libavcodec/h264dec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 0e318a5..2c5a7db 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -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;



More information about the ffmpeg-cvslog mailing list