]> git.sesse.net Git - vlc/commitdiff
Fixed a segfault with quitting when no audio output plug-in was found
authorChristophe Massiot <massiot@videolan.org>
Thu, 23 Jan 2003 17:13:28 +0000 (17:13 +0000)
committerChristophe Massiot <massiot@videolan.org>
Thu, 23 Jan 2003 17:13:28 +0000 (17:13 +0000)
(closes #108).

include/aout_internal.h
src/audio_output/common.c
src/audio_output/mixer.c
src/audio_output/output.c

index 7d6490c8e52c22b571fc3e675100690afc8ed9e3..2978bd1a916e9d2f892de7f23ed5d5eb68e52877 100644 (file)
@@ -2,7 +2,7 @@
  * aout_internal.h : internal defines for audio output
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: aout_internal.h,v 1.36 2002/12/07 23:50:30 massiot Exp $
+ * $Id: aout_internal.h,v 1.37 2003/01/23 17:13:28 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -128,7 +128,7 @@ typedef struct aout_mixer_t
     void                 (* pf_do_work)( struct aout_instance_t *,
                                          struct aout_buffer_t * );
 
-    /* If b_error == 1, there is no mixer nor audio output pipeline. */
+    /* If b_error == 1, there is no mixer. */
     vlc_bool_t              b_error;
     /* Multiplier used to raise or lower the volume of the sound in
      * software. Beware, this creates sound distortion and should be avoided
@@ -202,6 +202,9 @@ typedef struct aout_output_t
     audio_volume_t          i_volume;
     /* Saved volume for aout_VolumeMute(). */
     audio_volume_t          i_saved_volume;
+
+    /* If b_error == 1, there is no audio output pipeline. */
+    vlc_bool_t              b_error;
 } aout_output_t;
 
 /*****************************************************************************
@@ -264,7 +267,7 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
 
 /* From mixer.c : */
 int aout_MixerNew( aout_instance_t * p_aout );
-int aout_MixerDelete( aout_instance_t * p_aout );
+void aout_MixerDelete( aout_instance_t * p_aout );
 void aout_MixerRun( aout_instance_t * p_aout );
 int aout_MixerMultiplierSet( aout_instance_t * p_aout, float f_multiplier );
 int aout_MixerMultiplierGet( aout_instance_t * p_aout, float * pf_multiplier );
index c63e3055c4df0ec23a42ca926dc2150961882294..e02813bb8c643d82b7602c9036fc9c7368dbe5cb 100644 (file)
@@ -2,7 +2,7 @@
  * common.c : audio output management of common data structures
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: common.c,v 1.15 2003/01/22 18:31:47 massiot Exp $
+ * $Id: common.c,v 1.16 2003/01/23 17:13:28 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -59,6 +59,7 @@ aout_instance_t * __aout_New( vlc_object_t * p_parent )
     p_aout->i_nb_inputs = 0;
     p_aout->mixer.f_multiplier = 1.0;
     p_aout->mixer.b_error = 1;
+    p_aout->output.b_error = 1;
     p_aout->output.b_starving = 1;
 
     var_Create( p_aout, "intf-change", VLC_VAR_BOOL );
index f64a0668147e8478e088b6662a8472454a02f21a..5c66c45190628a8c96854c2bd53a9fb9193e13fa 100644 (file)
@@ -2,7 +2,7 @@
  * mixer.c : audio output mixing operations
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: mixer.c,v 1.23 2003/01/06 22:07:47 massiot Exp $
+ * $Id: mixer.c,v 1.24 2003/01/23 17:13:28 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -58,13 +58,11 @@ int aout_MixerNew( aout_instance_t * p_aout )
  *****************************************************************************
  * Please note that you must hold the mixer lock.
  *****************************************************************************/
-int aout_MixerDelete( aout_instance_t * p_aout )
+void aout_MixerDelete( aout_instance_t * p_aout )
 {
-    if ( p_aout->mixer.b_error ) return 0;
+    if ( p_aout->mixer.b_error ) return;
     module_Unneed( p_aout, p_aout->mixer.p_module );
     p_aout->mixer.b_error = 1;
-
-    return 0;
 }
 
 /*****************************************************************************
index f409f4000f3146aa02868b14e3d2c8361f75ecb0..b2141f91da77ac24e582ca243148c1f22b810da3 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.32 2003/01/23 11:48:18 massiot Exp $
+ * $Id: output.c,v 1.33 2003/01/23 17:13:28 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -200,6 +200,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
                              p_aout->output.i_nb_filters,
                              &p_aout->mixer.output_alloc );
 
+    p_aout->output.b_error = 0;
     return 0;
 }
 
@@ -210,11 +211,14 @@ int aout_OutputNew( aout_instance_t * p_aout,
  *****************************************************************************/
 void aout_OutputDelete( aout_instance_t * p_aout )
 {
+    if ( p_aout->output.b_error ) return 0;
     module_Unneed( p_aout, p_aout->output.p_module );
 
     aout_FiltersDestroyPipeline( p_aout, p_aout->output.pp_filters,
                                  p_aout->output.i_nb_filters );
     aout_FifoDestroy( p_aout, &p_aout->output.fifo );
+
+    p_aout->output.b_error = 1;
 }
 
 /*****************************************************************************