]> git.sesse.net Git - vlc/commitdiff
Fixed a crash in S/PDIF mode.
authorChristophe Massiot <massiot@videolan.org>
Mon, 25 Nov 2002 16:00:26 +0000 (16:00 +0000)
committerChristophe Massiot <massiot@videolan.org>
Mon, 25 Nov 2002 16:00:26 +0000 (16:00 +0000)
src/audio_output/input.c

index 78809f4c553545d22608ca1b173cdbc2484efbed..f4416f3251b02e539fbb156264b9808bfcc44cee 100644 (file)
@@ -2,7 +2,7 @@
  * input.c : internal management of input streams for the audio output
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: input.c,v 1.22 2002/11/15 01:23:54 gbazin Exp $
+ * $Id: input.c,v 1.23 2002/11/25 16:00:26 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -176,8 +176,11 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
         if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
             msg_Warn( p_aout, "timing screwed, stopping resampling" );
         p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
-        p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
-        p_input->pp_resamplers[0]->b_reinit = VLC_TRUE;
+        if ( i_nb_resamplers != 0 )
+        {
+            p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
+            p_input->pp_resamplers[0]->b_reinit = VLC_TRUE;
+        }
         start_date = 0;
     }
 
@@ -202,7 +205,8 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
      * We first need to calculate the output rate of this resampler. */
     if ( ( p_input->i_resampling_type == AOUT_RESAMPLING_NONE ) &&
          ( start_date < p_buffer->start_date - AOUT_PTS_TOLERANCE
-           || start_date > p_buffer->start_date + AOUT_PTS_TOLERANCE ) )
+           || start_date > p_buffer->start_date + AOUT_PTS_TOLERANCE ) &&
+         i_nb_resamplers > 0 )
     {
         /* Can happen in several circumstances :
          * 1. A problem at the input (clock drift)
@@ -281,7 +285,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
         (p_buffer->end_date - p_buffer->start_date);
 
     /* Actually run the resampler now. */
-    if ( p_aout->mixer.mixer.i_rate !=
+    if ( i_nb_resamplers > 0 && p_aout->mixer.mixer.i_rate !=
          p_input->pp_resamplers[0]->input.i_rate )
     {
         aout_FiltersPlay( p_aout, p_input->pp_resamplers,