Don't call setPreferredOutputNumberOfChannels on iOS, it breaks audio output

Sam Lantinga 2020-02-24 12:07:18 -08:00
parent 2c9871a4a8
commit e3b0713e40
1 changed files with 4 additions and 0 deletions

View File

@ -855,6 +855,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
AVAudioSession* session = [AVAudioSession sharedInstance];
[session setPreferredSampleRate:this->spec.freq error:nil];
this->spec.freq = (int)session.sampleRate;
#if TARGET_OS_TV
if (iscapture) {
[session setPreferredInputNumberOfChannels:this->spec.channels error:nil];
this->spec.channels = session.preferredInputNumberOfChannels;
@ -862,6 +863,9 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
[session setPreferredOutputNumberOfChannels:this->spec.channels error:nil];
this->spec.channels = session.preferredOutputNumberOfChannels;
}
#else
/* Calling setPreferredOutputNumberOfChannels seems to break audio output on iOS */
#endif /* TARGET_OS_TV */
}
#endif