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

Unified Diff: webrtc/pc/channel.h

Issue 2648233003: Adding ability for BaseChannel to use PacketTransportInterface. (Closed)
Patch Set: Fix TSAN warning in test by starting thread after setting fake clock 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/p2p/base/transportcontroller_unittest.cc ('k') | webrtc/pc/channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/channel.h
diff --git a/webrtc/pc/channel.h b/webrtc/pc/channel.h
index e4848b2334c444496e368f119b23f570d3094eb6..0c95d936e579ada24e0476fc2d85a54766d23882 100644
--- a/webrtc/pc/channel.h
+++ b/webrtc/pc/channel.h
@@ -30,6 +30,8 @@
#include "webrtc/media/base/streamparams.h"
#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/transportcontroller.h"
#include "webrtc/p2p/client/socketmonitor.h"
#include "webrtc/pc/audiomonitor.h"
@@ -39,10 +41,6 @@
#include "webrtc/pc/rtcpmuxfilter.h"
#include "webrtc/pc/srtpfilter.h"
-namespace rtc {
-class PacketTransportInterface;
-}
-
namespace webrtc {
class AudioSinkInterface;
} // namespace webrtc
@@ -75,7 +73,6 @@ class BaseChannel
public MediaChannel::NetworkInterface,
public ConnectionStatsGetter {
public:
- // |rtcp| represents whether or not this channel uses RTCP.
// If |srtp_required| is true, the channel will not send or receive any
// RTP/RTCP packets without using SRTP (either using SDES or DTLS-SRTP).
BaseChannel(rtc::Thread* worker_thread,
@@ -87,7 +84,9 @@ class BaseChannel
bool srtp_required);
virtual ~BaseChannel();
bool Init_w(DtlsTransportInternal* rtp_dtls_transport,
- DtlsTransportInternal* rtcp_dtls_transport);
+ DtlsTransportInternal* rtcp_dtls_transport,
+ rtc::PacketTransportInterface* rtp_packet_transport,
+ rtc::PacketTransportInterface* rtcp_packet_transport);
// Deinit may be called multiple times and is simply ignored if it's already
// done.
void Deinit();
@@ -95,6 +94,7 @@ class BaseChannel
rtc::Thread* worker_thread() const { return worker_thread_; }
rtc::Thread* network_thread() const { return network_thread_; }
const std::string& content_name() const { return content_name_; }
+ // TODO(deadbeef): This is redundant; remove this.
const std::string& transport_name() const { return transport_name_; }
bool enabled() const { return enabled_; }
@@ -113,8 +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
+ // "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);
bool PushdownLocalDescription(const SessionDescription* local_desc,
ContentAction action,
std::string* error_desc);
@@ -206,11 +210,15 @@ class BaseChannel
virtual MediaChannel* media_channel() const { return media_channel_; }
void SetTransports_n(DtlsTransportInternal* rtp_dtls_transport,
- DtlsTransportInternal* rtcp_dtls_transport);
+ DtlsTransportInternal* rtcp_dtls_transport,
+ rtc::PacketTransportInterface* rtp_packet_transport,
+ rtc::PacketTransportInterface* 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_transport);
+ void SetTransport_n(bool rtcp,
+ DtlsTransportInternal* new_dtls_transport,
+ rtc::PacketTransportInterface* new_packet_transport);
bool was_ever_writable() const { return was_ever_writable_; }
void set_local_content_direction(MediaContentDirection direction) {
@@ -233,8 +241,10 @@ class BaseChannel
bool IsReadyToSendMedia_w() const;
rtc::Thread* signaling_thread() { return signaling_thread_; }
- void ConnectToTransport(DtlsTransportInternal* transport);
- void DisconnectFromTransport(DtlsTransportInternal* transport);
+ void ConnectToDtlsTransport(DtlsTransportInternal* transport);
+ void DisconnectFromDtlsTransport(DtlsTransportInternal* transport);
+ void ConnectToPacketTransport(rtc::PacketTransportInterface* transport);
+ void DisconnectFromPacketTransport(rtc::PacketTransportInterface* transport);
void FlushRtcpMessages_n();
@@ -366,7 +376,9 @@ class BaseChannel
private:
bool InitNetwork_n(DtlsTransportInternal* rtp_dtls_transport,
- DtlsTransportInternal* rtcp_dtls_transport);
+ DtlsTransportInternal* rtcp_dtls_transport,
+ rtc::PacketTransportInterface* rtp_packet_transport,
+ rtc::PacketTransportInterface* rtcp_packet_transport);
void DisconnectTransportChannels_n();
void SignalSentPacket_n(rtc::PacketTransportInterface* transport,
const rtc::SentPacket& sent_packet);
@@ -384,14 +396,20 @@ class BaseChannel
const std::string content_name_;
std::unique_ptr<ConnectionMonitor> connection_monitor_;
+ // Won't be set when using raw packet transports. SDP-specific thing.
std::string transport_name_;
// True if RTCP-multiplexing is required. In other words, no standalone RTCP
// transport will ever be used for this channel.
const bool rtcp_mux_required_;
+ // Separate DTLS/non-DTLS pointers to support using BaseChannel without DTLS.
+ // Temporary measure until more refactoring is done.
+ // If non-null, "X_dtls_transport_" will always equal "X_packet_transport_".
DtlsTransportInternal* rtp_dtls_transport_ = nullptr;
- std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
DtlsTransportInternal* rtcp_dtls_transport_ = nullptr;
+ rtc::PacketTransportInterface* rtp_packet_transport_ = nullptr;
+ rtc::PacketTransportInterface* 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_;
RtcpMuxFilter rtcp_mux_filter_;
@@ -433,8 +451,6 @@ class VoiceChannel : public BaseChannel {
bool rtcp_mux_required,
bool srtp_required);
~VoiceChannel();
- bool Init_w(DtlsTransportInternal* rtp_dtls_transport,
- DtlsTransportInternal* rtcp_dtls_transport);
// Configure sending media on the stream with SSRC |ssrc|
// If there is only one sending stream SSRC 0 can be used.
@@ -552,8 +568,6 @@ class VideoChannel : public BaseChannel {
bool rtcp_mux_required,
bool srtp_required);
~VideoChannel();
- bool Init_w(DtlsTransportInternal* rtp_dtls_transport,
- DtlsTransportInternal* rtcp_dtls_transport);
// downcasts a MediaChannel
VideoMediaChannel* media_channel() const override {
@@ -633,7 +647,9 @@ class RtpDataChannel : public BaseChannel {
bool srtp_required);
~RtpDataChannel();
bool Init_w(DtlsTransportInternal* rtp_dtls_transport,
- DtlsTransportInternal* rtcp_dtls_transport);
+ DtlsTransportInternal* rtcp_dtls_transport,
+ rtc::PacketTransportInterface* rtp_packet_transport,
+ rtc::PacketTransportInterface* rtcp_packet_transport);
virtual bool SendData(const SendDataParams& params,
const rtc::CopyOnWriteBuffer& payload,
« no previous file with comments | « webrtc/p2p/base/transportcontroller_unittest.cc ('k') | webrtc/pc/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698