]> git.sesse.net Git - vlc/commitdiff
* modules/codec/spudec/spudec.c, modules/codec/spudec/parse.c: fixed a couple
authorGildas Bazin <gbazin@videolan.org>
Thu, 31 Oct 2002 09:40:26 +0000 (09:40 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 31 Oct 2002 09:40:26 +0000 (09:40 +0000)
   of problems introduced with the recent changes to the bitstream facility.
* src/audio_output/output.c: fixed a quite annoying bug in aout3 that was
   triggering unnecessary trashing of audio frames.

modules/codec/spudec/parse.c
modules/codec/spudec/spudec.c
src/audio_output/output.c

index 0b6c2320aba00834793764b13edcd078591cba02..742058da61ae482f5af8c83f03ae77b11eebb7be 100644 (file)
@@ -2,7 +2,7 @@
  * parse.c: SPU parser
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: parse.c,v 1.2 2002/10/17 08:24:12 sam Exp $
+ * $Id: parse.c,v 1.3 2002/10/31 09:40:26 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -103,12 +103,14 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec )
     subpicture_t * p_spu;
     u8           * p_src;
     unsigned int   i_offset;
+    mtime_t        i_pts;
 
     msg_Dbg( p_spudec->p_fifo, "trying to gather a 0x%.2x long subtitle",
                                p_spudec->i_spu_size );
 
     /* We cannot display a subpicture with no date */
-    if( p_spudec->p_fifo->p_first->i_pts == 0 )
+    NextPTS( &p_spudec->bit_stream, &i_pts, NULL );
+    if( i_pts == 0 )
     {
         msg_Warn( p_spudec->p_fifo, "subtitle without a date" );
         return;
@@ -139,7 +141,7 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec )
     p_spu->p_sys->pi_alpha[3] = 0x0f;
 
     /* Get display time now. If we do it later, we may miss the PTS. */
-    p_spu->p_sys->i_pts = p_spudec->p_fifo->p_first->i_pts;
+    p_spu->p_sys->i_pts = i_pts;
 
     /* Allocate the temporary buffer we will parse */
     p_src = malloc( p_spudec->i_rle_size );
index 264d22265649c40e0f44055fb002b4a0bde94aa7..12617c24a2ee451ee5cfc28ac9fd31f68e474d4f 100644 (file)
@@ -2,7 +2,7 @@
  * spudec.c : SPU decoder thread
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: spudec.c,v 1.5 2002/10/27 16:58:13 gbazin Exp $
+ * $Id: spudec.c,v 1.6 2002/10/31 09:40:26 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -151,6 +151,10 @@ static int InitThread( spudec_thread_t *p_spudec )
     {
         if( p_spudec->p_fifo->b_die || p_spudec->p_fifo->b_error )
         {
+            /* Call InitBitstream anyway so p_spudec is in a known state
+             * before calling CloseBitstream */
+            InitBitstream( &p_spudec->bit_stream, p_spudec->p_fifo,
+                           NULL, NULL );
             return -1;
         }
 
index 4bcba4c61b504a6420e53df27aad960b45ff7186..75dc8c505e82d28846b3852689aaf6ddfa338e74 100644 (file)
@@ -2,7 +2,7 @@
  * output.c : internal management of output streams for the audio output
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: output.c,v 1.19 2002/10/21 20:00:10 massiot Exp $
+ * $Id: output.c,v 1.20 2002/10/31 09:40:26 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -181,10 +181,10 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
     vlc_mutex_lock( &p_aout->output_fifo_lock );
 
     p_buffer = p_aout->output.fifo.p_first;
-    while ( p_buffer && p_buffer->start_date < start_date )
+    while ( p_buffer && p_buffer->start_date < mdate() )
     {
         msg_Dbg( p_aout, "audio output is too slow (%lld), trashing %lldus",
-                 start_date - p_buffer->start_date,
+                 mdate() - p_buffer->start_date,
                  p_buffer->end_date - p_buffer->start_date );
         p_buffer = p_buffer->p_next;
     }