[vlc-commits] audiounit_ios: fix StartAnalog error handling

Thomas Guillem git at videolan.org
Fri Feb 24 11:41:11 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Feb 24 09:51:07 2017 +0100| [eaccb51f55a9e1404697a8757ed0c9378cd27729] | committer: Thomas Guillem

audiounit_ios: fix StartAnalog error handling

Also fix a AudioUnit leak in case of error.

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

 modules/audio_output/audiounit_ios.m | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/audiounit_ios.m b/modules/audio_output/audiounit_ios.m
index 4fce7f5..5be4101 100644
--- a/modules/audio_output/audiounit_ios.m
+++ b/modules/audio_output/audiounit_ios.m
@@ -306,7 +306,7 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
                                   i_param_size);
     if (status != noErr) {
         msg_Err(p_aout, "failed to set stream format (%i)", (int)status);
-        return VLC_EGENERIC;
+        goto error;
     }
     msg_Dbg(p_aout, STREAM_FORMAT_MSG("we set the AU format: " , streamDescription));
 
@@ -334,14 +334,14 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
                             0, &callback, sizeof(callback));
     if (status != noErr) {
         msg_Err(p_aout, "render callback setup failed (%i)", (int)status);
-        return VLC_EGENERIC;
+        goto error;
     }
 
     /* AU init */
     status = AudioUnitInitialize(p_sys->au_unit);
     if (status != noErr) {
         msg_Err(p_aout, "failed to init AudioUnit (%i)", (int)status);
-        return VLC_EGENERIC;
+        goto error;
     }
 
     /* setup circular buffer */
@@ -361,6 +361,10 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
     msg_Dbg(p_aout, "audio output unit started: %i", (int)status);
 
     return VLC_SUCCESS;
+
+error:
+    AudioComponentInstanceDispose(p_sys->au_unit);
+    return VLC_EGENERIC;
 }
 
 static void Stop(audio_output_t *p_aout)



More information about the vlc-commits mailing list