Skip to content

Commit

Permalink
Merge Mumble nullptr check (pr-2897)
Browse files Browse the repository at this point in the history
aaa1246 - fix(voip-mumble): nullptr check
  • Loading branch information
prikolium-cfx committed Nov 5, 2024
2 parents 441c7f5 + aaa1246 commit be33c7f
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions code/components/voip-mumble/src/MumbleAudioInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,26 @@ void MumbleAudioInput::ThreadFunc()

if (g_curInputIntentMode != g_lastIntentMode)
{
switch (g_curInputIntentMode)
{
case InputIntentMode::MUSIC:
{
m_apm->noise_suppression()->Enable(false);
m_apm->high_pass_filter()->Enable(false);
break;
}
case InputIntentMode::SPEECH:
default:
if (m_apm)
{
m_apm->noise_suppression()->Enable(true);
m_apm->high_pass_filter()->Enable(true);
break;
switch (g_curInputIntentMode)
{
case InputIntentMode::MUSIC:
{
m_apm->noise_suppression()->Enable(false);
m_apm->high_pass_filter()->Enable(false);
break;
}
case InputIntentMode::SPEECH:
default:
{
m_apm->noise_suppression()->Enable(true);
m_apm->high_pass_filter()->Enable(true);
break;
}
};
}
};

g_lastIntentMode = g_curInputIntentMode;
}

Expand Down Expand Up @@ -705,10 +709,12 @@ void MumbleAudioInput::InitializeAudioDevice()

m_apm->Initialize(pconfig);

m_apm->high_pass_filter()->Enable(true);
m_apm->echo_cancellation()->Enable(false);
m_apm->noise_suppression()->Enable(true);
const bool isVoiceIntent = g_curInputIntentMode == InputIntentMode::SPEECH;
m_apm->high_pass_filter()->Enable(isVoiceIntent);
m_apm->noise_suppression()->Enable(isVoiceIntent);
m_apm->noise_suppression()->set_level(webrtc::NoiseSuppression::kHigh);

m_apm->echo_cancellation()->Enable(false);
m_apm->level_estimator()->Enable(true);
m_apm->voice_detection()->set_likelihood(ConvertLikelihood(m_likelihood));
//m_apm->voice_detection()->set_frame_size_ms(10);
Expand Down

0 comments on commit be33c7f

Please sign in to comment.