Skip to content

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.

@osaghaso osaghaso requested review from jlautman and osaghaso January 4, 2021 21:37
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