Merge pull request #5811 from mfleisz/mac_rdpsnd_workaround

rdpsnd: Do not set output device on Catalina or later (#5747)
This commit is contained in:
Martin Fleisz 2020-01-03 14:47:10 +01:00 committed by GitHub
commit 5d804852b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 7 deletions

View File

@ -167,14 +167,22 @@ static BOOL rdpsnd_mac_open(rdpsndDevicePlugin *device, const AUDIO_FORMAT *form
if (!mac->engine) if (!mac->engine)
return FALSE; return FALSE;
err = AudioUnitSetProperty(mac->engine.outputNode.audioUnit, if (@available(macOS 10.15, *))
kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0,
&outputDeviceID, sizeof(outputDeviceID));
if (err)
{ {
rdpsnd_mac_release(mac); /* Setting the output audio device on 10.15 or later breaks sound playback. Do not set for
WLog_ERR(TAG, "AudioUnitSetProperty: %s", FormatError(err)); * now until we find a proper fix for #5747 */
return FALSE; }
else
{
err = AudioUnitSetProperty(mac->engine.outputNode.audioUnit,
kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global,
0, &outputDeviceID, sizeof(outputDeviceID));
if (err)
{
rdpsnd_mac_release(mac);
WLog_ERR(TAG, "AudioUnitSetProperty: %s", FormatError(err));
return FALSE;
}
} }
mac->player = [[AVAudioPlayerNode alloc] init]; mac->player = [[AVAudioPlayerNode alloc] init];