add error check for AVAudioSession setActive. (#19000)

This commit is contained in:
WangHe 2018-09-10 16:23:40 +08:00 committed by leda
parent 6fb631e68e
commit 3c8c5139c1
1 changed files with 9 additions and 0 deletions

View File

@ -158,6 +158,11 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio
ALOGD("AVAudioSessionInterruptionTypeEnded, application == UIApplicationStateActive, alcMakeContextCurrent(s_ALContext)");
NSError *error = nil;
[[AVAudioSession sharedInstance] setActive:YES error:&error];
if(error != nil){
ALOGE("AVAudioSessionInterruptionTypeEnded, AVAudioSession setActive fail, %d",(int)error.code);
return;
}
alcMakeContextCurrent(s_ALContext);
if (Director::getInstance()->isPaused())
{
@ -196,6 +201,10 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio
return;
}
[[AVAudioSession sharedInstance] setActive:YES error:&error];
if(error != nil){
ALOGE("UIApplicationDidBecomeActiveNotification, AVAudioSession setActive fail, %d",(int)error.code);
return;
}
alcMakeContextCurrent(s_ALContext);
}
else if (isAudioSessionInterrupted)