summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-12-06 19:54:03 +0200
committerUoti Urpala <uau@mplayer2.org>2011-12-06 19:54:03 +0200
commit92e5414897707d998b4ba46664709347760f5b11 (patch)
treed135d02cac5aa5e92d3b107828942eb5da9c6798
parentff6c06ea7ae482aad4255aa6d94eb89840343096 (diff)
downloadmpv-92e5414897707d998b4ba46664709347760f5b11.tar.bz2
mpv-92e5414897707d998b4ba46664709347760f5b11.tar.xz
ad_ffmpeg: avoid avcodec_close() if avcodec_open() failed
Avoid calling avcodec_close() in uninit() if avcodec_open() failed. Calling avcodec_close() on a non-open codec context causes a crash with recent Libav versions.
-rw-r--r--libmpcodecs/ad_ffmpeg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index ae7f36b791..762c80282d 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -214,7 +214,7 @@ static void uninit(sh_audio_t *sh)
AVCodecContext *lavc_context = ctx->avctx;
if (lavc_context) {
- if (avcodec_close(lavc_context) < 0)
+ if (lavc_context->codec && avcodec_close(lavc_context) < 0)
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not close codec.\n");
av_freep(&lavc_context->extradata);
av_freep(&lavc_context);