diff options
Diffstat (limited to '')
-rw-r--r-- | media/ffvpx/libavcodec/vaapi_decode.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/media/ffvpx/libavcodec/vaapi_decode.c b/media/ffvpx/libavcodec/vaapi_decode.c index ceac769c52..5665639dd7 100644 --- a/media/ffvpx/libavcodec/vaapi_decode.c +++ b/media/ffvpx/libavcodec/vaapi_decode.c @@ -20,6 +20,7 @@ #include "libavutil/avassert.h" #include "libavutil/common.h" +#include "libavutil/mem.h" #include "libavutil/pixdesc.h" #include "avcodec.h" @@ -72,17 +73,14 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, av_assert0(pic->nb_slices <= pic->slices_allocated); if (pic->nb_slices == pic->slices_allocated) { - if (pic->slices_allocated > 0) - pic->slices_allocated *= 2; - else - pic->slices_allocated = 64; - pic->slice_buffers = av_realloc_array(pic->slice_buffers, - pic->slices_allocated, + pic->slices_allocated ? pic->slices_allocated * 2 : 64, 2 * sizeof(*pic->slice_buffers)); if (!pic->slice_buffers) return AVERROR(ENOMEM); + + pic->slices_allocated = pic->slices_allocated ? pic->slices_allocated * 2 : 64; } av_assert0(pic->nb_slices + 1 <= pic->slices_allocated); |