[FFmpeg-devel] [PATCH] avcodec/nuv: call ff_reget_buffer() only when the picture data is going to change
James Almer
jamrial at gmail.com
Wed Sep 4 16:29:56 EEST 2019
On 8/27/2019 11:25 AM, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> This is an alternative approach to "avcodec/nuv: Avoid duplicating frames",
> similar to the one from "avcodec/qtrle: call ff_reget_buffer() only when the
> picture data is going to change", to workaround fuzzer reported timeouts but
> without changing the behavior of the decoder.
>
> libavcodec/nuv.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
> index 75b14bce5b..4b171fde36 100644
> --- a/libavcodec/nuv.c
> +++ b/libavcodec/nuv.c
> @@ -268,7 +268,15 @@ retry:
> init_frame = 1;
> }
>
> - if ((result = ff_reget_buffer(avctx, c->pic)) < 0)
> + if (comptype == NUV_COPY_LAST) {
> + if (!c->pic->data[0])
> + return AVERROR_INVALIDDATA;
> + // ff_reget_buffer() isn't needed when frames don't change, so just update
> + // frame props.
> + ret = ff_decode_frame_props(avctx, c->pic);
> + if (ret < 0)
> + return ret;
> + } else if ((result = ff_reget_buffer(avctx, c->pic)) < 0)
> return result;
> if (init_frame) {
> memset(c->pic->data[0], 0, avctx->height * c->pic->linesize[0]);
Pushed a simpler version now that ff_reget_buffer() has a flags field
for this purpose.
More information about the ffmpeg-devel
mailing list