diff --git a/code/components/voip-mumble/src/MumbleAudioOutput.cpp b/code/components/voip-mumble/src/MumbleAudioOutput.cpp index e8d235065f..090ec5a2d7 100644 --- a/code/components/voip-mumble/src/MumbleAudioOutput.cpp +++ b/code/components/voip-mumble/src/MumbleAudioOutput.cpp @@ -1499,15 +1499,6 @@ void MumbleAudioOutput::SetAudioDevice(const std::string& deviceId) { std::unique_lock _(m_clientsMutex); - - for (auto& client : m_clients) - { - if (client.second) - { - m_ids.push_back(client.first); - } - } - // delete all clients m_clients.clear(); } @@ -1515,12 +1506,10 @@ void MumbleAudioOutput::SetAudioDevice(const std::string& deviceId) // reinitialize audio device InitializeAudioDevice(); - // recreate clients - for (auto& client : m_ids) + m_client->GetState().ForAllUsers([this](const std::shared_ptr& user) { - MumbleUser fakeUser(client); - HandleClientConnect(fakeUser); - } + HandleClientConnect(*user); + }); } void MumbleAudioOutput::SetDistance(float distance)