[vlc-commits] commit: Fixed non initialized date_t in some corner case with avcodec. ( Laurent Aimar )

git at videolan.org git at videolan.org
Wed Mar 31 00:48:06 CEST 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Mar 31 00:46:05 2010 +0200| [3f9174473e6e2106f20318e377dcc80437b927f9] | committer: Laurent Aimar 

Fixed non initialized date_t in some corner case with avcodec.

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

 modules/codec/avcodec/audio.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index b2cb902..0aaacee 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -217,15 +217,17 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
     p_sys->i_previous_channels = 0;
     p_sys->i_previous_layout = 0;
 
-    date_Set( &p_sys->end_date, 0 );
-    if( p_dec->fmt_in.audio.i_rate )
-        date_Init( &p_sys->end_date, p_dec->fmt_in.audio.i_rate, 1 );
-
     /* */
     p_dec->fmt_out.i_cat = AUDIO_ES;
     /* Try to set as much informations as possible but do not trust it */
     SetupOutputFormat( p_dec, false );
 
+    date_Set( &p_sys->end_date, 0 );
+    if( p_dec->fmt_out.audio.i_rate )
+        date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1 );
+    else if( p_dec->fmt_in.audio.i_rate )
+        date_Init( &p_sys->end_date, p_dec->fmt_in.audio.i_rate, 1 );
+
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list