Re: Discord Crackling w/VB Out since moving to Windows 2004
Posted: Wed Jan 20, 2021 9:14 pm
I dug into the Discord WebRTC logs as well as the source code and have finally found a plausible explanation.
Discord uses their own version of WebRTC for the desktop app - the browser version of Discord doesn't exhibit this problem for that reason (viewtopic.php?t=1129).
It seems their version of WebRTC is based on a pretty old implementation of the official version.
The way that old implementation works is that if even one device is unable to be initialized, CoreAudioIsSupported returns false, Core Audio gets disabled and Discord falls back onto the Wave APIs.
The function was changed in a Dec 06, 2019 commit (https://webrtc.googlesource.com/src/+/e ... 3cf23e738e) as it doesn't make sense to disable Core Audio entirely if only one device fails.
But why would a device fail if everything is correctly configured and working well? Simply, VoiceMeeter needs exclusive access to the A1 device for it to output properly - setting the A1 device in the device properties to not allow applications to take exclusive control results in very distorted audio through VoiceMeeter. Having that device be exclusive to VoiceMeeter doesn't cause problems with many apps because most apps don't add a layer on top of the official WebRTC implementation.
But in Discord's case, they use a pretty old version of the function that checks for Core Audio. That function, in order to check for Core Audio, initializes every recording/playback device one by one. When the function checks for every device and stumbles upon the A1 device that's set to be exclusive, it is unable to initialize it and marks Core Audio as disabled, marking every subsequent device as having failed initialization too...
In short, there is nothing that can be done unless VoiceMeeter releases the A1 device when Discord is first opened or Discord updates their code base, which likely won't happen anytime soon given that the commit is over a year old now and still isn't present in Discord's version.
Nevertheless, I can attest that disabling exclusive mode for the A1 device (and I suppose, any other hardware device in VoiceMeeter) fixes the initialization errors in the Discord logs. I can't test whether or not the crackling of the microphone still happens given that all audio is distorted when A1 isn't in exclusive mode.
Discord uses their own version of WebRTC for the desktop app - the browser version of Discord doesn't exhibit this problem for that reason (viewtopic.php?t=1129).
It seems their version of WebRTC is based on a pretty old implementation of the official version.
The way that old implementation works is that if even one device is unable to be initialized, CoreAudioIsSupported returns false, Core Audio gets disabled and Discord falls back onto the Wave APIs.
The function was changed in a Dec 06, 2019 commit (https://webrtc.googlesource.com/src/+/e ... 3cf23e738e) as it doesn't make sense to disable Core Audio entirely if only one device fails.
But why would a device fail if everything is correctly configured and working well? Simply, VoiceMeeter needs exclusive access to the A1 device for it to output properly - setting the A1 device in the device properties to not allow applications to take exclusive control results in very distorted audio through VoiceMeeter. Having that device be exclusive to VoiceMeeter doesn't cause problems with many apps because most apps don't add a layer on top of the official WebRTC implementation.
But in Discord's case, they use a pretty old version of the function that checks for Core Audio. That function, in order to check for Core Audio, initializes every recording/playback device one by one. When the function checks for every device and stumbles upon the A1 device that's set to be exclusive, it is unable to initialize it and marks Core Audio as disabled, marking every subsequent device as having failed initialization too...
In short, there is nothing that can be done unless VoiceMeeter releases the A1 device when Discord is first opened or Discord updates their code base, which likely won't happen anytime soon given that the commit is over a year old now and still isn't present in Discord's version.
Nevertheless, I can attest that disabling exclusive mode for the A1 device (and I suppose, any other hardware device in VoiceMeeter) fixes the initialization errors in the Discord logs. I can't test whether or not the crackling of the microphone still happens given that all audio is distorted when A1 isn't in exclusive mode.