[vlc-commits] audiounit_ios: fix audio unit handling in pause state (close #10480)

Felix Paul Kühne git at videolan.org
Sat Jan 25 20:10:12 CET 2014


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Jan 25 20:09:16 2014 +0100| [bfa8edd879c2af197092e867f32ce1a202932fe9] | committer: Felix Paul Kühne

audiounit_ios: fix audio unit handling in pause state (close #10480)

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

 modules/audio_output/audiounit_ios.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
index e00a7e3..1408dc5 100644
--- a/modules/audio_output/audiounit_ios.c
+++ b/modules/audio_output/audiounit_ios.c
@@ -88,6 +88,7 @@ static void     Flush                   (audio_output_t *, bool);
 static int      TimeGet                 (audio_output_t *, mtime_t *);
 static OSStatus RenderCallback    (vlc_object_t *, AudioUnitRenderActionFlags *, const AudioTimeStamp *,
                                          UInt32 , UInt32, AudioBufferList *);
+
 vlc_module_begin ()
     set_shortname("audiounit_ios")
     set_description(N_("AudioUnit output for iOS"))
@@ -328,10 +329,21 @@ static void Pause (audio_output_t *p_aout, bool pause, mtime_t date)
     p_sys->b_paused = pause;
     vlc_mutex_unlock(&p_sys->lock);
 
-    if (pause)
+    /* we need to start / stop the audio unit here because otherwise
+     * the OS won't believe us that we stopped the audio output
+     * so in case of an interruption, our unit would be permanently
+     * silenced.
+     * in case of multi-tasking, the multi-tasking view would still
+     * show a playing state despite we are paused, same for lock screen */
+    if (pause) {
+        AudioOutputUnitStop(p_sys->au_unit);
         AudioSessionSetActive(false);
-    else
+    } else {
+        AudioOutputUnitStart(p_sys->au_unit);
+        UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
+        AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory),&sessionCategory);
         AudioSessionSetActive(true);
+    }
 }
 
 static void Flush(audio_output_t *p_aout, bool wait)



More information about the vlc-commits mailing list