diff options
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; |