Bug 1290948 - Part 6: Remove some unused code. r+drno
MozReview-Commit-ID: G1uxg77wO78
--- a/media/mtransport/test/transport_unittests.cpp
+++ b/media/mtransport/test/transport_unittests.cpp
@@ -609,18 +609,18 @@ class TransportTestPeer : public sigslot
ice_ctx_->ctx()->SetStream(streams_.size(), stream);
streams_.push_back(stream);
// Listen for candidates
stream->SignalCandidate.
connect(this, &TransportTestPeer::GotCandidate);
// Create the transport layer
- ice_ = new TransportLayerIce(name);
- ice_->SetParameters(ice_ctx_->ctx(), stream, 1);
+ ice_ = new TransportLayerIce();
+ ice_->SetParameters(stream, 1);
// Assemble the stack
nsAutoPtr<std::queue<mozilla::TransportLayer *> > layers(
new std::queue<mozilla::TransportLayer *>);
layers->push(ice_);
layers->push(dtls_);
test_utils_->sts_target()->Dispatch(
--- a/media/mtransport/transportlayerice.cpp
+++ b/media/mtransport/transportlayerice.cpp
@@ -79,30 +79,28 @@ extern "C" {
namespace mozilla {
#ifdef ERROR
#undef ERROR
#endif
MOZ_MTLOG_MODULE("mtransport")
-TransportLayerIce::TransportLayerIce(const std::string& name)
- : name_(name),
- ctx_(nullptr), stream_(nullptr), component_(0),
+TransportLayerIce::TransportLayerIce()
+ : stream_(nullptr), component_(0),
old_stream_(nullptr)
{
// setup happens later
}
TransportLayerIce::~TransportLayerIce() {
// No need to do anything here, since we use smart pointers
}
-void TransportLayerIce::SetParameters(RefPtr<NrIceCtx> ctx,
- RefPtr<NrIceMediaStream> stream,
+void TransportLayerIce::SetParameters(RefPtr<NrIceMediaStream> stream,
int component) {
// Stream could be null in the case of some badly written js that causes
// us to be in an ICE restart case, but not have valid streams due to
// not calling PeerConnectionMedia::EnsureTransports if
// PeerConnectionImpl::SetSignalingState_m thinks the conditions were
// not correct. We also solved a case where an incoming answer was
// incorrectly beginning an ICE restart when the offer did not indicate one.
if (!stream) {
@@ -116,26 +114,23 @@ void TransportLayerIce::SetParameters(Re
if (stream_ && !old_stream_ && (stream_ != stream)) {
// Here we leave the old stream's signals connected until we don't need
// it anymore. They will be disconnected if ice restart is successful.
old_stream_ = stream_;
MOZ_MTLOG(ML_INFO, LAYER_INFO << "SetParameters save old stream("
<< old_stream_->name() << ")");
}
- ctx_ = ctx;
stream_ = stream;
component_ = component;
PostSetup();
}
void TransportLayerIce::PostSetup() {
- target_ = ctx_->thread();
-
stream_->SignalReady.connect(this, &TransportLayerIce::IceReady);
stream_->SignalFailed.connect(this, &TransportLayerIce::IceFailed);
stream_->SignalPacketReceived.connect(this,
&TransportLayerIce::IcePacketReceived);
if (stream_->state() == NrIceMediaStream::ICE_OPEN) {
TL_SET_STATE(TS_OPEN);
}
}
--- a/media/mtransport/transportlayerice.h
+++ b/media/mtransport/transportlayerice.h
@@ -25,22 +25,21 @@
#include "transportflow.h"
#include "transportlayer.h"
// An ICE transport layer -- corresponds to a single ICE
namespace mozilla {
class TransportLayerIce : public TransportLayer {
public:
- explicit TransportLayerIce(const std::string& name);
+ TransportLayerIce();
virtual ~TransportLayerIce();
- void SetParameters(RefPtr<NrIceCtx> ctx,
- RefPtr<NrIceMediaStream> stream,
+ void SetParameters(RefPtr<NrIceMediaStream> stream,
int component);
void ResetOldStream(); // called after successful ice restart
void RestoreOldStream(); // called after unsuccessful ice restart
// Transport layer overrides.
TransportResult SendPacket(const unsigned char *data, size_t len) override;
@@ -52,18 +51,16 @@ class TransportLayerIce : public Transpo
const unsigned char *data, int len);
TRANSPORT_LAYER_ID("ice")
private:
DISALLOW_COPY_ASSIGN(TransportLayerIce);
void PostSetup();
- const std::string name_;
- RefPtr<NrIceCtx> ctx_;
RefPtr<NrIceMediaStream> stream_;
int component_;
// used to hold the old stream
RefPtr<NrIceMediaStream> old_stream_;
};
} // close namespace
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -1604,30 +1604,16 @@ nsresult MediaPipelineTransmit::ReplaceT
}
if (wasTransmitting) {
Start();
}
return NS_OK;
}
-void MediaPipeline::DisconnectTransport_s(TransportInfo &info) {
- MOZ_ASSERT(info.transport_);
- ASSERT_ON_THREAD(sts_thread_);
-
- info.transport_->SignalStateChange.disconnect(this);
- // We do this even if we're a transmitter, since we are still possibly
- // registered to receive RTCP.
- TransportLayerDtls *dtls = static_cast<TransportLayerDtls *>(
- info.transport_->GetLayer(TransportLayerDtls::ID()));
- MOZ_ASSERT(dtls); // DTLS is mandatory
- MOZ_ASSERT(dtls->downward());
- dtls->downward()->SignalPacketReceived.disconnect(this);
-}
-
nsresult MediaPipeline::ConnectTransport_s(TransportInfo &info) {
MOZ_ASSERT(info.transport_);
ASSERT_ON_THREAD(sts_thread_);
// Look to see if the transport is ready
if (info.transport_->state() == TransportLayer::TS_OPEN) {
nsresult res = TransportReady_s(info);
if (NS_FAILED(res)) {
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
@@ -229,18 +229,16 @@ class MediaPipeline : public sigslot::ha
};
// The transport is down
virtual nsresult TransportFailed_s(TransportInfo &info);
// The transport is ready
virtual nsresult TransportReady_s(TransportInfo &info);
void UpdateRtcpMuxState(TransportInfo &info);
- // Unhooks from signals
- void DisconnectTransport_s(TransportInfo &info);
nsresult ConnectTransport_s(TransportInfo &info);
TransportInfo* GetTransportInfo_s(TransportFlow *flow);
void increment_rtp_packets_sent(int bytes);
void increment_rtcp_packets_sent();
void increment_rtp_packets_received(int bytes);
void increment_rtcp_packets_received();
deleted file mode 100644
--- a/media/webrtc/signaling/src/peerconnection/MediaStreamList.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* 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/. */
-
-#include "CSFLog.h"
-#include "base/basictypes.h"
-#include "MediaStreamList.h"
-#include "mozilla/dom/MediaStreamListBinding.h"
-#include "nsIScriptGlobalObject.h"
-#include "PeerConnectionImpl.h"
-#include "PeerConnectionMedia.h"
-
-namespace mozilla {
-namespace dom {
-
-MediaStreamList::MediaStreamList(PeerConnectionImpl* peerConnection,
- StreamType type)
- : mPeerConnection(peerConnection),
- mType(type)
-{
-}
-
-MediaStreamList::~MediaStreamList()
-{
-}
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(MediaStreamList)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaStreamList)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaStreamList)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaStreamList)
- NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
- NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-JSObject*
-MediaStreamList::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
-{
- return MediaStreamListBinding::Wrap(cx, this, aGivenProto);
-}
-
-nsISupports*
-MediaStreamList::GetParentObject()
-{
- return mPeerConnection->GetWindow();
-}
-
-template<class T>
-static DOMMediaStream*
-GetStreamFromInfo(T* info, bool& found)
-{
- if (!info) {
- found = false;
- return nullptr;
- }
-
- found = true;
- return info->GetMediaStream();
-}
-
-DOMMediaStream*
-MediaStreamList::IndexedGetter(uint32_t index, bool& found)
-{
- if (!mPeerConnection->media()) { // PeerConnection closed
- found = false;
- return nullptr;
- }
- if (mType == Local) {
- return GetStreamFromInfo(mPeerConnection->media()->
- GetLocalStreamByIndex(index), found);
- }
-
- return GetStreamFromInfo(mPeerConnection->media()->
- GetRemoteStreamByIndex(index), found);
-}
-
-uint32_t
-MediaStreamList::Length()
-{
- if (!mPeerConnection->media()) { // PeerConnection closed
- return 0;
- }
- return mType == Local ? mPeerConnection->media()->LocalStreamsLength() :
- mPeerConnection->media()->RemoteStreamsLength();
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/media/webrtc/signaling/src/peerconnection/MediaStreamList.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 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/. */
-
-#ifndef MediaStreamList_h__
-#define MediaStreamList_h__
-
-#include "mozilla/ErrorResult.h"
-#include "nsISupportsImpl.h"
-#include "nsAutoPtr.h"
-#include "nsWrapperCache.h"
-
-#ifdef USE_FAKE_MEDIA_STREAMS
-#include "FakeMediaStreams.h"
-#else
-#include "DOMMediaStream.h"
-#endif
-
-namespace mozilla {
-class PeerConnectionImpl;
-namespace dom {
-
-class MediaStreamList : public nsISupports,
- public nsWrapperCache
-{
-public:
- enum StreamType {
- Local,
- Remote
- };
-
- MediaStreamList(PeerConnectionImpl* peerConnection, StreamType type);
-
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MediaStreamList)
-
- virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
- override;
- nsISupports* GetParentObject();
-
- DOMMediaStream* IndexedGetter(uint32_t index, bool& found);
- uint32_t Length();
-
-private:
- virtual ~MediaStreamList();
-
- RefPtr<PeerConnectionImpl> mPeerConnection;
- StreamType mType;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // MediaStreamList_h__