From fb27ed4deb5a94964d59978de7770b4dcde49d1e Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sun, 24 Apr 2022 09:23:37 +0200 Subject: [PATCH] libav: remove deprecated option refcounted_frames According to https://github.com/FFmpeg/FFmpeg/blob/fe85afbf8cb2b9cf8cb28cb13bff654949b43823/doc/APIchanges#L743 this option is deprecated and obsolete for the newer send/receive logic. Should fix runtime exceptions with newer ffmpeg versions. --- rpcs3/Emu/Cell/Modules/cellAdec.cpp | 7 ++----- rpcs3/Emu/Cell/Modules/cellVdec.cpp | 10 ++-------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellAdec.cpp b/rpcs3/Emu/Cell/Modules/cellAdec.cpp index e1b7121033..9fc4f57196 100644 --- a/rpcs3/Emu/Cell/Modules/cellAdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAdec.cpp @@ -521,16 +521,13 @@ public: //ctx = fmt->streams[0]->codec; // TODO: check data opts = nullptr; - err = av_dict_set(&opts, "refcounted_frames", "1", 0); - if (err < 0) - { - fmt::throw_exception("av_dict_set(refcounted_frames, 1) failed (err=0x%x='%s')", err, utils::av_error_to_string(err)); - } + { std::lock_guard lock(g_mutex_avcodec_open2); // not multithread-safe (???) err = avcodec_open2(ctx, codec, &opts); } + if (err || opts) { std::string dict_content; diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index deecb06955..157fade4bd 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -242,17 +242,11 @@ struct vdec_context final fmt::throw_exception("avcodec_alloc_context3() failed (type=0x%x)", type); } - AVDictionary* opts{}; - int err = av_dict_set(&opts, "refcounted_frames", "1", 0); - if (err < 0) - { - avcodec_free_context(&ctx); - fmt::throw_exception("av_dict_set(refcounted_frames, 1) failed (err=0x%x='%s')", err, utils::av_error_to_string(err)); - } + AVDictionary* opts = nullptr; std::lock_guard lock(g_mutex_avcodec_open2); - err = avcodec_open2(ctx, codec, &opts); + int err = avcodec_open2(ctx, codec, &opts); if (err || opts) { avcodec_free_context(&ctx);