Fix default device not respecting ducking rules bug and handle leak#33
Fix default device not respecting ducking rules bug and handle leak#33SpriteOvO wants to merge 2 commits intotelegramdesktop:tdesktopfrom
Conversation
| if(deviceID=="default"){ | ||
| isDefaultDevice=true; | ||
| res=enumerator->GetDefaultAudioEndpoint(eRender, eCommunications, &device); | ||
| IMMDevice* temp_device; |
There was a problem hiding this comment.
looks strange since all other variables are in camelCase
If the problem is in GetDefaultAudioEndpoint, then just selecting the device itself instead of "default" in settings should solve the issue as well, does that solve it (i guess you need a version before video calls were added for the test)? |
Of course it won't occur since the stream is not a communication stream anymore and, therefore, call reducing feature is not called by the os. |
|
Looks like you just disabled the ducking feature entirely, didn't you? |
I think it could work.
I tested it and ducking does not work. You're right. |
I think the latest version of Because of this, and I found some informations about |
No, it uses WASAPI via webrtc
Yeah, and I guess it is better to leave it as is, since a lot of users except ducking
Oh, core developers are against adding new switches usually... |
Issue: telegramdesktop/tdesktop#8192
For my network reasons I was unable to compile
tdesktop's dependency libraryFFmpeg, so I referencedlibtgvoipand wrote a minimal test example that successfully reproduced the problem.In this line:
res=enumerator->GetDefaultAudioEndpoint(eRender, eCommunications, &device);The problem only occurs in devices returned via
GetDefaultAudioEndpointwitheCommunications. If replaceeCommunicationswitheConsoleoreMultimedia, the problem will not occur.I think it's a Windows bug, but we can't fix it that way because the msdn docs say that the
roleargument may affect the returned default device in the future.But there is a workaround to fix it, that we just get the name of the default device from
GetDefaultAudioEndpoint, and then callGetDevicewith the name to get the device.Some references:
https://social.microsoft.com/Forums/SECURITY/zh-CN/1b500f1e-744b-41d7-9c20-66ed83bda055/wasapi-stream-with-default-communictaions-device-does-not-trigger-ducking-for-other-applications?forum=windowspro-audiodevelopment
https://chromium.googlesource.com/chromium/src/media/+/d3d352cbce26b68596104356a5420d65544fe903%5E!/
https://github.com/mumble-voip/mumble/blob/54e313481d2fe2fe36fbd30f55c5f055cbbee615/src/mumble/WASAPI.cpp#L335-L359
Minimal test example:
https://github.com/SpriteOvO/TgCallBugTest
BTW, there is a handle leak in the device enumeration, that is, the device
Releaseshould be called afterIMMDeviceCollection::Item.Finally, since I cannot compile tdesktop, the changes in this PR are untested. I only tested successfully with my minimal test example. But I'm happy to help test the compiled files.