diff options
| -rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 15 | ||||
| -rw-r--r-- | indra/newview/llvoicewebrtc.h | 4 |
3 files changed, 22 insertions, 1 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 828896f620..d5182b16e7 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -1495,6 +1495,10 @@ void freePeerConnection(LLWebRTCPeerConnectionInterface* peer_connection) void init(LLWebRTCLogCallback* logCallback) { + if (gWebRTCImpl) + { + return; + } gWebRTCImpl = new LLWebRTCImpl(logCallback); gWebRTCImpl->init(); } diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 62bab7d24a..72a60c506b 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -273,6 +273,11 @@ void LLWebRTCVoiceClient::cleanupSingleton() void LLWebRTCVoiceClient::init(LLPumpIO* pump) { // constructor will set up LLVoiceClient::getInstance() + initWebRTC(); +} + +void LLWebRTCVoiceClient::initWebRTC() +{ llwebrtc::init(this); mWebRTCDeviceInterface = llwebrtc::getDeviceInterface(); @@ -292,6 +297,7 @@ void LLWebRTCVoiceClient::terminate() mVoiceEnabled = false; llwebrtc::terminate(); + mWebRTCDeviceInterface = nullptr; sShuttingDown = true; } @@ -1805,6 +1811,15 @@ void LLWebRTCVoiceClient::onChangeDetailed(const LLMute& mute) } } +void LLWebRTCVoiceClient::userAuthorized(const std::string& user_id, const LLUUID& agentID) +{ + if (sShuttingDown) + { + sShuttingDown = false; // was terminated, restart + initWebRTC(); + } +} + void LLWebRTCVoiceClient::predSetUserMute(const LLWebRTCVoiceClient::sessionStatePtr_t &session, const LLUUID &id, bool mute) { session->setUserMute(id, mute); diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 722d81fdc2..2ce575852a 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -204,7 +204,7 @@ public: //@} // authorize the user - void userAuthorized(const std::string &user_id, const LLUUID &agentID) override {}; + void userAuthorized(const std::string &user_id, const LLUUID &agentID) override; void OnConnectionEstablished(const std::string& channelID, const LLUUID& regionID); @@ -443,6 +443,8 @@ public: boost::signals2::connection mAvatarNameCacheConnection; private: + // init or restart the WebRTC device interface. + void initWebRTC(); // Coroutine support methods //--- |
