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;