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

Mumble doesn't handle voice_useNativeAudio when changed in runtime #2675

Open
AvarianKnight opened this issue Jul 26, 2024 · 0 comments
Open
Labels
bug RedM Issues/PRs related to RedM triage Needs a preliminary assessment to determine the urgency and required action

Comments

@AvarianKnight
Copy link
Contributor

AvarianKnight commented Jul 26, 2024

What happened?

User changes voice_useNativeAudio to true during run time, but they continue you have whatever audio they have set before until turning off voice chat and turning it back on

void MumbleAudioOutput::HandleClientConnect(const MumbleUser& user)
{
{
std::unique_lock<std::mutex> initLock(m_initializeMutex);
if (!m_initialized && !m_initializeSignaled)
{
m_initializeVar.wait(initLock);
}
}
// if still not initialized, exit out
if (!m_initialized)
{
return;
}
if (g_useNativeAudio->GetValue())
{
fwRefContainer<IMumbleAudioSink> sinkRef;
OnGetMumbleAudioSink(user.GetName(), &sinkRef);
if (sinkRef.GetRef())
{
auto state = std::make_shared<ExternalAudioState>(sinkRef);
state->AfterConstruct();
std::unique_lock<std::shared_mutex> _(m_clientsMutex);
m_clients[user.GetSessionId()] = state;
return;
}
}

This is handled properly in other places (like changing audio devices)

void MumbleAudioOutput::SetAudioDevice(const std::string& deviceId)
{
if (m_deviceGuid == deviceId)
{
return;
}
m_deviceGuid = deviceId;
// mark as uninitialized
{
std::unique_lock<std::mutex> lock(m_initializeMutex);
m_initialized = false;
}
// save IDs
std::vector<uint32_t> m_ids;
{
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)
{
MumbleUser fakeUser(client);
HandleClientConnect(fakeUser);
}
}

Expected result

Clients audio sinks to be re-created.

Reproduction steps

  1. Set setr voice_useNativeAudio true during run time
  2. Can't use native audio specific features (like submixs) until changing audio device or reconnecting to mumble

Importancy

Slight inconvenience

Area(s)

FiveM, RedM

Specific version(s)

N/A

Additional information

@AvarianKnight AvarianKnight added bug triage Needs a preliminary assessment to determine the urgency and required action labels Jul 26, 2024
@github-actions github-actions bot added the RedM Issues/PRs related to RedM label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug RedM Issues/PRs related to RedM triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

1 participant