Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Unified Diff: webrtc/api/webrtcsession.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Fix the memory leak. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/rtpsenderreceiver_unittest.cc ('k') | webrtc/api/webrtcsession_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/webrtcsession.cc
diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc
index 8487d2cee11241c5a256334f89a4b674e0308509..e98bcb0e7ae32529fdc7001bb72e91f5e32c4845 100644
--- a/webrtc/api/webrtcsession.cc
+++ b/webrtc/api/webrtcsession.cc
@@ -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);
}
}
« no previous file with comments | « webrtc/api/rtpsenderreceiver_unittest.cc ('k') | webrtc/api/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698