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

Unified Diff: webrtc/pc/channel.h

Issue 3012953002: Created the DtlsSrtpTransport.
Patch Set: Initial review. Created 3 years, 3 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.h
diff --git a/webrtc/pc/channel.h b/webrtc/pc/channel.h
index b95bd529b005a71e5b749dc1333425467ece376d..10b0b8f30b3a096ccf7b1c8adc5522802061eb08 100644
--- a/webrtc/pc/channel.h
+++ b/webrtc/pc/channel.h
@@ -30,10 +30,13 @@
#include "webrtc/p2p/base/transportcontroller.h"
#include "webrtc/p2p/client/socketmonitor.h"
#include "webrtc/pc/audiomonitor.h"
+#include "webrtc/pc/dtlssrtptransport.h"
#include "webrtc/pc/mediamonitor.h"
#include "webrtc/pc/mediasession.h"
#include "webrtc/pc/rtcpmuxfilter.h"
+#include "webrtc/pc/rtptransport.h"
#include "webrtc/pc/srtpfilter.h"
+#include "webrtc/pc/srtptransport.h"
#include "webrtc/rtc_base/asyncinvoker.h"
#include "webrtc/rtc_base/asyncudpsocket.h"
#include "webrtc/rtc_base/criticalsection.h"
@@ -44,7 +47,6 @@
namespace webrtc {
class AudioSinkInterface;
class RtpTransportInternal;
-class SrtpTransport;
} // namespace webrtc
namespace cricket {
@@ -103,7 +105,9 @@ class BaseChannel
// This function returns true if we are using SDES.
bool sdes_active() const { return sdes_negotiator_.IsActive(); }
// The following function returns true if we are using DTLS-based keying.
- bool dtls_active() const { return dtls_active_; }
+ bool dtls_active() const {
+ return dtls_srtp_transport_ && dtls_srtp_transport_->IsActive();
+ }
// This function returns true if using SRTP (DTLS-based keying or SDES).
bool srtp_active() const { return sdes_active() || dtls_active(); }
@@ -379,6 +383,12 @@ class BaseChannel
void UpdateTransportOverhead();
// Wraps the existing RtpTransport in an SrtpTransport.
void EnableSrtpTransport_n();
+ // Create an SrtpTransport and wrap it in an DtlsSrptTransport.
+ void EnableDtlsSrtpTransport_n();
+ // Cache the send/recv encrypted header extension ids before the
+ // DtlsSrtpTransport is enabled.
+ void CacheEncryptedHeaderExtensionIds(cricket::ContentSource source,
+ const std::vector<int>& extension_ids);
rtc::Thread* const worker_thread_;
rtc::Thread* const network_thread_;
@@ -393,13 +403,19 @@ class BaseChannel
const bool rtcp_mux_required_;
+ std::vector<int> send_encrypted_header_extension_ids_;
+ std::vector<int> recv_encrypted_header_extension_ids_;
+
// 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;
DtlsTransportInternal* rtcp_dtls_transport_ = nullptr;
+
std::unique_ptr<webrtc::RtpTransportInternal> rtp_transport_;
webrtc::SrtpTransport* srtp_transport_ = nullptr;
+ webrtc::DtlsSrtpTransport* dtls_srtp_transport_ = nullptr;
+
std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_;
SrtpFilter sdes_negotiator_;
@@ -407,7 +423,6 @@ class BaseChannel
bool writable_ = false;
bool was_ever_writable_ = false;
bool has_received_packet_ = false;
- bool dtls_active_ = false;
const bool srtp_required_ = true;
// MediaChannel related members that should be accessed from the worker
« no previous file with comments | « webrtc/pc/BUILD.gn ('k') | webrtc/pc/channel.cc » ('j') | webrtc/pc/channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698