aboutsummaryrefslogtreecommitdiff
path: root/pc
diff options
context:
space:
mode:
authorNiels Möller <nisse@webrtc.org>2020-07-14 13:21:42 +0200
committerCommit Bot <commit-bot@chromium.org>2020-07-15 06:54:06 +0000
commitc888ffa57f30d90162823fdc2e4c9e312558ea15 (patch)
tree326608e9e63ba46418f27b2754c768dfe097c4ab /pc
parent121f32c94a0e4fdc84cca763aa8a63336ac8d9b9 (diff)
downloadwebrtc-c888ffa57f30d90162823fdc2e4c9e312558ea15.tar.gz
Delete CompositeDataChannelTransport
And delete the always null members data_channel_transport_ and composite_data_channel_transport_ from the JsepTransport class. Bug: webrtc:9719 Change-Id: Ibfd92b74708d63a75521f6f1d5fbc3830bd67e20 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179280 Reviewed-by: Taylor <deadbeef@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31727}
Diffstat (limited to 'pc')
-rw-r--r--pc/BUILD.gn2
-rw-r--r--pc/composite_data_channel_transport.cc123
-rw-r--r--pc/composite_data_channel_transport.h63
-rw-r--r--pc/jsep_transport.cc7
-rw-r--r--pc/jsep_transport.h19
5 files changed, 5 insertions, 209 deletions
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index 531db6831e..6b07bbe74e 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -32,8 +32,6 @@ rtc_library("rtc_pc_base") {
"channel_interface.h",
"channel_manager.cc",
"channel_manager.h",
- "composite_data_channel_transport.cc",
- "composite_data_channel_transport.h",
"composite_rtp_transport.cc",
"composite_rtp_transport.h",
"dtls_srtp_transport.cc",
diff --git a/pc/composite_data_channel_transport.cc b/pc/composite_data_channel_transport.cc
deleted file mode 100644
index e66febc12b..0000000000
--- a/pc/composite_data_channel_transport.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2019 The WebRTC Project Authors. All rights reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "pc/composite_data_channel_transport.h"
-
-#include <utility>
-
-#include "absl/algorithm/container.h"
-
-namespace webrtc {
-
-CompositeDataChannelTransport::CompositeDataChannelTransport(
- std::vector<DataChannelTransportInterface*> transports)
- : transports_(std::move(transports)) {
- for (auto transport : transports_) {
- transport->SetDataSink(this);
- }
-}
-
-CompositeDataChannelTransport::~CompositeDataChannelTransport() {
- for (auto transport : transports_) {
- transport->SetDataSink(nullptr);
- }
-}
-
-void CompositeDataChannelTransport::SetSendTransport(
- DataChannelTransportInterface* send_transport) {
- if (!absl::c_linear_search(transports_, send_transport)) {
- return;
- }
- send_transport_ = send_transport;
- // NB: OnReadyToSend() checks if we're actually ready to send, and signals
- // |sink_| if appropriate. This signal is required upon setting the sink.
- OnReadyToSend();
-}
-
-void CompositeDataChannelTransport::RemoveTransport(
- DataChannelTransportInterface* transport) {
- RTC_DCHECK(transport != send_transport_) << "Cannot remove send transport";
-
- auto it = absl::c_find(transports_, transport);
- if (it == transports_.end()) {
- return;
- }
-
- transport->SetDataSink(nullptr);
- transports_.erase(it);
-}
-
-RTCError CompositeDataChannelTransport::OpenChannel(int channel_id) {
- RTCError error = RTCError::OK();
- for (auto transport : transports_) {
- RTCError e = transport->OpenChannel(channel_id);
- if (!e.ok()) {
- error = std::move(e);
- }
- }
- return error;
-}
-
-RTCError CompositeDataChannelTransport::SendData(
- int channel_id,
- const SendDataParams& params,
- const rtc::CopyOnWriteBuffer& buffer) {
- if (send_transport_) {
- return send_transport_->SendData(channel_id, params, buffer);
- }
- return RTCError(RTCErrorType::NETWORK_ERROR, "Send transport is not ready");
-}
-
-RTCError CompositeDataChannelTransport::CloseChannel(int channel_id) {
- if (send_transport_) {
- return send_transport_->CloseChannel(channel_id);
- }
- return RTCError(RTCErrorType::NETWORK_ERROR, "Send transport is not ready");
-}
-
-void CompositeDataChannelTransport::SetDataSink(DataChannelSink* sink) {
- sink_ = sink;
- // NB: OnReadyToSend() checks if we're actually ready to send, and signals
- // |sink_| if appropriate. This signal is required upon setting the sink.
- OnReadyToSend();
-}
-
-bool CompositeDataChannelTransport::IsReadyToSend() const {
- return send_transport_ && send_transport_->IsReadyToSend();
-}
-
-void CompositeDataChannelTransport::OnDataReceived(
- int channel_id,
- DataMessageType type,
- const rtc::CopyOnWriteBuffer& buffer) {
- if (sink_) {
- sink_->OnDataReceived(channel_id, type, buffer);
- }
-}
-
-void CompositeDataChannelTransport::OnChannelClosing(int channel_id) {
- if (sink_) {
- sink_->OnChannelClosing(channel_id);
- }
-}
-
-void CompositeDataChannelTransport::OnChannelClosed(int channel_id) {
- if (sink_) {
- sink_->OnChannelClosed(channel_id);
- }
-}
-
-void CompositeDataChannelTransport::OnReadyToSend() {
- if (sink_ && send_transport_ && send_transport_->IsReadyToSend()) {
- sink_->OnReadyToSend();
- }
-}
-
-} // namespace webrtc
diff --git a/pc/composite_data_channel_transport.h b/pc/composite_data_channel_transport.h
deleted file mode 100644
index 97633cb6ed..0000000000
--- a/pc/composite_data_channel_transport.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2019 The WebRTC Project Authors. All rights reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef PC_COMPOSITE_DATA_CHANNEL_TRANSPORT_H_
-#define PC_COMPOSITE_DATA_CHANNEL_TRANSPORT_H_
-
-#include <vector>
-
-#include "api/transport/data_channel_transport_interface.h"
-#include "rtc_base/critical_section.h"
-
-namespace webrtc {
-
-// Composite implementation of DataChannelTransportInterface. Allows users to
-// receive data channel messages over multiple transports and send over one of
-// those transports.
-class CompositeDataChannelTransport : public DataChannelTransportInterface,
- public DataChannelSink {
- public:
- explicit CompositeDataChannelTransport(
- std::vector<DataChannelTransportInterface*> transports);
- ~CompositeDataChannelTransport() override;
-
- // Specifies which transport to be used for sending. Must be called before
- // sending data.
- void SetSendTransport(DataChannelTransportInterface* send_transport);
-
- // Removes a given transport from the composite, if present.
- void RemoveTransport(DataChannelTransportInterface* transport);
-
- // DataChannelTransportInterface overrides.
- RTCError OpenChannel(int channel_id) override;
- RTCError SendData(int channel_id,
- const SendDataParams& params,
- const rtc::CopyOnWriteBuffer& buffer) override;
- RTCError CloseChannel(int channel_id) override;
- void SetDataSink(DataChannelSink* sink) override;
- bool IsReadyToSend() const override;
-
- // DataChannelSink overrides.
- void OnDataReceived(int channel_id,
- DataMessageType type,
- const rtc::CopyOnWriteBuffer& buffer) override;
- void OnChannelClosing(int channel_id) override;
- void OnChannelClosed(int channel_id) override;
- void OnReadyToSend() override;
-
- private:
- std::vector<DataChannelTransportInterface*> transports_;
- DataChannelTransportInterface* send_transport_ = nullptr;
- DataChannelSink* sink_ = nullptr;
-};
-
-} // namespace webrtc
-
-#endif // PC_COMPOSITE_DATA_CHANNEL_TRANSPORT_H_
diff --git a/pc/jsep_transport.cc b/pc/jsep_transport.cc
index 91e6576830..2f7615ab3b 100644
--- a/pc/jsep_transport.cc
+++ b/pc/jsep_transport.cc
@@ -134,13 +134,6 @@ JsepTransport::JsepTransport(
std::vector<webrtc::RtpTransportInternal*>{
datagram_rtp_transport_.get(), default_rtp_transport()});
}
-
- if (data_channel_transport_ && sctp_data_channel_transport_) {
- composite_data_channel_transport_ =
- std::make_unique<webrtc::CompositeDataChannelTransport>(
- std::vector<webrtc::DataChannelTransportInterface*>{
- data_channel_transport_, sctp_data_channel_transport_.get()});
- }
}
JsepTransport::~JsepTransport() {
diff --git a/pc/jsep_transport.h b/pc/jsep_transport.h
index 7342c19888..3fa6243e4c 100644
--- a/pc/jsep_transport.h
+++ b/pc/jsep_transport.h
@@ -20,11 +20,11 @@
#include "api/candidate.h"
#include "api/ice_transport_interface.h"
#include "api/jsep.h"
+#include "api/transport/data_channel_transport_interface.h"
#include "media/sctp/sctp_transport_internal.h"
#include "p2p/base/dtls_transport.h"
#include "p2p/base/p2p_constants.h"
#include "p2p/base/transport_info.h"
-#include "pc/composite_data_channel_transport.h"
#include "pc/composite_rtp_transport.h"
#include "pc/dtls_srtp_transport.h"
#include "pc/dtls_transport.h"
@@ -218,15 +218,15 @@ class JsepTransport : public sigslot::has_slots<> {
return sctp_transport_;
}
+ // TODO(bugs.webrtc.org/9719): Delete method, update callers to use
+ // SctpTransport() instead.
webrtc::DataChannelTransportInterface* data_channel_transport() const
RTC_LOCKS_EXCLUDED(accessor_lock_) {
rtc::CritScope scope(&accessor_lock_);
- if (composite_data_channel_transport_) {
- return composite_data_channel_transport_.get();
- } else if (sctp_data_channel_transport_) {
+ if (sctp_data_channel_transport_) {
return sctp_data_channel_transport_.get();
}
- return data_channel_transport_;
+ return nullptr;
}
// This is signaled when RTCP-mux becomes active and
@@ -381,15 +381,6 @@ class JsepTransport : public sigslot::has_slots<> {
std::unique_ptr<webrtc::RtpTransportInternal> datagram_rtp_transport_
RTC_GUARDED_BY(accessor_lock_);
- // Non-SCTP data channel transport. Set to |datagram_transport_| if that
- // transport should be used for data chanels. Unset otherwise.
- webrtc::DataChannelTransportInterface* data_channel_transport_
- RTC_GUARDED_BY(accessor_lock_) = nullptr;
-
- // Composite data channel transport, used during negotiation.
- std::unique_ptr<webrtc::CompositeDataChannelTransport>
- composite_data_channel_transport_ RTC_GUARDED_BY(accessor_lock_);
-
RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransport);
};