From 6be58df8d14922bc1f4252f9f69ca9c0d74c331a Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 24 Jan 2017 08:04:53 +0100 Subject: ad_lavc: respect AV_FRAME_FLAG_DISCARD Since we set "skip_manual", we can actually get frames with this set. Currently, only AV_PKT_FLAG_DISCARD will trigger this flag, and only mov.c sets the latter flags, so this is related to FFmpeg's half-broken mp4 edit list support. --- audio/decode/ad_lavc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'audio') diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 073d363122..759f4879f0 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -221,6 +221,11 @@ static bool receive_frame(struct dec_audio *da, struct mp_audio **out) MP_ERR(da, "Error decoding audio.\n"); } +#if LIBAVCODEC_VERSION_MICRO >= 100 + if (priv->avframe->flags & AV_FRAME_FLAG_DISCARD) + av_frame_unref(priv->avframe); +#endif + if (!priv->avframe->buf[0]) return true; -- cgit v1.2.3