static void ff_mediacodec_dec_unref(MediaCodecDecContext *s) { if (!s) return; if (!avpriv_atomic_int_add_and_fetch(&s->refcount, -1)) { if (s->codec) { ff_AMediaCodec_delete(s->codec); s->codec = NULL; } if (s->format) { ff_AMediaFormat_delete(s->format); s->format = NULL; } if (s->surface) { ff_mediacodec_surface_unref(s->surface, NULL); s->surface = NULL; } av_freep(&s->codec_name); av_freep(&s); } }
static void ff_mediacodec_dec_unref(MediaCodecDecContext *s) { if (!s) return; if (atomic_fetch_sub(&s->refcount, 1) == 1) { if (s->codec) { ff_AMediaCodec_delete(s->codec); s->codec = NULL; } if (s->format) { ff_AMediaFormat_delete(s->format); s->format = NULL; } if (s->surface) { ff_mediacodec_surface_unref(s->surface, NULL); s->surface = NULL; } av_freep(&s->codec_name); av_freep(&s); } }
int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s) { if (s->codec) { ff_AMediaCodec_delete(s->codec); s->codec = NULL; } if (s->format) { ff_AMediaFormat_delete(s->format); s->format = NULL; } av_freep(&s->codec_name); return 0; }