Skip to content

Commit

Permalink
fix: fast delete mediacodec
Browse files Browse the repository at this point in the history
This fixes hwdec `mediacodec` when transitioning playlist items

mpv-android/mpv-android#966
  • Loading branch information
jarnedemeulemeester committed Aug 4, 2024
1 parent 8cea9b7 commit cfd7b86
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions buildscripts/patches/ffmpeg/mediacodec_fast_delete.patch
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit cfd7b86

Please sign in to comment.