From 0d713b7dc3ab9ecb72914cd209333ff8200e5558 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Wed, 30 Apr 2025 02:53:22 +0200 Subject: [PATCH 33/44] avcodec/mpegvideo: Move initializing error resilience ctx to decoders Possible now that ff_mpv_decode_reinit() calls ff_mpv_init_duplicate_contexts() on its own. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.c | 3 +-- libavcodec/mpegvideo_dec.c | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index b51d9ef00d..6d6f126fd3 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -37,7 +37,6 @@ #include "blockdsp.h" #include "idctdsp.h" #include "mathops.h" -#include "mpeg_er.h" #include "mpegutils.h" #include "mpegvideo.h" #include "mpegvideodata.h" @@ -375,7 +374,7 @@ static av_cold int mpv_init_context_frame(MpegEncContext *s) pools->alloc_mb_height = mb_height; pools->alloc_mb_stride = s->mb_stride; - return !CONFIG_MPEGVIDEODEC || s->encoding ? 0 : ff_mpeg_er_init(s); + return 0; } /** diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 0d545e5b86..f46f3a9945 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -39,6 +39,7 @@ #include "mpegvideo.h" #include "mpegvideodec.h" #include "mpeg4videodec.h" +#include "mpeg_er.h" #include "libavutil/refstruct.h" #include "thread.h" #include "threadprogress.h" @@ -147,6 +148,9 @@ av_cold int ff_mpv_decode_reinit(MpegEncContext *const s) if (ret < 0) return ret; ret = ff_mpv_common_init(s); + if (ret < 0) + goto fail; + ret = ff_mpeg_er_init(s); if (ret < 0) goto fail; ret = ff_mpv_init_duplicate_contexts(s); -- 2.45.2