diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-05-17 13:27:45 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-05-17 13:27:45 -0700 |
commit | 2b275d43fb70f396bba4249c34442e7d70a76e19 (patch) | |
tree | aa7f7da7a20f38a6347672d713dddb6b1fffd841 /indra/llwebrtc | |
parent | cfd358f93350bf0ea487480d5c39bf48605b115b (diff) |
Clean up some shutdown code.
Diffstat (limited to 'indra/llwebrtc')
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 35 | ||||
-rw-r--r-- | indra/llwebrtc/llwebrtc_impl.h | 2 |
2 files changed, 22 insertions, 15 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 5c71831c65..c72841e9e5 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -627,7 +627,6 @@ void LLWebRTCImpl::freePeerConnection(LLWebRTCPeerConnectionInterface* peer_conn std::find(mPeerConnections.begin(), mPeerConnections.end(), peer_connection); if (it != mPeerConnections.end()) { - (*it)->terminate(); mPeerConnections.erase(it); } if (mPeerConnections.empty()) @@ -645,7 +644,6 @@ void LLWebRTCImpl::freePeerConnection(LLWebRTCPeerConnectionInterface* peer_conn LLWebRTCPeerConnectionImpl::LLWebRTCPeerConnectionImpl() : mWebRTCImpl(nullptr), - mClosing(false), mPeerConnection(nullptr), mMute(false), mAnswerReceived(false) @@ -673,20 +671,32 @@ void LLWebRTCPeerConnectionImpl::terminate() mWebRTCImpl->PostSignalingTask( [=]() { - if (mDataChannel) - { - mDataChannel->UnregisterObserver(); - mDataChannel->Close(); - mDataChannel = nullptr; - } if (mPeerConnection) { + if (mDataChannel) + { + { + mDataChannel->Close(); + mDataChannel = nullptr; + } + } + mPeerConnection->Close(); + if (mLocalStream) + { + auto tracks = mLocalStream->GetAudioTracks(); + for (auto& track : tracks) + { + mLocalStream->RemoveTrack(track); + } + mLocalStream = nullptr; + } mPeerConnection = nullptr; - } - for (auto &observer : mSignalingObserverList) - { - observer->OnPeerConnectionClosed(); + + for (auto &observer : mSignalingObserverList) + { + observer->OnPeerConnectionClosed(); + } } }); } @@ -810,7 +820,6 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti bool LLWebRTCPeerConnectionImpl::shutdownConnection() { - mClosing = true; terminate(); return true; } diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h index 984aaef734..448d36e3ea 100644 --- a/indra/llwebrtc/llwebrtc_impl.h +++ b/indra/llwebrtc/llwebrtc_impl.h @@ -355,8 +355,6 @@ class LLWebRTCPeerConnectionImpl : public LLWebRTCPeerConnectionInterface, LLWebRTCImpl * mWebRTCImpl; - bool mClosing; - rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> mPeerConnectionFactory; bool mMute; |