Remove the dependency of TransportChannel and TransportChannelImpl.
DtlsTransportChannelWrapper is renamed to be DtlsTransport which inherits from DtlsTransportInternal. There will be no concept of "channel" in p2p level. Both P2PTransportChannel and DtlsTransport don't depend on TransportChannel and TransportChannelImpl any more and they are removed in this CL. BUG=none Review-Url: https://codereview.webrtc.org/2606123002 Cr-Commit-Position: refs/heads/master@{#16173}
This commit is contained in:
@ -64,8 +64,8 @@ class RtpSenderReceiverTest : public testing::Test {
|
||||
channel_manager_.Init();
|
||||
bool rtcp_mux_required = true;
|
||||
bool srtp_required = true;
|
||||
cricket::TransportChannel* rtp_transport =
|
||||
fake_transport_controller_.CreateTransportChannel(
|
||||
cricket::DtlsTransportInternal* rtp_transport =
|
||||
fake_transport_controller_.CreateDtlsTransport(
|
||||
cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
voice_channel_ = channel_manager_.CreateVoiceChannel(
|
||||
&fake_media_controller_, rtp_transport, nullptr, rtc::Thread::Current(),
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
#include "webrtc/media/base/videocapturer.h"
|
||||
#include "webrtc/media/sctp/sctptransportinternal.h"
|
||||
#include "webrtc/p2p/base/portallocator.h"
|
||||
#include "webrtc/p2p/base/transportchannel.h"
|
||||
#include "webrtc/pc/channel.h"
|
||||
#include "webrtc/pc/channelmanager.h"
|
||||
#include "webrtc/pc/mediasession.h"
|
||||
@ -1082,25 +1081,25 @@ bool WebRtcSession::EnableBundle(const cricket::ContentGroup& bundle) {
|
||||
return true;
|
||||
}
|
||||
|
||||
cricket::TransportChannel* rtp_transport =
|
||||
transport_controller_->CreateTransportChannel(
|
||||
cricket::DtlsTransportInternal* rtp_dtls_transport =
|
||||
transport_controller_->CreateDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
bool need_rtcp = (ch->rtcp_transport() != nullptr);
|
||||
cricket::TransportChannel* rtcp_transport = nullptr;
|
||||
bool need_rtcp = (ch->rtcp_dtls_transport() != nullptr);
|
||||
cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr;
|
||||
if (need_rtcp) {
|
||||
rtcp_transport = transport_controller_->CreateTransportChannel_n(
|
||||
rtcp_dtls_transport = transport_controller_->CreateDtlsTransport_n(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
|
||||
ch->SetTransports(rtp_transport, rtcp_transport);
|
||||
ch->SetTransports(rtp_dtls_transport, rtcp_dtls_transport);
|
||||
LOG(LS_INFO) << "Enabled BUNDLE for " << ch->content_name() << " on "
|
||||
<< transport_name << ".";
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
// If the channel needs rtcp, it means that the channel used to have a
|
||||
// rtcp transport which needs to be deleted now.
|
||||
if (need_rtcp) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
return true;
|
||||
@ -1789,24 +1788,24 @@ bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content,
|
||||
std::string transport_name =
|
||||
bundle_transport ? *bundle_transport : content->name;
|
||||
|
||||
cricket::TransportChannel* rtp_transport =
|
||||
transport_controller_->CreateTransportChannel(
|
||||
cricket::DtlsTransportInternal* rtp_dtls_transport =
|
||||
transport_controller_->CreateDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
cricket::TransportChannel* rtcp_transport = nullptr;
|
||||
cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr;
|
||||
if (!require_rtcp_mux) {
|
||||
rtcp_transport = transport_controller_->CreateTransportChannel(
|
||||
rtcp_dtls_transport = transport_controller_->CreateDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
|
||||
voice_channel_.reset(channel_manager_->CreateVoiceChannel(
|
||||
media_controller_, rtp_transport, rtcp_transport,
|
||||
media_controller_, rtp_dtls_transport, rtcp_dtls_transport,
|
||||
transport_controller_->signaling_thread(), content->name,
|
||||
bundle_transport, require_rtcp_mux, SrtpRequired(), audio_options_));
|
||||
if (!voice_channel_) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
if (rtcp_transport) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
if (rtcp_dtls_transport) {
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
}
|
||||
return false;
|
||||
@ -1831,25 +1830,25 @@ bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content,
|
||||
std::string transport_name =
|
||||
bundle_transport ? *bundle_transport : content->name;
|
||||
|
||||
cricket::TransportChannel* rtp_transport =
|
||||
transport_controller_->CreateTransportChannel(
|
||||
cricket::DtlsTransportInternal* rtp_dtls_transport =
|
||||
transport_controller_->CreateDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
cricket::TransportChannel* rtcp_transport = nullptr;
|
||||
cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr;
|
||||
if (!require_rtcp_mux) {
|
||||
rtcp_transport = transport_controller_->CreateTransportChannel(
|
||||
rtcp_dtls_transport = transport_controller_->CreateDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
|
||||
video_channel_.reset(channel_manager_->CreateVideoChannel(
|
||||
media_controller_, rtp_transport, rtcp_transport,
|
||||
media_controller_, rtp_dtls_transport, rtcp_dtls_transport,
|
||||
transport_controller_->signaling_thread(), content->name,
|
||||
bundle_transport, require_rtcp_mux, SrtpRequired(), video_options_));
|
||||
|
||||
if (!video_channel_) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
if (rtcp_transport) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
if (rtcp_dtls_transport) {
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
}
|
||||
return false;
|
||||
@ -1873,7 +1872,7 @@ bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content,
|
||||
#ifdef HAVE_QUIC
|
||||
if (data_channel_type_ == cricket::DCT_QUIC) {
|
||||
RTC_DCHECK(transport_controller_->quic());
|
||||
quic_data_transport_->SetTransport(transport_name);
|
||||
quic_data_transport_->SetTransports(transport_name);
|
||||
return true;
|
||||
}
|
||||
#endif // HAVE_QUIC
|
||||
@ -1896,25 +1895,25 @@ bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content,
|
||||
|
||||
std::string transport_name =
|
||||
bundle_transport ? *bundle_transport : content->name;
|
||||
cricket::TransportChannel* rtp_transport =
|
||||
transport_controller_->CreateTransportChannel(
|
||||
cricket::DtlsTransportInternal* rtp_dtls_transport =
|
||||
transport_controller_->CreateDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
cricket::TransportChannel* rtcp_transport = nullptr;
|
||||
cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr;
|
||||
if (!require_rtcp_mux) {
|
||||
rtcp_transport = transport_controller_->CreateTransportChannel(
|
||||
rtcp_dtls_transport = transport_controller_->CreateDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
|
||||
rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel(
|
||||
media_controller_, rtp_transport, rtcp_transport,
|
||||
media_controller_, rtp_dtls_transport, rtcp_dtls_transport,
|
||||
transport_controller_->signaling_thread(), content->name,
|
||||
bundle_transport, require_rtcp_mux, SrtpRequired()));
|
||||
|
||||
if (!rtp_data_channel_) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
if (rtcp_transport) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
if (rtcp_dtls_transport) {
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
}
|
||||
return false;
|
||||
@ -1959,8 +1958,8 @@ bool WebRtcSession::CreateSctpTransport_n(const std::string& content_name,
|
||||
const std::string& transport_name) {
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
RTC_DCHECK(sctp_factory_);
|
||||
cricket::TransportChannel* tc =
|
||||
transport_controller_->CreateTransportChannel_n(
|
||||
cricket::DtlsTransportInternal* tc =
|
||||
transport_controller_->CreateDtlsTransport_n(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
sctp_transport_ = sctp_factory_->CreateSctpTransport(tc);
|
||||
RTC_DCHECK(sctp_transport_);
|
||||
@ -1982,11 +1981,11 @@ void WebRtcSession::ChangeSctpTransport_n(const std::string& transport_name) {
|
||||
RTC_DCHECK(sctp_transport_name_);
|
||||
std::string old_sctp_transport_name = *sctp_transport_name_;
|
||||
sctp_transport_name_ = rtc::Optional<std::string>(transport_name);
|
||||
cricket::TransportChannel* tc =
|
||||
transport_controller_->CreateTransportChannel_n(
|
||||
cricket::DtlsTransportInternal* tc =
|
||||
transport_controller_->CreateDtlsTransport_n(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
sctp_transport_->SetTransportChannel(tc);
|
||||
transport_controller_->DestroyTransportChannel_n(
|
||||
transport_controller_->DestroyDtlsTransport_n(
|
||||
old_sctp_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
}
|
||||
|
||||
@ -2383,51 +2382,52 @@ const std::string WebRtcSession::GetTransportName(
|
||||
|
||||
void WebRtcSession::DestroyRtcpTransport_n(const std::string& transport_name) {
|
||||
RTC_DCHECK(network_thread()->IsCurrent());
|
||||
transport_controller_->DestroyTransportChannel_n(
|
||||
transport_controller_->DestroyDtlsTransport_n(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
|
||||
void WebRtcSession::DestroyVideoChannel() {
|
||||
SignalVideoChannelDestroyed();
|
||||
RTC_DCHECK(video_channel_->rtp_transport());
|
||||
RTC_DCHECK(video_channel_->rtp_dtls_transport());
|
||||
std::string transport_name;
|
||||
transport_name = video_channel_->rtp_transport()->transport_name();
|
||||
bool need_to_delete_rtcp = (video_channel_->rtcp_transport() != nullptr);
|
||||
transport_name = video_channel_->rtp_dtls_transport()->transport_name();
|
||||
bool need_to_delete_rtcp = (video_channel_->rtcp_dtls_transport() != nullptr);
|
||||
channel_manager_->DestroyVideoChannel(video_channel_.release());
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
if (need_to_delete_rtcp) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
}
|
||||
|
||||
void WebRtcSession::DestroyVoiceChannel() {
|
||||
SignalVoiceChannelDestroyed();
|
||||
RTC_DCHECK(voice_channel_->rtp_transport());
|
||||
RTC_DCHECK(voice_channel_->rtp_dtls_transport());
|
||||
std::string transport_name;
|
||||
transport_name = voice_channel_->rtp_transport()->transport_name();
|
||||
bool need_to_delete_rtcp = (voice_channel_->rtcp_transport() != nullptr);
|
||||
transport_name = voice_channel_->rtp_dtls_transport()->transport_name();
|
||||
bool need_to_delete_rtcp = (voice_channel_->rtcp_dtls_transport() != nullptr);
|
||||
channel_manager_->DestroyVoiceChannel(voice_channel_.release());
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
if (need_to_delete_rtcp) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
}
|
||||
|
||||
void WebRtcSession::DestroyDataChannel() {
|
||||
SignalDataChannelDestroyed();
|
||||
RTC_DCHECK(rtp_data_channel_->rtp_transport());
|
||||
RTC_DCHECK(rtp_data_channel_->rtp_dtls_transport());
|
||||
std::string transport_name;
|
||||
transport_name = rtp_data_channel_->rtp_transport()->transport_name();
|
||||
bool need_to_delete_rtcp = (rtp_data_channel_->rtcp_transport() != nullptr);
|
||||
transport_name = rtp_data_channel_->rtp_dtls_transport()->transport_name();
|
||||
bool need_to_delete_rtcp =
|
||||
(rtp_data_channel_->rtcp_dtls_transport() != nullptr);
|
||||
channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release());
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||
if (need_to_delete_rtcp) {
|
||||
transport_controller_->DestroyTransportChannel(
|
||||
transport_controller_->DestroyDtlsTransport(
|
||||
transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
#include "webrtc/p2p/base/stunserver.h"
|
||||
#include "webrtc/p2p/base/teststunserver.h"
|
||||
#include "webrtc/p2p/base/testturnserver.h"
|
||||
#include "webrtc/p2p/base/transportchannel.h"
|
||||
#include "webrtc/p2p/client/basicportallocator.h"
|
||||
#include "webrtc/pc/channelmanager.h"
|
||||
#include "webrtc/pc/mediasession.h"
|
||||
@ -219,7 +218,7 @@ class MockIceObserver : public webrtc::IceObserver {
|
||||
// local/remote ports.
|
||||
class FakeSctpTransport : public cricket::SctpTransportInternal {
|
||||
public:
|
||||
void SetTransportChannel(cricket::TransportChannel* channel) override {}
|
||||
void SetTransportChannel(rtc::PacketTransportInterface* channel) override {}
|
||||
bool Start(int local_port, int remote_port) override {
|
||||
local_port_ = local_port;
|
||||
remote_port_ = remote_port;
|
||||
@ -246,7 +245,7 @@ class FakeSctpTransport : public cricket::SctpTransportInternal {
|
||||
class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory {
|
||||
public:
|
||||
std::unique_ptr<cricket::SctpTransportInternal> CreateSctpTransport(
|
||||
cricket::TransportChannel*) override {
|
||||
rtc::PacketTransportInterface*) override {
|
||||
last_fake_sctp_transport_ = new FakeSctpTransport();
|
||||
return std::unique_ptr<cricket::SctpTransportInternal>(
|
||||
last_fake_sctp_transport_);
|
||||
@ -306,7 +305,7 @@ class WebRtcSessionForTest : public webrtc::WebRtcSession {
|
||||
if (!ch) {
|
||||
return nullptr;
|
||||
}
|
||||
return ch->rtp_transport();
|
||||
return ch->rtp_dtls_transport();
|
||||
}
|
||||
|
||||
rtc::PacketTransportInterface* rtcp_transport_channel(
|
||||
@ -314,7 +313,7 @@ class WebRtcSessionForTest : public webrtc::WebRtcSession {
|
||||
if (!ch) {
|
||||
return nullptr;
|
||||
}
|
||||
return ch->rtcp_transport();
|
||||
return ch->rtcp_dtls_transport();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user