Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinitialize mixer after StopTransport #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FrayxRulez
Copy link
Contributor

Current implementation doesn't allow to change render/capture device after the transport has been initialized.
This PR aims to fix the issue.
I've been looking around for additional stuff to be disposed/released, but I couldn't find any.
A possible improvement to this code would be to move this code to SetDevice method, and only if (!Transporting()).
This way, Stopping and Starting the transport without changing device won't cause a useless reinitialization.

Since in my code base we only stop/start the transports when switching devices, I consider this fine or me.

@@ -635,6 +635,8 @@ struct AudioDeviceHelper : public DeviceHelper<DEVICE_CLASS> {
CloseHandle(_hThread);
_hThread = nullptr;
_transporting = false;
_transportInitialized = false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be set to false on line 630 to avoid setting the same value in two places? Or would that introduce a potential race condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that there's the risk of a race condition, as if you see _transporting was set to false in both places even before my change.

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