avcodec: do not flush buffers if codec hasn't been opened
authorRafaël Carré <rafael.carre@gmail.com>
Mon, 26 Oct 2009 12:55:24 +0000 (13:55 +0100)
committerRafaël Carré <rafael.carre@gmail.com>
Mon, 26 Oct 2009 12:56:11 +0000 (13:56 +0100)
Reported-by: Konstantin Pavlov (thresh)
modules/codec/avcodec/video.c

index ea37291..e1e4686 100644 (file)
@@ -715,7 +715,9 @@ void EndVideoDec( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    avcodec_flush_buffers( p_sys->p_context );
+    /* do not flush buffers if codec hasn't been opened (theora/vorbis/VC1) */
+    if( p_sys->p_context->codec )
+        avcodec_flush_buffers( p_sys->p_context );
 
     if( p_sys->p_ff_pic ) av_free( p_sys->p_ff_pic );