vlc | branch: master | Thomas Guillem <[email protected]> | Mon Dec 11 18:16:30 2017 +0100| [48f65f1df0f85104ddae365c2ef13bddb9edd356] | committer: Thomas Guillem
audiounit_ios: move notification up > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=48f65f1df0f85104ddae365c2ef13bddb9edd356 --- modules/audio_output/audiounit_ios.m | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/audio_output/audiounit_ios.m b/modules/audio_output/audiounit_ios.m index 7421ecf6c6..7fb2642ad2 100644 --- a/modules/audio_output/audiounit_ios.m +++ b/modules/audio_output/audiounit_ios.m @@ -424,9 +424,21 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) p_sys->au_unit = NULL; + [[NSNotificationCenter defaultCenter] addObserver:p_sys->aoutWrapper + selector:@selector(audioSessionRouteChange:) + name:AVAudioSessionRouteChangeNotification + object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:p_sys->aoutWrapper + selector:@selector(handleInterruption:) + name:AVAudioSessionInterruptionNotification + object:nil]; + /* Activate the AVAudioSession */ if (avas_SetActive(p_aout, true, 0) != VLC_SUCCESS) + { + [[NSNotificationCenter defaultCenter] removeObserver:p_sys->aoutWrapper]; return VLC_EGENERIC; + } /* Set the preferred number of channels, then fetch the channel layout that * should correspond to this number */ @@ -475,15 +487,6 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) if (p_sys->b_muted) Pause(p_aout, true, 0); - [[NSNotificationCenter defaultCenter] addObserver:p_sys->aoutWrapper - selector:@selector(audioSessionRouteChange:) - name:AVAudioSessionRouteChangeNotification - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:p_sys->aoutWrapper - selector:@selector(handleInterruption:) - name:AVAudioSessionInterruptionNotification - object:nil]; - free(layout); fmt->channel_type = AUDIO_CHANNEL_TYPE_BITMAP; p_aout->mute_set = MuteSet; @@ -500,6 +503,7 @@ error: avas_resetPreferredNumberOfChannels(p_aout); avas_SetActive(p_aout, false, AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation); + [[NSNotificationCenter defaultCenter] removeObserver:p_sys->aoutWrapper]; msg_Err(p_aout, "opening AudioUnit output failed"); return VLC_EGENERIC; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
