Skip to content

Commit

Permalink
fix(mumble): fix reinitializing clients when audio device is set
Browse files Browse the repository at this point in the history
`HandleClientConnect` expects the `MumbleUser` to hae a valid username and session, but this was only sending the session id, so the audio sink was getting set to an empty user name, resulting in the client never being able to hear anyone until they turned off their voice chat and turned it back on (or got lucky enough that their internet was slow, or initialization was slow and that this wouldn't get hit).
  • Loading branch information
AvarianKnight committed Dec 7, 2024
1 parent f1bbf02 commit 7c930dd
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions code/components/voip-mumble/src/MumbleAudioOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1499,28 +1499,17 @@ void MumbleAudioOutput::SetAudioDevice(const std::string& deviceId)

{
std::unique_lock<std::shared_mutex> _(m_clientsMutex);

for (auto& client : m_clients)
{
if (client.second)
{
m_ids.push_back(client.first);
}
}

// delete all clients
m_clients.clear();
}

// reinitialize audio device
InitializeAudioDevice();

// recreate clients
for (auto& client : m_ids)
m_client->GetState().ForAllUsers([this](const std::shared_ptr<MumbleUser>& user)
{
MumbleUser fakeUser(client);
HandleClientConnect(fakeUser);
}
HandleClientConnect(*user);
});
}

void MumbleAudioOutput::SetDistance(float distance)
Expand Down

0 comments on commit 7c930dd

Please sign in to comment.