Skip to content

pcaudiolib: fix CoInitialize to allow RPC_E_CHANGED_MODE - #29863

Closed
mcarans wants to merge 5 commits into
msys2:masterfrom
mcarans:patch-1
Closed

pcaudiolib: fix CoInitialize to allow RPC_E_CHANGED_MODE#29863
mcarans wants to merge 5 commits into
msys2:masterfrom
mcarans:patch-1

Conversation

@mcarans

@mcarans mcarans commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

XAudio2 requires Multi Threaded Apartment to work reliably. If it was pre-initialized as Single Threaded Apartment, an error code is returned RPC_E_CHANGED_MODE (0x80010106), but this can be safely ignored.

Allow RPC_E_CHANGED_MODE
@mcarans mcarans changed the title Fix CoInitialize usage Fix CoInitialize usage - allow RPC_E_CHANGED_MODE Jun 7, 2026
@mcarans mcarans changed the title Fix CoInitialize usage - allow RPC_E_CHANGED_MODE pcaudiolib: fix CoInitialize to allow RPC_E_CHANGED_MODE Jun 7, 2026
@mcarans
mcarans marked this pull request as draft June 7, 2026 22:00
@mcarans

mcarans commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Need to add check for uninitialising.

@mcarans

mcarans commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Looks like packages are not being built for testing. I guess I need to make this "ready for review" to get test packages? I'll try.

@mcarans
mcarans marked this pull request as ready for review June 8, 2026 21:57
mcarans added 2 commits June 9, 2026 10:01
@mcarans

mcarans commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Ok just need to test artifact next time I'm on Windows

@mcarans

mcarans commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

I have tested the package and it is fine. I think this is ready to release @lazka.

@mcarans

mcarans commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

This is a small change that fixes a bug. Please let me know what needs to happen for it to be merged.
@striezel @MehdiChinoune

@striezel

Copy link
Copy Markdown
Collaborator

Please let me know what needs to happen for it to be merged.

First, pkgrel=1 needs to be bumped to pkgrel=2, because otherwise the package won't be recognized as new.

Second, I am not sure whether it is really OK to "ignore" a return code of CoInitializeEx() that indicates an error. That seems counter-intuitive and not like the right thing to do. Such things usually come back to bite you in unexpected ways. I cannot merge those changes in good conscience. Maybe someone who is more familiar with WinAPI than me can clear this up.

And finally, if that is a bug in pcaudiolib, then it should probably be reported upstream: https://github.com/espeak-ng/pcaudiolib Maybe the folks over there can clarify how to fix this.

@mcarans

mcarans commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Please let me know what needs to happen for it to be merged.

First, pkgrel=1 needs to be bumped to pkgrel=2, because otherwise the package won't be recognized as new.

Second, I am not sure whether it is really OK to "ignore" a return code of CoInitializeEx() that indicates an error. That seems counter-intuitive and not like the right thing to do. Such things usually come back to bite you in unexpected ways. I cannot merge those changes in good conscience. Maybe someone who is more familiar with WinAPI than me can clear this up.

And finally, if that is a bug in pcaudiolib, then it should probably be reported upstream: https://github.com/espeak-ng/pcaudiolib Maybe the folks over there can clarify how to fix this.

Unfortunately on point 3, the espeak-ng/pcaudiolib devs have not responded to my original PR from when I first created the MSYS2 package: espeak-ng/pcaudiolib#34. They are essentially uninterested and unresponsive: espeak-ng/espeak-ng#2288 (comment)

Currently this change is required for espeak-ng to work properly with SDL3 audio to which the Oolite UCRT64 based game was recently upgraded. However after researching further, I think you may be right about the overall safety of such a change in the general case so I will close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants