Fix divide by 0 when repacketizing a Flac stream of known rate
authorDavid Flynn <davidf@rd.bbc.co.uk>
Sat, 23 Aug 2008 16:17:24 +0000 (16:17 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 23 Aug 2008 16:47:19 +0000 (18:47 +0200)
Before setting end_date, remember to initialize the divider for future
calculations.

Signed-off-by: David Flynn <davidf@rd.bbc.co.uk>
Signed-off-by: Antoine Cellerier <dionoea@videolan.org>
modules/codec/flac.c

index 0fb3d01..65e798e 100644 (file)
@@ -408,6 +408,8 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
     else if( !aout_DateGet( &p_sys->end_date ) )
     {
         /* The first PTS is as good as anything else. */
+        p_sys->i_rate = p_dec->fmt_out.audio.i_rate;
+        aout_DateInit( &p_sys->end_date, p_sys->i_rate );
         aout_DateSet( &p_sys->end_date, (*pp_block)->i_pts );
     }