[vlc-commits] avcodec: fix flush when the codec is not opened

Thomas Guillem git at videolan.org
Thu Mar 30 15:10:17 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 30 14:05:09 2017 +0200| [a21ff60765ebfe40ff875eb5da19415a440ad889] | committer: Thomas Guillem

avcodec: fix flush when the codec is not opened

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a21ff60765ebfe40ff875eb5da19415a440ad889
---

 modules/codec/avcodec/audio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 92fbc8e..dc79c38 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -283,7 +283,8 @@ static void Flush( decoder_t *p_dec )
     decoder_sys_t *p_sys = p_dec->p_sys;
     AVCodecContext *ctx = p_sys->p_context;
 
-    avcodec_flush_buffers( ctx );
+    if( avcodec_is_open( ctx ) )
+        avcodec_flush_buffers( ctx );
     date_Set( &p_sys->end_date, VLC_TS_INVALID );
 
     if( ctx->codec_id == AV_CODEC_ID_MP2 ||



More information about the vlc-commits mailing list