diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-02-06 19:12:14 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-08 18:37:09 -0800 |
commit | 90efc71ef9f0fa43d6b3b8d2ebc8bda1556b669f (patch) | |
tree | f1f1894c537c1a5dcc4ef4de622b11ee28f7cb06 /indra | |
parent | 49a1b4038f4852df17f574f1fb5b01c5b5ddafb4 (diff) |
race between session established and data channel ready
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 48 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.h | 15 |
3 files changed, 53 insertions, 53 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 06a5c3a085..ee85a254f2 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -476,40 +476,22 @@ void LLWebRTCImpl::OnDevicesUpdated() void LLWebRTCImpl::setTuningMode(bool enable) { - mWorkerThread->BlockingCall( - [this, enable]() - { - if (enable) - { - - mTuningDeviceModule->StartRecording(); - - if (mPeerDeviceModule) - { - mPeerDeviceModule->StopRecording(); - } - } - else - { - mTuningDeviceModule->StartRecording(); - if (mPeerDeviceModule) - { - mPeerDeviceModule->StartRecording(); - } - } - }); - for (auto& connection : mPeerConnections) - { - if (enable) + mSignalingThread->PostTask( + [this, enable] { - connection->enableSenderTracks(false); - } - else - { - connection->resetMute(); - } - connection->enableReceiverTracks(!enable); - } + for (auto &connection : mPeerConnections) + { + if (enable) + { + connection->enableSenderTracks(false); + } + else + { + connection->resetMute(); + } + connection->enableReceiverTracks(!enable); + } + }); } float LLWebRTCImpl::getTuningAudioLevel() { return -20 * log10f(mTuningAudioDeviceObserver->getMicrophoneEnergy()); } diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index a6e26644b0..7b85795697 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2843,9 +2843,23 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() mWebRTCAudioInterface->setReceiveVolume(mSpeakerVolume); mWebRTCAudioInterface->setSendVolume(mMicGain); LLWebRTCVoiceClient::getInstance()->OnConnectionEstablished(mChannelID, mRegionID); - setVoiceConnectionState(VOICE_STATE_SESSION_UP); + setVoiceConnectionState(VOICE_STATE_WAIT_FOR_DATA_CHANNEL); + break; + } + case VOICE_STATE_WAIT_FOR_DATA_CHANNEL: + { + if (mShutDown) + { + setVoiceConnectionState(VOICE_STATE_DISCONNECT); + break; + } + if (mWebRTCDataInterface) + { + sendJoin(); + setVoiceConnectionState(VOICE_STATE_SESSION_UP); + } + break; } - break; case VOICE_STATE_SESSION_UP: { if (mShutDown) @@ -3006,19 +3020,22 @@ void LLVoiceWebRTCConnection::OnDataChannelReady(llwebrtc::LLWebRTCDataInterface { mWebRTCDataInterface = data_interface; mWebRTCDataInterface->setDataObserver(this); + } +} - Json::FastWriter writer; - Json::Value root = Json::objectValue; - Json::Value join_obj = Json::objectValue; - LLUUID regionID = gAgent.getRegion()->getRegionID(); - if (regionID == mRegionID) - { - join_obj["p"] = true; - } - root["j"] = join_obj; - std::string json_data = writer.write(root); - mWebRTCDataInterface->sendData(json_data, false); +void LLVoiceWebRTCConnection::sendJoin() +{ + Json::FastWriter writer; + Json::Value root = Json::objectValue; + Json::Value join_obj = Json::objectValue; + LLUUID regionID = gAgent.getRegion()->getRegionID(); + if (regionID == mRegionID) + { + join_obj["p"] = true; } + root["j"] = join_obj; + std::string json_data = writer.write(root); + mWebRTCDataInterface->sendData(json_data, false); } ///////////////////////////// diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 83cb3c7eef..16bcadb144 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -769,6 +769,7 @@ class LLVoiceWebRTCConnection : void OnDataChannelReady(llwebrtc::LLWebRTCDataInterface *data_interface) override; //@} + void sendJoin(); void sendData(const std::string &data); virtual void processIceUpdates(); @@ -806,13 +807,13 @@ class LLVoiceWebRTCConnection : VOICE_STATE_REQUEST_CONNECTION = 0x4, VOICE_STATE_CONNECTION_WAIT = 0x8, VOICE_STATE_SESSION_ESTABLISHED = 0x10, - VOICE_STATE_SESSION_UP = 0x20, - VOICE_STATE_SESSION_RETRY = 0x40, - VOICE_STATE_DISCONNECT = 0x80, - VOICE_STATE_WAIT_FOR_EXIT = 0x100, - VOICE_STATE_SESSION_EXIT = 0x200, - VOICE_STATE_SESSION_STOPPING = 0x3c0, - VOICE_STATE_SESSION_WAITING = 0x10a + VOICE_STATE_WAIT_FOR_DATA_CHANNEL = 0x20, + VOICE_STATE_SESSION_UP = 0x40, + VOICE_STATE_SESSION_RETRY = 0x80, + VOICE_STATE_DISCONNECT = 0x100, + VOICE_STATE_WAIT_FOR_EXIT = 0x200, + VOICE_STATE_SESSION_EXIT = 0x400, + VOICE_STATE_SESSION_STOPPING = 0x780 } EVoiceConnectionState; EVoiceConnectionState mVoiceConnectionState; |