nvda
7a42d8ef - Fix SAPI4 WASAPI implementation (#17817)

Commit
1 year ago
Fix SAPI4 WASAPI implementation (#17817) Fixes #17775. Fixes #17776. Fixes #17764. Fixes #17826. Summary of the issue: Some SAPI4 voices cannot work with the WASAPI implementation, because of some differences in behavior between the WASAPI implementation and the SAPI4 built-in WinMM implementation. When rapidly navigating between objects, COM error -2147418107 is sometimes raised. Description of user facing changes The issue mentioned above should be fixed. Description of development approach Changed the handling of audio object statuses, so that it acts more similar to the WinMM implementation. All SAPI 4 COM-related code will now run in a dedicated thread, _ComThread, instead of in the main thread. COM calls are performed outside the window message loop, in order to prevent the occasionally-raised COMError -2147418107 (RPC_E_CANTCALLOUT_INEXTERNALCALL). Notification methods in IAudioDestNotifySink are called asynchronously in the same COM thread to prevent deadlocks. The "audio buffer size" is set to be of 2 seconds long, instead of having an infinite size, in order to behave more similar to the built-in WinMM implementation. Bookmarks are now in another queue, _bookmarkQueue, and the original queue _audioQueue only stores audio data chunks.
Author
Parents
Loading