[vlc-commits] move audio unit initialization after audio session initialization and setup fixes issues when trying to start playback from background

Tobias Conradi git at videolan.org
Fri May 1 21:59:32 CEST 2015


vlc | branch: master | Tobias Conradi <videolan at tobias-conradi.de> | Fri May  1 21:56:06 2015 +0200| [1ee464915748e9efb00464d2e926c27e1513a4bd] | committer: Felix Paul Kühne

move audio unit initialization after audio session initialization and setup fixes issues when trying to start playback from background

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

 modules/audio_output/audiounit_ios.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
index 4645306..699db58 100644
--- a/modules/audio_output/audiounit_ios.c
+++ b/modules/audio_output/audiounit_ios.c
@@ -252,13 +252,6 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
         return false;
     }
 
-    /* AU init */
-    status = AudioUnitInitialize(p_sys->au_unit);
-    if (status != noErr) {
-        msg_Err(p_aout, "failed to init AudioUnit (%i)", (int)status);
-        return false;
-    }
-
     /* setup circular buffer */
     TPCircularBufferInit(&p_sys->circular_buffer, AUDIO_BUFFER_SIZE_IN_SECONDS * fmt->i_rate * fmt->i_bytes_per_frame);
 
@@ -268,10 +261,17 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
                             NULL,
                             NULL);
 
-	/* Set audio session to mediaplayback */
-	UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
-	AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory),&sessionCategory);
-	AudioSessionSetActive(true);
+    /* Set audio session to mediaplayback */
+    UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
+    AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory),&sessionCategory);
+    AudioSessionSetActive(true);
+
+    /* AU init */
+    status = AudioUnitInitialize(p_sys->au_unit);
+    if (status != noErr) {
+        msg_Err(p_aout, "failed to init AudioUnit (%i)", (int)status);
+        return false;
+    }
 
     /* start the unit */
     status = AudioOutputUnitStart(p_sys->au_unit);



More information about the vlc-commits mailing list