Cubeb: Initialize COM on init #13364
Draft
+6
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
Initializes COM on cubeb init.
Rationale behind Changes
Updating to SDL 3.2.24 exposed a bug with our cubeb implementation as we didn't initialise COM causing the GS dump runner to crash.
"Cubed's WASAPI doesn't initialise COM on init (it's documented that we should do that)
This is normally fine as we call CoInitializeEx in VMManager::Internal::CPUThreadInitialize()
GSRunner, however, calls CPUThreadInitialize() in the main thread, and then starts a different thread to run the VM on
As COM needs to be initialised per thread, that meant the VM thread didn't have COM initialised.
As it happened, SDL was initialising COM when setting up Windows.Gaming.Input (and thus hiding the above issue)
Between the 2 SDL versions, the default value for the hint SDL_JOYSTICK_WGI was switched from true to false
Thus, SDL stopped needing to initialising COM, exposing our bug"
Suggested Testing Steps
Test to see if the dump runner works correctly and audio on Windows works as expected.
Did you use AI to help find, test, or implement this issue or feature?
No