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

Unified Diff: webrtc/pc/channel.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Merge 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 56335e24d085c74c37050233eb6ca6b73b75adaa..0122df99ffbdd79119a133e91fd3a8feac765a37 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) {
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) {
@@ -547,6 +546,8 @@ void BaseChannel::OnPacketRead(rtc::PacketTransportInterface* transport,
// OnPacketRead gets called from P2PSocket; now pass data to MediaEngine
RTC_DCHECK(network_thread_->IsCurrent());
+ LOG(INFO) << "data: " << (long)data << " len " << len << " from "
+ << transport;
Taylor Brandstetter 2017/01/10 19:43:47 Leftover debug message
Zhi Huang 2017/01/12 20:04:12 Done.
// When using RTCP multiplexing we might get RTCP packets on the RTP
// transport. We feed RTP traffic into the demuxer to determine if it is RTCP.
bool rtcp = PacketIsRtcp(transport, data, len);
@@ -560,7 +561,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 +578,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 +652,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;
}
@@ -793,6 +795,7 @@ void BaseChannel::HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet,
int len = static_cast<int>(packet->size());
bool res;
if (!rtcp) {
+ LOG(INFO) << __FUNCTION__ << " " << (long)data;
Taylor Brandstetter 2017/01/10 19:43:47 Also here
Zhi Huang 2017/01/12 20:04:12 Done.
res = srtp_filter_.UnprotectRtp(data, len, &len);
if (!res) {
int seq_num = -1;
@@ -942,7 +945,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 +969,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());

Powered by Google App Engine
This is Rietveld 408576698