fix some retry logic and speaker volume logic

meow-7.2.2
Roxie Linden 2023-09-13 22:49:39 -07:00
parent 0a844ef047
commit b476e1545b
3 changed files with 13 additions and 5 deletions

View File

@ -37,6 +37,8 @@
namespace llwebrtc
{
const float VOLUME_SCALE_WEBRTC = 3.0f;
void LLWebRTCImpl::init()
{
mAnswerReceived = false;
@ -356,7 +358,7 @@ void LLWebRTCImpl::setSpeakerVolume(float volume)
{
webrtc::AudioTrackInterface* audio_track = static_cast<webrtc::AudioTrackInterface*>(track);
webrtc::AudioSourceInterface* source = audio_track->GetSource();
source->SetVolume(10.0 * volume);
source->SetVolume(VOLUME_SCALE_WEBRTC * volume);
}
}

View File

@ -833,7 +833,6 @@ void LLWebRTCVoiceClient::OnVoiceAccountProvisioned(const LLSD& result)
<< (voicePassword.empty() ? "not set" : "set") << " channel sdp " << channelSDP << LL_ENDL;
setLoginInfo(voiceUserName, voicePassword, channelSDP);
setVoiceControlStateUnless(VOICE_STATE_SESSION_ESTABLISHED, VOICE_STATE_SESSION_RETRY);
}
void LLWebRTCVoiceClient::OnVoiceAccountProvisionFailure(std::string url, int retries, LLSD body, const LLSD& result)
@ -1518,6 +1517,10 @@ bool LLWebRTCVoiceClient::runSession(const sessionStatePtr_t &session)
{
return false;
}
if (getVoiceControlState() == VOICE_STATE_SESSION_RETRY)
{
break;
}
if (mSessionTerminateRequested)
{
@ -2825,17 +2828,20 @@ void LLWebRTCVoiceClient::OnAudioEstablished(llwebrtc::LLWebRTCAudioInterface *
{
LL_INFOS("Voice") << "On AudioEstablished." << LL_ENDL;
mWebRTCAudioInterface = audio_interface;
float speaker_volume = 0;
audio_interface->setMute(true);
{
LLMutexLock lock(&mVoiceStateMutex);
audio_interface->setSpeakerVolume(mSpeakerVolume);
speaker_volume = mSpeakerVolume;
}
audio_interface->setSpeakerVolume(mSpeakerVolume);
setVoiceControlStateUnless(VOICE_STATE_SESSION_ESTABLISHED, VOICE_STATE_SESSION_RETRY);
}
void LLWebRTCVoiceClient::OnRenegotiationNeeded()
{
LL_INFOS("Voice") << "On Renegotiation Needed." << LL_ENDL;
mRelogRequested = TRUE;
setVoiceControlStateUnless(VOICE_STATE_SESSION_RETRY);
}

View File

@ -829,7 +829,7 @@ private:
bool mSpeakerVolumeDirty;
bool mSpeakerMuteDirty;
int mSpeakerVolume;
float mSpeakerVolume;
int mMicVolume;
bool mMicVolumeDirty;