[vlc-commits] aout: fix crash if output restart fails

Rémi Denis-Courmont git at videolan.org
Mon Aug 15 23:06:01 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 16 00:05:38 2011 +0300| [df0315ffc4bfa9a42af7bef0abf743d00cf5ec71] | committer: Rémi Denis-Courmont

aout: fix crash if output restart fails

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

 src/audio_output/common.c |    1 +
 src/audio_output/output.c |   30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index a7a4f19..2fda66e 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -65,6 +65,7 @@ audio_output_t *aout_New( vlc_object_t * p_parent )
     owner->volume.multiplier = 1.0;
     owner->volume.mixer = NULL;
 
+    aout->pf_play = aout_DecDeleteBuffer;
     aout_VolumeNoneInit (aout);
     vlc_object_set_destructor (aout, aout_Destructor);
 
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 4a268ae..6db331b 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -195,31 +195,31 @@ int aout_OutputNew( audio_output_t *p_aout,
     return 0;
 }
 
-/*****************************************************************************
- * aout_OutputDelete : delete the output
- *****************************************************************************
- * This function is entered with the mixer lock.
- *****************************************************************************/
-void aout_OutputDelete( audio_output_t * p_aout )
+/**
+ * Destroys the audio output plug-in instance.
+ */
+void aout_OutputDelete (audio_output_t *aout)
 {
-    aout_owner_t *owner = aout_owner (p_aout);
+    aout_owner_t *owner = aout_owner (aout);
 
-    aout_assert_locked( p_aout );
+    aout_assert_locked (aout);
 
     if (owner->module == NULL)
         return;
 
-    module_unneed (p_aout, owner->module);
-    aout_VolumeNoneInit( p_aout ); /* clear volume callback */
+    module_unneed (aout, owner->module);
+    /* Clear callbacks */
+    aout->pf_play = aout_DecDeleteBuffer; /* gruik */
+    aout->pf_pause = NULL;
+    aout->pf_flush = NULL;
+    aout_VolumeNoneInit (aout);
     owner->module = NULL;
     aout_FiltersDestroyPipeline (owner->filters, owner->nb_filters);
 }
 
-/*****************************************************************************
- * aout_OutputPlay : play a buffer
- *****************************************************************************
- * This function is entered with the mixer lock.
- *****************************************************************************/
+/**
+ * Plays a decoded audio buffer.
+ */
 void aout_OutputPlay (audio_output_t *aout, block_t *block)
 {
     aout_owner_t *owner = aout_owner (aout);



More information about the vlc-commits mailing list