From cfd7b8681981ce74c4a884537b24e682861db985 Mon Sep 17 00:00:00 2001 From: Jarne Demeulemeester Date: Sun, 4 Aug 2024 11:48:41 +0200 Subject: [PATCH] fix: fast delete mediacodec This fixes hwdec `mediacodec` when transitioning playlist items mpv-android/mpv-android#966 --- .../patches/ffmpeg/mediacodec_fast_delete.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 buildscripts/patches/ffmpeg/mediacodec_fast_delete.patch diff --git a/buildscripts/patches/ffmpeg/mediacodec_fast_delete.patch b/buildscripts/patches/ffmpeg/mediacodec_fast_delete.patch new file mode 100644 index 0000000..525a88f --- /dev/null +++ b/buildscripts/patches/ffmpeg/mediacodec_fast_delete.patch @@ -0,0 +1,17 @@ +diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c +index d6f91e6..692e6d1 100644 +--- a/libavcodec/mediacodecdec_common.c ++++ b/libavcodec/mediacodecdec_common.c +@@ -841,6 +841,12 @@ int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s) + + int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s) + { ++ atomic_fetch_add(&s->serial, 1); ++ if (s->codec) { ++ ff_AMediaCodec_delete(s->codec); ++ s->codec = NULL; ++ } ++ + ff_mediacodec_dec_unref(s); + + return 0;