From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- media/ffvpx/libavcodec/vp8.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'media/ffvpx/libavcodec/vp8.c') diff --git a/media/ffvpx/libavcodec/vp8.c b/media/ffvpx/libavcodec/vp8.c index 83c60adeb0..539b5c5395 100644 --- a/media/ffvpx/libavcodec/vp8.c +++ b/media/ffvpx/libavcodec/vp8.c @@ -26,6 +26,7 @@ #include "config_components.h" +#include "libavutil/mem.h" #include "libavutil/mem_internal.h" #include "avcodec.h" @@ -2665,7 +2666,11 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, if (ret < 0) goto err; - if (s->actually_webp) { + if (!is_vp7 && s->actually_webp) { + // VP8 in WebP is supposed to be intra-only. Enforce this here + // to ensure that output is reproducible with frame-threading. + if (!s->keyframe) + return AVERROR_INVALIDDATA; // avctx->pix_fmt already set in caller. } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) { s->pix_fmt = get_pixel_format(s); @@ -2750,7 +2755,7 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, s->next_framep[VP8_FRAME_CURRENT] = curframe; - if (ffcodec(avctx->codec)->update_thread_context) + if (!is_vp7 && !s->actually_webp) ff_thread_finish_setup(avctx); if (avctx->hwaccel) { @@ -2883,7 +2888,6 @@ int vp78_decode_init(AVCodecContext *avctx, int is_vp7) int ret; s->avctx = avctx; - s->vp7 = avctx->codec->id == AV_CODEC_ID_VP7; s->pix_fmt = AV_PIX_FMT_NONE; avctx->pix_fmt = AV_PIX_FMT_YUV420P; -- cgit v1.2.3