Rename "PacketTransportInterface" to "PacketTransportInternal".
This is the naming scheme we've been using for internal interfaces. Also, this CL will introduce a PacketTransportInterface in the webrtc namespace, which would get too easily confused with the rtc:: one: https://codereview.webrtc.org/2675173003/ BUG=None Review-Url: https://codereview.webrtc.org/2679103006 Cr-Commit-Position: refs/heads/master@{#16539}
This commit is contained in:
parent
640a200e3d
commit
5bd5ca344e
@ -385,7 +385,7 @@ class SctpTransport::UsrSctpWrapper {
|
||||
};
|
||||
|
||||
SctpTransport::SctpTransport(rtc::Thread* network_thread,
|
||||
rtc::PacketTransportInterface* channel)
|
||||
rtc::PacketTransportInternal* channel)
|
||||
: network_thread_(network_thread),
|
||||
transport_channel_(channel),
|
||||
was_ever_writable_(channel->writable()) {
|
||||
@ -400,8 +400,7 @@ SctpTransport::~SctpTransport() {
|
||||
CloseSctpSocket();
|
||||
}
|
||||
|
||||
void SctpTransport::SetTransportChannel(
|
||||
rtc::PacketTransportInterface* channel) {
|
||||
void SctpTransport::SetTransportChannel(rtc::PacketTransportInternal* channel) {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
RTC_DCHECK(channel);
|
||||
DisconnectTransportChannelSignals();
|
||||
@ -808,7 +807,7 @@ void SctpTransport::SetReadyToSendData() {
|
||||
}
|
||||
}
|
||||
|
||||
void SctpTransport::OnWritableState(rtc::PacketTransportInterface* transport) {
|
||||
void SctpTransport::OnWritableState(rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
RTC_DCHECK_EQ(transport_channel_, transport);
|
||||
if (!was_ever_writable_ && transport->writable()) {
|
||||
@ -820,7 +819,7 @@ void SctpTransport::OnWritableState(rtc::PacketTransportInterface* transport) {
|
||||
}
|
||||
|
||||
// Called by network interface when a packet has been received.
|
||||
void SctpTransport::OnPacketRead(rtc::PacketTransportInterface* transport,
|
||||
void SctpTransport::OnPacketRead(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& packet_time,
|
||||
|
||||
@ -67,11 +67,11 @@ class SctpTransport : public SctpTransportInternal,
|
||||
// methods can be called.
|
||||
// |channel| is required (must not be null).
|
||||
SctpTransport(rtc::Thread* network_thread,
|
||||
rtc::PacketTransportInterface* channel);
|
||||
rtc::PacketTransportInternal* channel);
|
||||
~SctpTransport() override;
|
||||
|
||||
// SctpTransportInternal overrides (see sctptransportinternal.h for comments).
|
||||
void SetTransportChannel(rtc::PacketTransportInterface* channel) override;
|
||||
void SetTransportChannel(rtc::PacketTransportInternal* channel) override;
|
||||
bool Start(int local_port, int remote_port) override;
|
||||
bool OpenStream(int sid) override;
|
||||
bool ResetStream(int sid) override;
|
||||
@ -108,8 +108,8 @@ class SctpTransport : public SctpTransportInternal,
|
||||
void SetReadyToSendData();
|
||||
|
||||
// Callbacks from DTLS channel.
|
||||
void OnWritableState(rtc::PacketTransportInterface* transport);
|
||||
virtual void OnPacketRead(rtc::PacketTransportInterface* transport,
|
||||
void OnWritableState(rtc::PacketTransportInternal* transport);
|
||||
virtual void OnPacketRead(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& packet_time,
|
||||
@ -140,7 +140,7 @@ class SctpTransport : public SctpTransportInternal,
|
||||
// Helps pass inbound/outbound packets asynchronously to the network thread.
|
||||
rtc::AsyncInvoker invoker_;
|
||||
// Underlying DTLS channel.
|
||||
rtc::PacketTransportInterface* transport_channel_;
|
||||
rtc::PacketTransportInternal* transport_channel_;
|
||||
bool was_ever_writable_ = false;
|
||||
int local_port_ = kSctpDefaultPort;
|
||||
int remote_port_ = kSctpDefaultPort;
|
||||
@ -179,7 +179,7 @@ class SctpTransportFactory : public SctpTransportInternalFactory {
|
||||
: network_thread_(network_thread) {}
|
||||
|
||||
std::unique_ptr<SctpTransportInternal> CreateSctpTransport(
|
||||
rtc::PacketTransportInterface* channel) override {
|
||||
rtc::PacketTransportInternal* channel) override {
|
||||
return std::unique_ptr<SctpTransportInternal>(
|
||||
new SctpTransport(network_thread_, channel));
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
// TODO(deadbeef): Use something else for SCTP. It's confusing that we use an
|
||||
// SSRC field for SID.
|
||||
#include "webrtc/media/base/mediachannel.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
@ -58,7 +58,7 @@ class SctpTransportInternal {
|
||||
// Changes what underlying DTLS channel is uses. Used when switching which
|
||||
// bundled transport the SctpTransport uses.
|
||||
// Assumes |channel| is non-null.
|
||||
virtual void SetTransportChannel(rtc::PacketTransportInterface* channel) = 0;
|
||||
virtual void SetTransportChannel(rtc::PacketTransportInternal* channel) = 0;
|
||||
|
||||
// When Start is called, connects as soon as possible; this can be called
|
||||
// before DTLS completes, in which case the connection will begin when DTLS
|
||||
@ -129,7 +129,7 @@ class SctpTransportInternalFactory {
|
||||
|
||||
// Create an SCTP transport using |channel| for the underlying transport.
|
||||
virtual std::unique_ptr<SctpTransportInternal> CreateSctpTransport(
|
||||
rtc::PacketTransportInterface* channel) = 0;
|
||||
rtc::PacketTransportInternal* channel) = 0;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -39,6 +39,7 @@ rtc_static_library("rtc_p2p") {
|
||||
"base/p2ptransportchannel.h",
|
||||
"base/packetsocketfactory.h",
|
||||
"base/packettransportinterface.h",
|
||||
"base/packettransportinternal.h",
|
||||
"base/port.cc",
|
||||
"base/port.h",
|
||||
"base/portallocator.cc",
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include "webrtc/p2p/base/dtlstransportchannel.h"
|
||||
|
||||
#include "webrtc/p2p/base/common.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
#include "webrtc/base/buffer.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/dscp.h"
|
||||
@ -427,7 +427,7 @@ bool DtlsTransport::IsDtlsConnected() {
|
||||
// start the DTLS handshake
|
||||
// - Once the DTLS handshake completes, the state is that of the
|
||||
// impl again
|
||||
void DtlsTransport::OnWritableState(rtc::PacketTransportInterface* transport) {
|
||||
void DtlsTransport::OnWritableState(rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK(rtc::Thread::Current() == network_thread_);
|
||||
RTC_DCHECK(transport == ice_transport_);
|
||||
LOG_J(LS_VERBOSE, this)
|
||||
@ -459,7 +459,7 @@ void DtlsTransport::OnWritableState(rtc::PacketTransportInterface* transport) {
|
||||
}
|
||||
}
|
||||
|
||||
void DtlsTransport::OnReceivingState(rtc::PacketTransportInterface* transport) {
|
||||
void DtlsTransport::OnReceivingState(rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK(rtc::Thread::Current() == network_thread_);
|
||||
RTC_DCHECK(transport == ice_transport_);
|
||||
LOG_J(LS_VERBOSE, this) << "DTLSTransportChannelWrapper: ice_transport "
|
||||
@ -471,7 +471,7 @@ void DtlsTransport::OnReceivingState(rtc::PacketTransportInterface* transport) {
|
||||
}
|
||||
}
|
||||
|
||||
void DtlsTransport::OnReadPacket(rtc::PacketTransportInterface* transport,
|
||||
void DtlsTransport::OnReadPacket(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t size,
|
||||
const rtc::PacketTime& packet_time,
|
||||
@ -549,14 +549,14 @@ void DtlsTransport::OnReadPacket(rtc::PacketTransportInterface* transport,
|
||||
}
|
||||
}
|
||||
|
||||
void DtlsTransport::OnSentPacket(rtc::PacketTransportInterface* transport,
|
||||
void DtlsTransport::OnSentPacket(rtc::PacketTransportInternal* transport,
|
||||
const rtc::SentPacket& sent_packet) {
|
||||
RTC_DCHECK(rtc::Thread::Current() == network_thread_);
|
||||
|
||||
SignalSentPacket(this, sent_packet);
|
||||
}
|
||||
|
||||
void DtlsTransport::OnReadyToSend(rtc::PacketTransportInterface* transport) {
|
||||
void DtlsTransport::OnReadyToSend(rtc::PacketTransportInternal* transport) {
|
||||
if (writable()) {
|
||||
SignalReadyToSend(this);
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#include "webrtc/p2p/base/icetransportinternal.h"
|
||||
|
||||
namespace rtc {
|
||||
class PacketTransportInterface;
|
||||
class PacketTransportInternal;
|
||||
}
|
||||
|
||||
namespace cricket {
|
||||
@ -192,16 +192,16 @@ class DtlsTransport : public DtlsTransportInternal {
|
||||
}
|
||||
|
||||
private:
|
||||
void OnWritableState(rtc::PacketTransportInterface* transport);
|
||||
void OnReadPacket(rtc::PacketTransportInterface* transport,
|
||||
void OnWritableState(rtc::PacketTransportInternal* transport);
|
||||
void OnReadPacket(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t size,
|
||||
const rtc::PacketTime& packet_time,
|
||||
int flags);
|
||||
void OnSentPacket(rtc::PacketTransportInterface* transport,
|
||||
void OnSentPacket(rtc::PacketTransportInternal* transport,
|
||||
const rtc::SentPacket& sent_packet);
|
||||
void OnReadyToSend(rtc::PacketTransportInterface* transport);
|
||||
void OnReceivingState(rtc::PacketTransportInterface* transport);
|
||||
void OnReadyToSend(rtc::PacketTransportInternal* transport);
|
||||
void OnReceivingState(rtc::PacketTransportInternal* transport);
|
||||
void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err);
|
||||
bool SetupDtls();
|
||||
void MaybeStartDtls();
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include "webrtc/p2p/base/dtlstransportchannel.h"
|
||||
#include "webrtc/p2p/base/fakeicetransport.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/dscp.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
@ -378,12 +378,12 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
|
||||
// Transport channel callbacks
|
||||
void OnTransportChannelWritableState(
|
||||
rtc::PacketTransportInterface* transport) {
|
||||
rtc::PacketTransportInternal* transport) {
|
||||
LOG(LS_INFO) << name_ << ": Channel '" << transport->debug_name()
|
||||
<< "' is writable";
|
||||
}
|
||||
|
||||
void OnTransportChannelReadPacket(rtc::PacketTransportInterface* transport,
|
||||
void OnTransportChannelReadPacket(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t size,
|
||||
const rtc::PacketTime& packet_time,
|
||||
@ -397,7 +397,7 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
ASSERT_EQ(expected_flags, flags);
|
||||
}
|
||||
|
||||
void OnTransportChannelSentPacket(rtc::PacketTransportInterface* transport,
|
||||
void OnTransportChannelSentPacket(rtc::PacketTransportInternal* transport,
|
||||
const rtc::SentPacket& sent_packet) {
|
||||
sent_packet_ = sent_packet;
|
||||
}
|
||||
@ -405,12 +405,11 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
rtc::SentPacket sent_packet() const { return sent_packet_; }
|
||||
|
||||
// Hook into the raw packet stream to make sure DTLS packets are encrypted.
|
||||
void OnFakeTransportChannelReadPacket(
|
||||
rtc::PacketTransportInterface* transport,
|
||||
const char* data,
|
||||
size_t size,
|
||||
const rtc::PacketTime& time,
|
||||
int flags) {
|
||||
void OnFakeTransportChannelReadPacket(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t size,
|
||||
const rtc::PacketTime& time,
|
||||
int flags) {
|
||||
// Flags shouldn't be set on the underlying TransportChannel packets.
|
||||
ASSERT_EQ(0, flags);
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "webrtc/base/sslstreamadapter.h"
|
||||
#include "webrtc/p2p/base/icetransportinternal.h"
|
||||
#include "webrtc/p2p/base/jseptransport.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
@ -32,7 +32,7 @@ enum PacketFlags {
|
||||
// Once the public interface is supported,
|
||||
// (https://www.w3.org/TR/webrtc/#rtcdtlstransport-interface)
|
||||
// the DtlsTransportInterface will be split from this class.
|
||||
class DtlsTransportInternal : public rtc::PacketTransportInterface {
|
||||
class DtlsTransportInternal : public rtc::PacketTransportInternal {
|
||||
public:
|
||||
virtual ~DtlsTransportInternal() {}
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ class FakeDtlsTransport : public DtlsTransportInternal {
|
||||
|
||||
IceTransportInternal* ice_transport() override { return ice_transport_; }
|
||||
|
||||
// PacketTransportInterface implementation, which passes through to fake ICE
|
||||
// PacketTransportInternal implementation, which passes through to fake ICE
|
||||
// transport for sending actual packets.
|
||||
bool writable() const override { return writable_; }
|
||||
bool receiving() const override { return receiving_; }
|
||||
@ -205,7 +205,7 @@ class FakeDtlsTransport : public DtlsTransportInternal {
|
||||
int GetError() override { return ice_transport_->GetError(); }
|
||||
|
||||
private:
|
||||
void OnIceTransportReadPacket(PacketTransportInterface* ice_,
|
||||
void OnIceTransportReadPacket(PacketTransportInternal* ice_,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& time,
|
||||
|
||||
@ -158,7 +158,7 @@ class FakeIceTransport : public IceTransportInternal {
|
||||
void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override {
|
||||
}
|
||||
|
||||
// Fake PacketTransportInterface implementation.
|
||||
// Fake PacketTransportInternal implementation.
|
||||
bool writable() const override { return writable_; }
|
||||
bool receiving() const override { return receiving_; }
|
||||
int SendPacket(const char* data,
|
||||
|
||||
@ -15,12 +15,12 @@
|
||||
|
||||
#include "webrtc/base/asyncinvoker.h"
|
||||
#include "webrtc/base/copyonwritebuffer.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Used to simulate a packet-based transport.
|
||||
class FakePacketTransport : public PacketTransportInterface {
|
||||
class FakePacketTransport : public PacketTransportInternal {
|
||||
public:
|
||||
explicit FakePacketTransport(const std::string& debug_name)
|
||||
: debug_name_(debug_name) {}
|
||||
@ -57,7 +57,7 @@ class FakePacketTransport : public PacketTransportInterface {
|
||||
}
|
||||
}
|
||||
|
||||
// Fake PacketTransportInterface implementation.
|
||||
// Fake PacketTransportInternal implementation.
|
||||
std::string debug_name() const override { return debug_name_; }
|
||||
bool writable() const override { return writable_; }
|
||||
bool receiving() const override { return receiving_; }
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include "webrtc/p2p/base/candidate.h"
|
||||
#include "webrtc/p2p/base/candidatepairinterface.h"
|
||||
#include "webrtc/p2p/base/jseptransport.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
#include "webrtc/p2p/base/transportdescription.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -47,7 +47,7 @@ enum IceProtocolType {
|
||||
// Once the public interface is supported,
|
||||
// (https://www.w3.org/TR/webrtc/#rtcicetransport-interface)
|
||||
// the IceTransportInterface will be split from this class.
|
||||
class IceTransportInternal : public rtc::PacketTransportInterface {
|
||||
class IceTransportInternal : public rtc::PacketTransportInternal {
|
||||
public:
|
||||
virtual ~IceTransportInternal(){};
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
#include "webrtc/p2p/base/icetransportinternal.h"
|
||||
#include "webrtc/p2p/base/fakeportallocator.h"
|
||||
#include "webrtc/p2p/base/p2ptransportchannel.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
#include "webrtc/p2p/base/testrelayserver.h"
|
||||
#include "webrtc/p2p/base/teststunserver.h"
|
||||
#include "webrtc/p2p/base/testturnserver.h"
|
||||
@ -287,10 +287,10 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
tiebreaker_(0),
|
||||
role_conflict_(false),
|
||||
save_candidates_(false) {}
|
||||
bool HasTransport(const rtc::PacketTransportInterface* transport) {
|
||||
bool HasTransport(const rtc::PacketTransportInternal* transport) {
|
||||
return (transport == cd1_.ch_.get() || transport == cd2_.ch_.get());
|
||||
}
|
||||
ChannelData* GetChannelData(rtc::PacketTransportInterface* transport) {
|
||||
ChannelData* GetChannelData(rtc::PacketTransportInternal* transport) {
|
||||
if (!HasTransport(transport))
|
||||
return NULL;
|
||||
if (cd1_.ch_.get() == transport)
|
||||
@ -327,7 +327,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
bool ready_to_send_ = false;
|
||||
};
|
||||
|
||||
ChannelData* GetChannelData(rtc::PacketTransportInterface* transport) {
|
||||
ChannelData* GetChannelData(rtc::PacketTransportInternal* transport) {
|
||||
if (ep1_.HasTransport(transport))
|
||||
return ep1_.GetChannelData(transport);
|
||||
else
|
||||
@ -682,7 +682,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
TestSendRecv(clock);
|
||||
}
|
||||
|
||||
void OnReadyToSend(rtc::PacketTransportInterface* transport) {
|
||||
void OnReadyToSend(rtc::PacketTransportInternal* transport) {
|
||||
GetEndpoint(transport)->ready_to_send_ = true;
|
||||
}
|
||||
|
||||
@ -790,7 +790,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
}
|
||||
}
|
||||
|
||||
void OnReadPacket(rtc::PacketTransportInterface* transport,
|
||||
void OnReadPacket(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& packet_time,
|
||||
@ -826,7 +826,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
? &ch->selected_connection()->remote_candidate()
|
||||
: NULL;
|
||||
}
|
||||
Endpoint* GetEndpoint(rtc::PacketTransportInterface* transport) {
|
||||
Endpoint* GetEndpoint(rtc::PacketTransportInternal* transport) {
|
||||
if (ep1_.HasTransport(transport)) {
|
||||
return &ep1_;
|
||||
} else if (ep2_.HasTransport(transport)) {
|
||||
@ -848,7 +848,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
return NULL;
|
||||
}
|
||||
std::list<std::string>& GetPacketList(
|
||||
rtc::PacketTransportInterface* transport) {
|
||||
rtc::PacketTransportInternal* transport) {
|
||||
return GetChannelData(transport)->ch_packets_;
|
||||
}
|
||||
|
||||
@ -3055,7 +3055,7 @@ class P2PTransportChannelPingTest : public testing::Test,
|
||||
conn->OnReadPacket(buf.Data(), buf.Length(), rtc::CreatePacketTime(0));
|
||||
}
|
||||
|
||||
void OnReadyToSend(rtc::PacketTransportInterface* transport) {
|
||||
void OnReadyToSend(rtc::PacketTransportInternal* transport) {
|
||||
channel_ready_to_send_ = true;
|
||||
}
|
||||
void OnChannelStateChanged(IceTransportInternal* channel) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
||||
* Copyright 2017 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
|
||||
@ -8,90 +8,17 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
// This exists for backwards compatibility with chromium remoting code that
|
||||
// uses it.
|
||||
// TODO(deadbeef): Update chromium and remove this file.
|
||||
|
||||
#ifndef WEBRTC_P2P_BASE_PACKETTRANSPORTINTERFACE_H_
|
||||
#define WEBRTC_P2P_BASE_PACKETTRANSPORTINTERFACE_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// This is included for PacketOptions.
|
||||
#include "webrtc/base/asyncpacketsocket.h"
|
||||
#include "webrtc/base/sigslot.h"
|
||||
#include "webrtc/base/socket.h"
|
||||
|
||||
namespace cricket {
|
||||
class TransportChannel;
|
||||
}
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
|
||||
namespace rtc {
|
||||
struct PacketOptions;
|
||||
struct PacketTime;
|
||||
struct SentPacket;
|
||||
typedef PacketTransportInternal PacketTransportInterface;
|
||||
}
|
||||
|
||||
class PacketTransportInterface : public sigslot::has_slots<> {
|
||||
public:
|
||||
virtual ~PacketTransportInterface() {}
|
||||
|
||||
// Identify the object for logging and debug purpose.
|
||||
virtual std::string debug_name() const = 0;
|
||||
|
||||
// The transport has been established.
|
||||
virtual bool writable() const = 0;
|
||||
|
||||
// The transport has received a packet in the last X milliseconds, here X is
|
||||
// configured by each implementation.
|
||||
virtual bool receiving() const = 0;
|
||||
|
||||
// Attempts to send the given packet.
|
||||
// The return value is < 0 on failure. The return value in failure case is not
|
||||
// descriptive. Depending on failure cause and implementation details
|
||||
// GetError() returns an descriptive errno.h error value.
|
||||
// This mimics posix socket send() or sendto() behavior.
|
||||
// TODO(johan): Reliable, meaningful, consistent error codes for all
|
||||
// implementations would be nice.
|
||||
// TODO(johan): Remove the default argument once channel code is updated.
|
||||
virtual int SendPacket(const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketOptions& options,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// Sets a socket option. Note that not all options are
|
||||
// supported by all transport types.
|
||||
virtual int SetOption(rtc::Socket::Option opt, int value) = 0;
|
||||
|
||||
// TODO(pthatcher): Once Chrome's MockPacketTransportInterface implements
|
||||
// this, remove the default implementation.
|
||||
virtual bool GetOption(rtc::Socket::Option opt, int* value) { return false; }
|
||||
|
||||
// Returns the most recent error that occurred on this channel.
|
||||
virtual int GetError() = 0;
|
||||
|
||||
// Emitted when the writable state, represented by |writable()|, changes.
|
||||
sigslot::signal1<PacketTransportInterface*> SignalWritableState;
|
||||
|
||||
// Emitted when the PacketTransportInterface is ready to send packets. "Ready
|
||||
// to send" is more sensitive than the writable state; a transport may be
|
||||
// writable, but temporarily not able to send packets. For example, the
|
||||
// underlying transport's socket buffer may be full, as indicated by
|
||||
// SendPacket's return code and/or GetError.
|
||||
sigslot::signal1<PacketTransportInterface*> SignalReadyToSend;
|
||||
|
||||
// Emitted when receiving state changes to true.
|
||||
sigslot::signal1<PacketTransportInterface*> SignalReceivingState;
|
||||
|
||||
// Signalled each time a packet is received on this channel.
|
||||
sigslot::signal5<PacketTransportInterface*,
|
||||
const char*,
|
||||
size_t,
|
||||
const rtc::PacketTime&,
|
||||
int>
|
||||
SignalReadPacket;
|
||||
|
||||
// Signalled each time a packet is sent on this channel.
|
||||
sigslot::signal2<PacketTransportInterface*, const rtc::SentPacket&>
|
||||
SignalSentPacket;
|
||||
};
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // WEBRTC_P2P_BASE_PACKETTRANSPORTINTERFACE_H_
|
||||
#endif
|
||||
|
||||
97
webrtc/p2p/base/packettransportinternal.h
Normal file
97
webrtc/p2p/base/packettransportinternal.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 2016 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 WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_
|
||||
#define WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// This is included for PacketOptions.
|
||||
#include "webrtc/base/asyncpacketsocket.h"
|
||||
#include "webrtc/base/sigslot.h"
|
||||
#include "webrtc/base/socket.h"
|
||||
|
||||
namespace cricket {
|
||||
class TransportChannel;
|
||||
}
|
||||
|
||||
namespace rtc {
|
||||
struct PacketOptions;
|
||||
struct PacketTime;
|
||||
struct SentPacket;
|
||||
|
||||
class PacketTransportInternal : public sigslot::has_slots<> {
|
||||
public:
|
||||
virtual ~PacketTransportInternal() {}
|
||||
|
||||
// Identify the object for logging and debug purpose.
|
||||
virtual std::string debug_name() const = 0;
|
||||
|
||||
// The transport has been established.
|
||||
virtual bool writable() const = 0;
|
||||
|
||||
// The transport has received a packet in the last X milliseconds, here X is
|
||||
// configured by each implementation.
|
||||
virtual bool receiving() const = 0;
|
||||
|
||||
// Attempts to send the given packet.
|
||||
// The return value is < 0 on failure. The return value in failure case is not
|
||||
// descriptive. Depending on failure cause and implementation details
|
||||
// GetError() returns an descriptive errno.h error value.
|
||||
// This mimics posix socket send() or sendto() behavior.
|
||||
// TODO(johan): Reliable, meaningful, consistent error codes for all
|
||||
// implementations would be nice.
|
||||
// TODO(johan): Remove the default argument once channel code is updated.
|
||||
virtual int SendPacket(const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketOptions& options,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// Sets a socket option. Note that not all options are
|
||||
// supported by all transport types.
|
||||
virtual int SetOption(rtc::Socket::Option opt, int value) = 0;
|
||||
|
||||
// TODO(pthatcher): Once Chrome's MockPacketTransportInternal implements
|
||||
// this, remove the default implementation.
|
||||
virtual bool GetOption(rtc::Socket::Option opt, int* value) { return false; }
|
||||
|
||||
// Returns the most recent error that occurred on this channel.
|
||||
virtual int GetError() = 0;
|
||||
|
||||
// Emitted when the writable state, represented by |writable()|, changes.
|
||||
sigslot::signal1<PacketTransportInternal*> SignalWritableState;
|
||||
|
||||
// Emitted when the PacketTransportInternal is ready to send packets. "Ready
|
||||
// to send" is more sensitive than the writable state; a transport may be
|
||||
// writable, but temporarily not able to send packets. For example, the
|
||||
// underlying transport's socket buffer may be full, as indicated by
|
||||
// SendPacket's return code and/or GetError.
|
||||
sigslot::signal1<PacketTransportInternal*> SignalReadyToSend;
|
||||
|
||||
// Emitted when receiving state changes to true.
|
||||
sigslot::signal1<PacketTransportInternal*> SignalReceivingState;
|
||||
|
||||
// Signalled each time a packet is received on this channel.
|
||||
sigslot::signal5<PacketTransportInternal*,
|
||||
const char*,
|
||||
size_t,
|
||||
const rtc::PacketTime&,
|
||||
int>
|
||||
SignalReadPacket;
|
||||
|
||||
// Signalled each time a packet is sent on this channel.
|
||||
sigslot::signal2<PacketTransportInternal*, const rtc::SentPacket&>
|
||||
SignalSentPacket;
|
||||
};
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_
|
||||
@ -741,7 +741,7 @@ void TransportController::SetMetricsObserver_n(
|
||||
}
|
||||
|
||||
void TransportController::OnChannelWritableState_n(
|
||||
rtc::PacketTransportInterface* transport) {
|
||||
rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
LOG(LS_INFO) << " TransportChannel " << transport->debug_name()
|
||||
<< " writability changed to " << transport->writable() << ".";
|
||||
@ -749,7 +749,7 @@ void TransportController::OnChannelWritableState_n(
|
||||
}
|
||||
|
||||
void TransportController::OnChannelReceivingState_n(
|
||||
rtc::PacketTransportInterface* transport) {
|
||||
rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
UpdateAggregateStates_n();
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
namespace rtc {
|
||||
class Thread;
|
||||
class PacketTransportInterface;
|
||||
class PacketTransportInternal;
|
||||
}
|
||||
namespace webrtc {
|
||||
class MetricsObserverInterface;
|
||||
@ -231,8 +231,8 @@ class TransportController : public sigslot::has_slots<>,
|
||||
void SetMetricsObserver_n(webrtc::MetricsObserverInterface* metrics_observer);
|
||||
|
||||
// Handlers for signals from Transport.
|
||||
void OnChannelWritableState_n(rtc::PacketTransportInterface* transport);
|
||||
void OnChannelReceivingState_n(rtc::PacketTransportInterface* transport);
|
||||
void OnChannelWritableState_n(rtc::PacketTransportInternal* transport);
|
||||
void OnChannelReceivingState_n(rtc::PacketTransportInternal* transport);
|
||||
void OnChannelGatheringState_n(IceTransportInternal* channel);
|
||||
void OnChannelCandidateGathered_n(IceTransportInternal* channel,
|
||||
const Candidate& candidate);
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "webrtc/base/asyncpacketsocket.h" // For PacketOptions.
|
||||
#include "webrtc/base/optional.h"
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
|
||||
namespace rtc {
|
||||
class AsyncPacketSocket;
|
||||
@ -32,7 +32,7 @@ namespace cricket {
|
||||
// Implementation of UdpTransportInterface.
|
||||
// Used by OrtcFactory.
|
||||
class UdpTransport : public webrtc::UdpTransportInterface,
|
||||
public rtc::PacketTransportInterface {
|
||||
public rtc::PacketTransportInternal {
|
||||
public:
|
||||
// |transport_name| is only used for identification/logging.
|
||||
// |socket| must be non-null.
|
||||
@ -45,7 +45,7 @@ class UdpTransport : public webrtc::UdpTransportInterface,
|
||||
bool SetRemoteAddress(const rtc::SocketAddress& addr) override;
|
||||
rtc::SocketAddress GetRemoteAddress() const override;
|
||||
|
||||
// Overrides of PacketTransportInterface, used by webrtc internally.
|
||||
// Overrides of PacketTransportInternal, used by webrtc internally.
|
||||
std::string debug_name() const override { return transport_name_; }
|
||||
|
||||
bool receiving() const override {
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "webrtc/base/socketserver.h"
|
||||
#include "webrtc/base/virtualsocketserver.h"
|
||||
#include "webrtc/p2p/base/basicpacketsocketfactory.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
#include "webrtc/p2p/base/udptransport.h"
|
||||
|
||||
namespace cricket {
|
||||
@ -81,15 +81,15 @@ class UdpTransportTest : public testing::Test, public sigslot::has_slots<> {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void OnWritableState(rtc::PacketTransportInterface* transport) {
|
||||
void OnWritableState(rtc::PacketTransportInternal* transport) {
|
||||
num_sig_writable_++;
|
||||
}
|
||||
|
||||
void OnReadyToSend(rtc::PacketTransportInterface* transport) {
|
||||
void OnReadyToSend(rtc::PacketTransportInternal* transport) {
|
||||
num_sig_ready_to_send_++;
|
||||
}
|
||||
|
||||
void OnReadPacket(rtc::PacketTransportInterface* transport,
|
||||
void OnReadPacket(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& packet_time,
|
||||
@ -99,7 +99,7 @@ class UdpTransportTest : public testing::Test, public sigslot::has_slots<> {
|
||||
ch_packets_.push_front(std::string(data, len));
|
||||
}
|
||||
|
||||
void OnSentPacket(rtc::PacketTransportInterface* transport,
|
||||
void OnSentPacket(rtc::PacketTransportInternal* transport,
|
||||
const rtc::SentPacket&) {
|
||||
num_sig_sent_packets_++;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "webrtc/base/trace_event.h"
|
||||
#include "webrtc/media/base/mediaconstants.h"
|
||||
#include "webrtc/media/base/rtputils.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
#include "webrtc/pc/channelmanager.h"
|
||||
|
||||
namespace cricket {
|
||||
@ -214,8 +214,8 @@ void BaseChannel::DisconnectTransportChannels_n() {
|
||||
|
||||
bool BaseChannel::Init_w(DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport) {
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport) {
|
||||
if (!network_thread_->Invoke<bool>(
|
||||
RTC_FROM_HERE, Bind(&BaseChannel::InitNetwork_n, this,
|
||||
rtp_dtls_transport, rtcp_dtls_transport,
|
||||
@ -232,8 +232,8 @@ bool BaseChannel::Init_w(DtlsTransportInternal* rtp_dtls_transport,
|
||||
bool BaseChannel::InitNetwork_n(
|
||||
DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport) {
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport) {
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
SetTransports_n(rtp_dtls_transport, rtcp_dtls_transport, rtp_packet_transport,
|
||||
rtcp_packet_transport);
|
||||
@ -271,8 +271,8 @@ void BaseChannel::SetTransports(DtlsTransportInternal* rtp_dtls_transport,
|
||||
}
|
||||
|
||||
void BaseChannel::SetTransports(
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport) {
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport) {
|
||||
network_thread_->Invoke<void>(
|
||||
RTC_FROM_HERE, Bind(&BaseChannel::SetTransports_n, this, nullptr, nullptr,
|
||||
rtp_packet_transport, rtcp_packet_transport));
|
||||
@ -281,8 +281,8 @@ void BaseChannel::SetTransports(
|
||||
void BaseChannel::SetTransports_n(
|
||||
DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport) {
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport) {
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
// Validate some assertions about the input.
|
||||
RTC_DCHECK(rtp_packet_transport);
|
||||
@ -357,11 +357,11 @@ void BaseChannel::SetTransports_n(
|
||||
void BaseChannel::SetTransport_n(
|
||||
bool rtcp,
|
||||
DtlsTransportInternal* new_dtls_transport,
|
||||
rtc::PacketTransportInterface* new_packet_transport) {
|
||||
rtc::PacketTransportInternal* new_packet_transport) {
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
DtlsTransportInternal*& old_dtls_transport =
|
||||
rtcp ? rtcp_dtls_transport_ : rtp_dtls_transport_;
|
||||
rtc::PacketTransportInterface*& old_packet_transport =
|
||||
rtc::PacketTransportInternal*& old_packet_transport =
|
||||
rtcp ? rtcp_packet_transport_ : rtp_packet_transport_;
|
||||
|
||||
if (!old_packet_transport && !new_packet_transport) {
|
||||
@ -428,7 +428,7 @@ void BaseChannel::DisconnectFromDtlsTransport(
|
||||
}
|
||||
|
||||
void BaseChannel::ConnectToPacketTransport(
|
||||
rtc::PacketTransportInterface* transport) {
|
||||
rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
transport->SignalWritableState.connect(this, &BaseChannel::OnWritableState);
|
||||
transport->SignalReadPacket.connect(this, &BaseChannel::OnPacketRead);
|
||||
@ -437,7 +437,7 @@ void BaseChannel::ConnectToPacketTransport(
|
||||
}
|
||||
|
||||
void BaseChannel::DisconnectFromPacketTransport(
|
||||
rtc::PacketTransportInterface* transport) {
|
||||
rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
transport->SignalWritableState.disconnect(this);
|
||||
transport->SignalReadPacket.disconnect(this);
|
||||
@ -564,7 +564,7 @@ int BaseChannel::SetOption_n(SocketType type,
|
||||
rtc::Socket::Option opt,
|
||||
int value) {
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
rtc::PacketTransportInterface* transport = nullptr;
|
||||
rtc::PacketTransportInternal* transport = nullptr;
|
||||
switch (type) {
|
||||
case ST_RTP:
|
||||
transport = rtp_packet_transport_;
|
||||
@ -585,14 +585,14 @@ bool BaseChannel::SetCryptoOptions(const rtc::CryptoOptions& crypto_options) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void BaseChannel::OnWritableState(rtc::PacketTransportInterface* transport) {
|
||||
void BaseChannel::OnWritableState(rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK(transport == rtp_packet_transport_ ||
|
||||
transport == rtcp_packet_transport_);
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
UpdateWritableState_n();
|
||||
}
|
||||
|
||||
void BaseChannel::OnPacketRead(rtc::PacketTransportInterface* transport,
|
||||
void BaseChannel::OnPacketRead(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& packet_time,
|
||||
@ -608,7 +608,7 @@ void BaseChannel::OnPacketRead(rtc::PacketTransportInterface* transport,
|
||||
HandlePacket(rtcp, &packet, packet_time);
|
||||
}
|
||||
|
||||
void BaseChannel::OnReadyToSend(rtc::PacketTransportInterface* transport) {
|
||||
void BaseChannel::OnReadyToSend(rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK(transport == rtp_packet_transport_ ||
|
||||
transport == rtcp_packet_transport_);
|
||||
SetTransportChannelReadyToSend(transport == rtcp_packet_transport_, true);
|
||||
@ -675,7 +675,7 @@ void BaseChannel::SetTransportChannelReadyToSend(bool rtcp, bool ready) {
|
||||
Bind(&MediaChannel::OnReadyToSend, media_channel_, ready_to_send));
|
||||
}
|
||||
|
||||
bool BaseChannel::PacketIsRtcp(const rtc::PacketTransportInterface* transport,
|
||||
bool BaseChannel::PacketIsRtcp(const rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len) {
|
||||
return (transport == rtcp_packet_transport_ ||
|
||||
@ -707,7 +707,7 @@ 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.
|
||||
rtc::PacketTransportInterface* transport =
|
||||
rtc::PacketTransportInternal* transport =
|
||||
(!rtcp || rtcp_mux_filter_.IsActive()) ? rtp_packet_transport_
|
||||
: rtcp_packet_transport_;
|
||||
if (!transport || !transport->writable()) {
|
||||
@ -1506,7 +1506,7 @@ void BaseChannel::FlushRtcpMessages_n() {
|
||||
}
|
||||
|
||||
void BaseChannel::SignalSentPacket_n(
|
||||
rtc::PacketTransportInterface* /* transport */,
|
||||
rtc::PacketTransportInternal* /* transport */,
|
||||
const rtc::SentPacket& sent_packet) {
|
||||
RTC_DCHECK(network_thread_->IsCurrent());
|
||||
invoker_.AsyncInvoke<void>(
|
||||
@ -1697,7 +1697,7 @@ void VoiceChannel::GetActiveStreams_w(AudioInfo::StreamList* actives) {
|
||||
media_channel()->GetActiveStreams(actives);
|
||||
}
|
||||
|
||||
void VoiceChannel::OnPacketRead(rtc::PacketTransportInterface* transport,
|
||||
void VoiceChannel::OnPacketRead(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& packet_time,
|
||||
@ -2211,8 +2211,8 @@ RtpDataChannel::~RtpDataChannel() {
|
||||
bool RtpDataChannel::Init_w(
|
||||
DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport) {
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport) {
|
||||
if (!BaseChannel::Init_w(rtp_dtls_transport, rtcp_dtls_transport,
|
||||
rtp_packet_transport, rtcp_packet_transport)) {
|
||||
return false;
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
#include "webrtc/media/base/videosinkinterface.h"
|
||||
#include "webrtc/media/base/videosourceinterface.h"
|
||||
#include "webrtc/p2p/base/dtlstransportinternal.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
#include "webrtc/p2p/base/transportcontroller.h"
|
||||
#include "webrtc/p2p/client/socketmonitor.h"
|
||||
#include "webrtc/pc/audiomonitor.h"
|
||||
@ -85,8 +85,8 @@ class BaseChannel
|
||||
virtual ~BaseChannel();
|
||||
bool Init_w(DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport);
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport);
|
||||
// Deinit may be called multiple times and is simply ignored if it's already
|
||||
// done.
|
||||
void Deinit();
|
||||
@ -113,12 +113,12 @@ class BaseChannel
|
||||
// RTCP muxing is not fully active yet).
|
||||
// |rtp_transport| and |rtcp_transport| must share the same transport name as
|
||||
// well.
|
||||
// Can not start with "rtc::PacketTransportInterface" and switch to
|
||||
// Can not start with "rtc::PacketTransportInternal" and switch to
|
||||
// "DtlsTransportInternal", or vice-versa.
|
||||
void SetTransports(DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport);
|
||||
void SetTransports(rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport);
|
||||
void SetTransports(rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport);
|
||||
bool PushdownLocalDescription(const SessionDescription* local_desc,
|
||||
ContentAction action,
|
||||
std::string* error_desc);
|
||||
@ -211,14 +211,14 @@ class BaseChannel
|
||||
|
||||
void SetTransports_n(DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport);
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport);
|
||||
|
||||
// This does not update writability or "ready-to-send" state; it just
|
||||
// disconnects from the old channel and connects to the new one.
|
||||
void SetTransport_n(bool rtcp,
|
||||
DtlsTransportInternal* new_dtls_transport,
|
||||
rtc::PacketTransportInterface* new_packet_transport);
|
||||
rtc::PacketTransportInternal* new_packet_transport);
|
||||
|
||||
bool was_ever_writable() const { return was_ever_writable_; }
|
||||
void set_local_content_direction(MediaContentDirection direction) {
|
||||
@ -243,8 +243,8 @@ class BaseChannel
|
||||
|
||||
void ConnectToDtlsTransport(DtlsTransportInternal* transport);
|
||||
void DisconnectFromDtlsTransport(DtlsTransportInternal* transport);
|
||||
void ConnectToPacketTransport(rtc::PacketTransportInterface* transport);
|
||||
void DisconnectFromPacketTransport(rtc::PacketTransportInterface* transport);
|
||||
void ConnectToPacketTransport(rtc::PacketTransportInternal* transport);
|
||||
void DisconnectFromPacketTransport(rtc::PacketTransportInternal* transport);
|
||||
|
||||
void FlushRtcpMessages_n();
|
||||
|
||||
@ -255,13 +255,13 @@ class BaseChannel
|
||||
const rtc::PacketOptions& options) override;
|
||||
|
||||
// From TransportChannel
|
||||
void OnWritableState(rtc::PacketTransportInterface* transport);
|
||||
virtual void OnPacketRead(rtc::PacketTransportInterface* transport,
|
||||
void OnWritableState(rtc::PacketTransportInternal* transport);
|
||||
virtual void OnPacketRead(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& packet_time,
|
||||
int flags);
|
||||
void OnReadyToSend(rtc::PacketTransportInterface* transport);
|
||||
void OnReadyToSend(rtc::PacketTransportInternal* transport);
|
||||
|
||||
void OnDtlsState(DtlsTransportInternal* transport, DtlsTransportState state);
|
||||
|
||||
@ -271,7 +271,7 @@ class BaseChannel
|
||||
int last_sent_packet_id,
|
||||
bool ready_to_send);
|
||||
|
||||
bool PacketIsRtcp(const rtc::PacketTransportInterface* transport,
|
||||
bool PacketIsRtcp(const rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len);
|
||||
bool SendPacket(bool rtcp,
|
||||
@ -377,10 +377,10 @@ class BaseChannel
|
||||
private:
|
||||
bool InitNetwork_n(DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport);
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport);
|
||||
void DisconnectTransportChannels_n();
|
||||
void SignalSentPacket_n(rtc::PacketTransportInterface* transport,
|
||||
void SignalSentPacket_n(rtc::PacketTransportInternal* transport,
|
||||
const rtc::SentPacket& sent_packet);
|
||||
void SignalSentPacket_w(const rtc::SentPacket& sent_packet);
|
||||
bool IsReadyToSendMedia_n() const;
|
||||
@ -407,8 +407,8 @@ class BaseChannel
|
||||
// If non-null, "X_dtls_transport_" will always equal "X_packet_transport_".
|
||||
DtlsTransportInternal* rtp_dtls_transport_ = nullptr;
|
||||
DtlsTransportInternal* rtcp_dtls_transport_ = nullptr;
|
||||
rtc::PacketTransportInterface* rtp_packet_transport_ = nullptr;
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport_ = nullptr;
|
||||
rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr;
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport_ = nullptr;
|
||||
std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
|
||||
std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_;
|
||||
SrtpFilter srtp_filter_;
|
||||
@ -516,7 +516,7 @@ class VoiceChannel : public BaseChannel {
|
||||
|
||||
private:
|
||||
// overrides from BaseChannel
|
||||
void OnPacketRead(rtc::PacketTransportInterface* transport,
|
||||
void OnPacketRead(rtc::PacketTransportInternal* transport,
|
||||
const char* data,
|
||||
size_t len,
|
||||
const rtc::PacketTime& packet_time,
|
||||
@ -648,8 +648,8 @@ class RtpDataChannel : public BaseChannel {
|
||||
~RtpDataChannel();
|
||||
bool Init_w(DtlsTransportInternal* rtp_dtls_transport,
|
||||
DtlsTransportInternal* rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* rtcp_packet_transport);
|
||||
rtc::PacketTransportInternal* rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* rtcp_packet_transport);
|
||||
|
||||
virtual bool SendData(const SendDataParams& params,
|
||||
const rtc::CopyOnWriteBuffer& payload,
|
||||
|
||||
@ -98,7 +98,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
SSRC_MUX = 0x8,
|
||||
DTLS = 0x10,
|
||||
GCM_CIPHER = 0x20,
|
||||
// Use BaseChannel with PacketTransportInterface rather than
|
||||
// Use BaseChannel with PacketTransportInternal rather than
|
||||
// DtlsTransportInternal.
|
||||
RAW_PACKET_TRANSPORT = 0x40,
|
||||
};
|
||||
@ -143,10 +143,10 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
rtc::Thread* worker_thread = rtc::Thread::Current();
|
||||
media_channel1_ = ch1;
|
||||
media_channel2_ = ch2;
|
||||
rtc::PacketTransportInterface* rtp1 = nullptr;
|
||||
rtc::PacketTransportInterface* rtcp1 = nullptr;
|
||||
rtc::PacketTransportInterface* rtp2 = nullptr;
|
||||
rtc::PacketTransportInterface* rtcp2 = nullptr;
|
||||
rtc::PacketTransportInternal* rtp1 = nullptr;
|
||||
rtc::PacketTransportInternal* rtcp1 = nullptr;
|
||||
rtc::PacketTransportInternal* rtp2 = nullptr;
|
||||
rtc::PacketTransportInternal* rtcp2 = nullptr;
|
||||
// Based on flags, create fake DTLS or raw packet transports.
|
||||
if (flags1 & RAW_PACKET_TRANSPORT) {
|
||||
fake_rtp_packet_transport1_.reset(
|
||||
@ -255,8 +255,8 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
typename T::MediaChannel* ch,
|
||||
cricket::DtlsTransportInternal* fake_rtp_dtls_transport,
|
||||
cricket::DtlsTransportInternal* fake_rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* fake_rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* fake_rtcp_packet_transport,
|
||||
rtc::PacketTransportInternal* fake_rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* fake_rtcp_packet_transport,
|
||||
int flags) {
|
||||
rtc::Thread* signaling_thread = rtc::Thread::Current();
|
||||
typename T::Channel* channel = new typename T::Channel(
|
||||
@ -2117,8 +2117,8 @@ cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel(
|
||||
cricket::FakeVideoMediaChannel* ch,
|
||||
cricket::DtlsTransportInternal* fake_rtp_dtls_transport,
|
||||
cricket::DtlsTransportInternal* fake_rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* fake_rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* fake_rtcp_packet_transport,
|
||||
rtc::PacketTransportInternal* fake_rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* fake_rtcp_packet_transport,
|
||||
int flags) {
|
||||
rtc::Thread* signaling_thread = rtc::Thread::Current();
|
||||
cricket::VideoChannel* channel = new cricket::VideoChannel(
|
||||
@ -3355,8 +3355,8 @@ cricket::RtpDataChannel* ChannelTest<DataTraits>::CreateChannel(
|
||||
cricket::FakeDataMediaChannel* ch,
|
||||
cricket::DtlsTransportInternal* fake_rtp_dtls_transport,
|
||||
cricket::DtlsTransportInternal* fake_rtcp_dtls_transport,
|
||||
rtc::PacketTransportInterface* fake_rtp_packet_transport,
|
||||
rtc::PacketTransportInterface* fake_rtcp_packet_transport,
|
||||
rtc::PacketTransportInternal* fake_rtp_packet_transport,
|
||||
rtc::PacketTransportInternal* fake_rtcp_packet_transport,
|
||||
int flags) {
|
||||
rtc::Thread* signaling_thread = rtc::Thread::Current();
|
||||
cricket::RtpDataChannel* channel = new cricket::RtpDataChannel(
|
||||
@ -3760,20 +3760,20 @@ TEST_F(BaseChannelDeathTest, SetTransportsWithMismatchingTransportNames) {
|
||||
}
|
||||
|
||||
// Not expected to support going from DtlsTransportInternal to
|
||||
// PacketTransportInterface.
|
||||
// PacketTransportInternal.
|
||||
TEST_F(BaseChannelDeathTest, SetTransportsDtlsToNonDtls) {
|
||||
ASSERT_TRUE(voice_channel_.Init_w(
|
||||
&fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_,
|
||||
&fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_));
|
||||
EXPECT_DEATH(
|
||||
voice_channel_.SetTransports(static_cast<rtc::PacketTransportInterface*>(
|
||||
&fake_rtp_dtls_transport_),
|
||||
static_cast<rtc::PacketTransportInterface*>(
|
||||
&fake_rtp_dtls_transport_)),
|
||||
voice_channel_.SetTransports(
|
||||
static_cast<rtc::PacketTransportInternal*>(&fake_rtp_dtls_transport_),
|
||||
static_cast<rtc::PacketTransportInternal*>(
|
||||
&fake_rtp_dtls_transport_)),
|
||||
"");
|
||||
}
|
||||
|
||||
// Not expected to support going from PacketTransportInterface to
|
||||
// Not expected to support going from PacketTransportInternal to
|
||||
// DtlsTransportInternal.
|
||||
TEST_F(BaseChannelDeathTest, SetTransportsNonDtlsToDtls) {
|
||||
ASSERT_TRUE(voice_channel_.Init_w(nullptr, nullptr, &fake_rtp_dtls_transport_,
|
||||
|
||||
@ -25,13 +25,13 @@ static const rtc::IPAddress kIPv4LocalHostAddress =
|
||||
|
||||
class PacketReceiver : public sigslot::has_slots<> {
|
||||
public:
|
||||
explicit PacketReceiver(rtc::PacketTransportInterface* transport) {
|
||||
explicit PacketReceiver(rtc::PacketTransportInternal* transport) {
|
||||
transport->SignalReadPacket.connect(this, &PacketReceiver::OnReadPacket);
|
||||
}
|
||||
int packets_read() const { return packets_read_; }
|
||||
|
||||
private:
|
||||
void OnReadPacket(rtc::PacketTransportInterface*,
|
||||
void OnReadPacket(rtc::PacketTransportInternal*,
|
||||
const char*,
|
||||
size_t,
|
||||
const rtc::PacketTime&,
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#include "webrtc/media/base/mediachannel.h"
|
||||
#include "webrtc/media/engine/fakewebrtccall.h"
|
||||
#include "webrtc/media/sctp/sctptransportinternal.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/p2p/base/packettransportinternal.h"
|
||||
#include "webrtc/p2p/base/stunserver.h"
|
||||
#include "webrtc/p2p/base/teststunserver.h"
|
||||
#include "webrtc/p2p/base/testturnserver.h"
|
||||
@ -210,7 +210,7 @@ class MockIceObserver : public webrtc::IceObserver {
|
||||
// local/remote ports.
|
||||
class FakeSctpTransport : public cricket::SctpTransportInternal {
|
||||
public:
|
||||
void SetTransportChannel(rtc::PacketTransportInterface* channel) override {}
|
||||
void SetTransportChannel(rtc::PacketTransportInternal* channel) override {}
|
||||
bool Start(int local_port, int remote_port) override {
|
||||
local_port_ = local_port;
|
||||
remote_port_ = remote_port;
|
||||
@ -237,7 +237,7 @@ class FakeSctpTransport : public cricket::SctpTransportInternal {
|
||||
class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory {
|
||||
public:
|
||||
std::unique_ptr<cricket::SctpTransportInternal> CreateSctpTransport(
|
||||
rtc::PacketTransportInterface*) override {
|
||||
rtc::PacketTransportInternal*) override {
|
||||
last_fake_sctp_transport_ = new FakeSctpTransport();
|
||||
return std::unique_ptr<cricket::SctpTransportInternal>(
|
||||
last_fake_sctp_transport_);
|
||||
@ -275,24 +275,24 @@ class WebRtcSessionForTest : public webrtc::WebRtcSession {
|
||||
|
||||
// Note that these methods are only safe to use if the signaling thread
|
||||
// is the same as the worker thread
|
||||
rtc::PacketTransportInterface* voice_rtp_transport_channel() {
|
||||
rtc::PacketTransportInternal* voice_rtp_transport_channel() {
|
||||
return rtp_transport_channel(voice_channel());
|
||||
}
|
||||
|
||||
rtc::PacketTransportInterface* voice_rtcp_transport_channel() {
|
||||
rtc::PacketTransportInternal* voice_rtcp_transport_channel() {
|
||||
return rtcp_transport_channel(voice_channel());
|
||||
}
|
||||
|
||||
rtc::PacketTransportInterface* video_rtp_transport_channel() {
|
||||
rtc::PacketTransportInternal* video_rtp_transport_channel() {
|
||||
return rtp_transport_channel(video_channel());
|
||||
}
|
||||
|
||||
rtc::PacketTransportInterface* video_rtcp_transport_channel() {
|
||||
rtc::PacketTransportInternal* video_rtcp_transport_channel() {
|
||||
return rtcp_transport_channel(video_channel());
|
||||
}
|
||||
|
||||
private:
|
||||
rtc::PacketTransportInterface* rtp_transport_channel(
|
||||
rtc::PacketTransportInternal* rtp_transport_channel(
|
||||
cricket::BaseChannel* ch) {
|
||||
if (!ch) {
|
||||
return nullptr;
|
||||
@ -300,7 +300,7 @@ class WebRtcSessionForTest : public webrtc::WebRtcSession {
|
||||
return ch->rtp_dtls_transport();
|
||||
}
|
||||
|
||||
rtc::PacketTransportInterface* rtcp_transport_channel(
|
||||
rtc::PacketTransportInternal* rtcp_transport_channel(
|
||||
cricket::BaseChannel* ch) {
|
||||
if (!ch) {
|
||||
return nullptr;
|
||||
@ -2444,13 +2444,13 @@ TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
|
||||
SessionDescriptionInterface* answer = CreateAnswer();
|
||||
SetLocalDescriptionWithoutError(answer);
|
||||
|
||||
rtc::PacketTransportInterface* voice_transport_channel =
|
||||
rtc::PacketTransportInternal* voice_transport_channel =
|
||||
session_->voice_rtp_transport_channel();
|
||||
EXPECT_TRUE(voice_transport_channel != NULL);
|
||||
EXPECT_EQ(voice_transport_channel->debug_name(),
|
||||
"audio_content_name " +
|
||||
std::to_string(cricket::ICE_CANDIDATE_COMPONENT_RTP));
|
||||
rtc::PacketTransportInterface* video_transport_channel =
|
||||
rtc::PacketTransportInternal* video_transport_channel =
|
||||
session_->video_rtp_transport_channel();
|
||||
ASSERT_TRUE(video_transport_channel != NULL);
|
||||
EXPECT_EQ(video_transport_channel->debug_name(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user