diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-01 12:57:51 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-01 12:57:51 +0200 |
commit | ca3a3b63eed0de7d86291dab8479dcc3e4fc4b8f (patch) | |
tree | 3265beacca87ccdcf598c270456b06664b8d6eaa /media/webrtc | |
parent | 8d29394b4bc27b3575141685647df1509d687441 (diff) | |
download | UXP-ca3a3b63eed0de7d86291dab8479dcc3e4fc4b8f.tar UXP-ca3a3b63eed0de7d86291dab8479dcc3e4fc4b8f.tar.gz UXP-ca3a3b63eed0de7d86291dab8479dcc3e4fc4b8f.tar.lz UXP-ca3a3b63eed0de7d86291dab8479dcc3e4fc4b8f.tar.xz UXP-ca3a3b63eed0de7d86291dab8479dcc3e4fc4b8f.zip |
WebRTC: Add DeleteStreams to media conduits.
Diffstat (limited to 'media/webrtc')
6 files changed, 16 insertions, 4 deletions
diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.h b/media/webrtc/signaling/src/media-conduit/AudioConduit.h index 228736dcc..fcc7e0f37 100755 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.h +++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.h @@ -161,6 +161,8 @@ public: virtual uint64_t CodecPluginID() override { return 0; } + virtual void DeleteStreams() override {} + WebrtcAudioConduit(): mVoiceEngine(nullptr), mTransportMonitor("WebrtcAudioConduit"), diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h index 05c34fea0..0654b1175 100755 --- a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h +++ b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h @@ -227,6 +227,8 @@ public: uint64_t* bytesSent) = 0; virtual uint64_t CodecPluginID() = 0; + + virtual void DeleteStreams() = 0; NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaSessionConduit) diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp index 3f0445122..b406fded5 100755 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp @@ -109,7 +109,7 @@ WebrtcVideoConduit::~WebrtcVideoConduit() // Release AudioConduit first by dropping reference on MainThread, where it expects to be SyncTo(nullptr); - Destroy(); + MOZ_ASSERT(!mSendStream && !mRecvStream, "Call DeleteStreams prior to ~WebrtcVideoConduit."); } bool WebrtcVideoConduit::SetLocalSSRC(unsigned int ssrc) @@ -478,7 +478,7 @@ WebrtcVideoConduit::Init() } void -WebrtcVideoConduit::Destroy() +WebrtcVideoConduit::DeleteStreams() { // The first one of a pair to be deleted shuts down media for both //Deal with External Capturer diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.h b/media/webrtc/signaling/src/media-conduit/VideoConduit.h index 323a6a284..ff50d80b5 100755 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h @@ -269,6 +269,8 @@ public: return mSendingHeight; } + virtual void DeleteStreams() override; + unsigned int SendingMaxFs() override { if(mCurSendCodecConfig) { return mCurSendCodecConfig->mEncodingConstraints.maxFs; @@ -288,7 +290,6 @@ public: MediaConduitErrorCode InitMain(); virtual MediaConduitErrorCode Init(); - virtual void Destroy(); int GetChannel() { return mChannel; } webrtc::VideoEngine* GetVideoEngine() { return mVideoEngine; } diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp index 4f42b0bb7..6477a7d78 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp @@ -1,4 +1,4 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public +:SelfDestruct_m/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -1036,6 +1036,11 @@ PeerConnectionMedia::SelfDestruct_m() mLocalSourceStreams.Clear(); mRemoteSourceStreams.Clear(); + // Clean up our send and receive streams + for (auto i = mConduits.begin(); i != mConduits.end(); ++i) { + i->second.second->DeleteStreams(); + } + mMainThread = nullptr; // Final self-destruct. diff --git a/media/webrtc/signaling/test/mediaconduit_unittests.cpp b/media/webrtc/signaling/test/mediaconduit_unittests.cpp index adcc838bf..07e3b3975 100644 --- a/media/webrtc/signaling/test/mediaconduit_unittests.cpp +++ b/media/webrtc/signaling/test/mediaconduit_unittests.cpp @@ -810,6 +810,8 @@ class TransportConduitTest : public ::testing::Test err = videoSession->ConfigureSendMediaCodec(nullptr); EXPECT_TRUE(err != mozilla::kMediaConduitNoError); + + videoSession->DeleteStreams(); mozilla::SyncRunnable::DispatchToThread(gMainThread, WrapRunnable( |