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

Unified Diff: webrtc/pc/channel.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Revert the change of stun_unittests 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
Index: webrtc/pc/channel.cc
diff --git a/webrtc/pc/channel.cc b/webrtc/pc/channel.cc
index 45141c8d0fd174618f68dd4fbea383ae5081c266..181cc1d8437a4c0b69170ce4d4f926c22f779b94 100644
--- a/webrtc/pc/channel.cc
+++ b/webrtc/pc/channel.cc
@@ -25,7 +25,6 @@
#include "webrtc/media/base/mediaconstants.h"
#include "webrtc/media/base/rtputils.h"
#include "webrtc/p2p/base/packettransportinterface.h"
-#include "webrtc/p2p/base/transportchannel.h"
#include "webrtc/pc/channelmanager.h"
namespace cricket {
@@ -342,9 +341,9 @@ bool BaseChannel::SetTransport_n(const std::string& transport_name) {
}
void BaseChannel::SetTransportChannel_n(bool rtcp,
- TransportChannel* new_channel) {
+ DtlsTransportInternal* new_channel) {
pthatcher1 2017/01/13 22:41:16 We should rename this method to SetTransport or Se
Zhi Huang 2017/01/16 10:38:24 I'll name it "SetTransport_n". Then the "SetTransp
RTC_DCHECK(network_thread_->IsCurrent());
- TransportChannel*& old_channel =
+ DtlsTransportInternal*& old_channel =
rtcp ? rtcp_transport_channel_ : transport_channel_;
if (!old_channel && !new_channel) {
@@ -376,28 +375,28 @@ void BaseChannel::SetTransportChannel_n(bool rtcp,
}
}
-void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) {
+void BaseChannel::ConnectToTransportChannel(DtlsTransportInternal* tc) {
RTC_DCHECK(network_thread_->IsCurrent());
tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState);
tc->SignalReadPacket.connect(this, &BaseChannel::OnPacketRead);
tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend);
tc->SignalDtlsState.connect(this, &BaseChannel::OnDtlsState);
- tc->SignalSelectedCandidatePairChanged.connect(
- this, &BaseChannel::OnSelectedCandidatePairChanged);
tc->SignalSentPacket.connect(this, &BaseChannel::SignalSentPacket_n);
+ tc->ice_transport()->SignalSelectedCandidatePairChanged.connect(
+ this, &BaseChannel::OnSelectedCandidatePairChanged);
}
-void BaseChannel::DisconnectFromTransportChannel(TransportChannel* tc) {
+void BaseChannel::DisconnectFromTransportChannel(DtlsTransportInternal* tc) {
RTC_DCHECK(network_thread_->IsCurrent());
- OnSelectedCandidatePairChanged(tc, nullptr, -1, false);
+ OnSelectedCandidatePairChanged(tc->ice_transport(), nullptr, -1, false);
tc->SignalWritableState.disconnect(this);
tc->SignalReadPacket.disconnect(this);
tc->SignalReadyToSend.disconnect(this);
tc->SignalDtlsState.disconnect(this);
- tc->SignalSelectedCandidatePairChanged.disconnect(this);
tc->SignalSentPacket.disconnect(this);
+ tc->ice_transport()->SignalSelectedCandidatePairChanged.disconnect(this);
}
bool BaseChannel::Enable(bool enable) {
@@ -467,7 +466,7 @@ void BaseChannel::StopConnectionMonitor() {
bool BaseChannel::GetConnectionStats(ConnectionInfos* infos) {
RTC_DCHECK(network_thread_->IsCurrent());
- return transport_channel_->GetStats(infos);
+ return transport_channel_->ice_transport()->GetStats(infos);
}
bool BaseChannel::IsReadyToReceiveMedia_w() const {
@@ -510,7 +509,7 @@ int BaseChannel::SetOption_n(SocketType type,
rtc::Socket::Option opt,
int value) {
RTC_DCHECK(network_thread_->IsCurrent());
- TransportChannel* channel = nullptr;
+ DtlsTransportInternal* channel = nullptr;
switch (type) {
case ST_RTP:
channel = transport_channel_;
@@ -523,7 +522,7 @@ int BaseChannel::SetOption_n(SocketType type,
std::pair<rtc::Socket::Option, int>(opt, value));
break;
}
- return channel ? channel->SetOption(opt, value) : -1;
+ return channel ? channel->ice_transport()->SetOption(opt, value) : -1;
}
bool BaseChannel::SetCryptoOptions(const rtc::CryptoOptions& crypto_options) {
@@ -560,7 +559,7 @@ void BaseChannel::OnReadyToSend(rtc::PacketTransportInterface* transport) {
SetTransportChannelReadyToSend(transport == rtcp_transport_channel_, true);
}
-void BaseChannel::OnDtlsState(TransportChannel* channel,
+void BaseChannel::OnDtlsState(DtlsTransportInternal* channel,
DtlsTransportState state) {
if (!ShouldSetupDtlsSrtp_n()) {
return;
@@ -577,12 +576,12 @@ void BaseChannel::OnDtlsState(TransportChannel* channel,
}
void BaseChannel::OnSelectedCandidatePairChanged(
- TransportChannel* channel,
+ IceTransportInternal* channel,
CandidatePairInterface* selected_candidate_pair,
int last_sent_packet_id,
bool ready_to_send) {
- RTC_DCHECK(channel == transport_channel_ ||
- channel == rtcp_transport_channel_);
+ RTC_DCHECK(channel == transport_channel_->ice_transport() ||
+ channel == rtcp_transport_channel_->ice_transport());
RTC_DCHECK(network_thread_->IsCurrent());
selected_candidate_pair_ = selected_candidate_pair;
std::string transport_name = channel->transport_name();
@@ -651,8 +650,9 @@ bool BaseChannel::SendPacket(bool rtcp,
// packet before doing anything. (We might get RTCP packets that we don't
// intend to send.) If we've negotiated RTCP mux, send RTCP over the RTP
// transport.
- TransportChannel* channel = (!rtcp || rtcp_mux_filter_.IsActive()) ?
- transport_channel_ : rtcp_transport_channel_;
+ DtlsTransportInternal* channel = (!rtcp || rtcp_mux_filter_.IsActive())
+ ? transport_channel_
+ : rtcp_transport_channel_;
if (!channel || !channel->writable()) {
return false;
}
@@ -942,7 +942,8 @@ void BaseChannel::SignalDtlsSrtpSetupFailure_s(bool rtcp) {
SignalDtlsSrtpSetupFailure(this, rtcp);
}
-bool BaseChannel::SetDtlsSrtpCryptoSuites_n(TransportChannel* tc, bool rtcp) {
+bool BaseChannel::SetDtlsSrtpCryptoSuites_n(DtlsTransportInternal* tc,
+ bool rtcp) {
std::vector<int> crypto_suites;
// We always use the default SRTP crypto suites for RTCP, but we may use
// different crypto suites for RTP depending on the media type.
@@ -965,7 +966,7 @@ bool BaseChannel::SetupDtlsSrtp_n(bool rtcp_channel) {
RTC_DCHECK(network_thread_->IsCurrent());
bool ret = false;
- TransportChannel* channel =
+ DtlsTransportInternal* channel =
rtcp_channel ? rtcp_transport_channel_ : transport_channel_;
RTC_DCHECK(channel->IsDtlsActive());
« webrtc/pc/channel.h ('K') | « webrtc/pc/channel.h ('k') | webrtc/pc/channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698