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

Unified Diff: webrtc/api/webrtcsession.cc

Issue 2089553002: Refactoring on QUIC (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Disable quic for review. Created 4 years, 6 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/api/webrtcsession.cc
diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc
index b9a3fc8453389dc040a28f51a47d0a4649e0eb49..1fbf82c00a41aaac25d9301eaaa8741fe473a6d8 100644
--- a/webrtc/api/webrtcsession.cc
+++ b/webrtc/api/webrtcsession.cc
@@ -24,6 +24,7 @@
#include "webrtc/api/webrtcsessiondescriptionfactory.h"
#include "webrtc/audio_sink.h"
#include "webrtc/base/basictypes.h"
+#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/helpers.h"
#include "webrtc/base/logging.h"
@@ -38,6 +39,10 @@
#include "webrtc/pc/channelmanager.h"
#include "webrtc/pc/mediasession.h"
+#ifdef HAVE_QUIC
+#include "webrtc/p2p/quic/quictransportchannel.h"
+#endif // HAVE_QUIC
+
using cricket::ContentInfo;
using cricket::ContentInfos;
using cricket::MediaContentDescription;
@@ -458,7 +463,8 @@ WebRtcSession::WebRtcSession(webrtc::MediaControllerInterface* media_controller,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
cricket::PortAllocator* port_allocator)
- : worker_thread_(worker_thread),
+ : network_thread_(network_thread),
+ worker_thread_(worker_thread),
signaling_thread_(signaling_thread),
// RFC 3264: The numeric value of the session id and version in the
// o line MUST be representable with a "64 bit signed integer".
@@ -545,7 +551,17 @@ bool WebRtcSession::Initialize(
// PeerConnectionFactoryInterface::Options.
if (rtc_configuration.enable_rtp_data_channel) {
data_channel_type_ = cricket::DCT_RTP;
- } else {
+ }
+#ifdef HAVE_QUIC
+ else if (rtc_configuration.enable_quic && dtls_enabled_) {
pthatcher1 2016/06/28 22:39:03 I don't think we need to check for dtls_enabled_.
+ // Use QUIC instead of DTLS when |enable_quic| is true and encryption is
+ // enabled.
+ data_channel_type_ = cricket::DCT_QUIC;
+ transport_controller_->use_quic();
+ LOG(LS_INFO) << "Using QUIC instead of DTLS";
pthatcher1 2016/06/28 22:39:03 We could log this if dtls_enabled_. But otherwise
+ }
+#endif // HAVE_QUIC
+ else {
// DTLS has to be enabled to use SCTP.
if (!options.disable_sctp_data_channels && dtls_enabled_) {
data_channel_type_ = cricket::DCT_SCTP;
@@ -1803,6 +1819,27 @@ bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content,
bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content,
const std::string* bundle_transport) {
+#ifdef HAVE_QUIC
+ if (data_channel_type_ == cricket::DCT_QUIC) {
+ // The TransportController may not have a QuicTransportChannel, so force
+ // creation of it.
+ LOG(LS_INFO) << "Getting or creating QuicTransportChannel";
+ RTC_DCHECK(transport_controller_->quic());
+ cricket::TransportChannel* transport_channel =
+ network_thread_->Invoke<cricket::TransportChannel*>(
+ RTC_FROM_HERE,
+ rtc::Bind(&cricket::TransportController::CreateTransportChannel_n,
+ transport_controller_.get(), content->name,
+ cricket::ICE_CANDIDATE_COMPONENT_RTP));
+ if (!transport_channel) {
+ return false;
+ }
+ quic_transport_channel_ =
+ static_cast<cricket::QuicTransportChannel*>(transport_channel);
+ SignalQuicTransportChannelCreated(quic_transport_channel_);
+ return true;
+ }
+#endif // HAVE_QUIC
Taylor Brandstetter 2016/06/29 17:50:04 I think this needs to be rethought. This design me
pthatcher1 2016/06/29 18:35:28 Yeah, we can discuss it in person. This was the d
bool sctp = (data_channel_type_ == cricket::DCT_SCTP);
bool require_rtcp_mux =
rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire;
@@ -2001,7 +2038,7 @@ bool WebRtcSession::ReadyToUseRemoteCandidate(
const IceCandidateInterface* candidate,
const SessionDescriptionInterface* remote_desc,
bool* valid) {
- *valid = true;;
+ *valid = true;
const SessionDescriptionInterface* current_remote_desc =
remote_desc ? remote_desc : remote_desc_.get();
@@ -2026,6 +2063,14 @@ bool WebRtcSession::ReadyToUseRemoteCandidate(
current_remote_desc->description()->contents()[mediacontent_index];
cricket::BaseChannel* channel = GetChannel(content.name);
if (!channel) {
+#ifdef HAVE_QUIC
+ if (data_channel_type_ == cricket::DCT_QUIC && quic_transport_channel_ &&
+ content.name == quic_transport_channel_->transport_name()) {
+ // QUIC data channels do not have a BaseChannel unless bundle is enabled.
+ return transport_controller_->ReadyForRemoteCandidates(
+ quic_transport_channel_->transport_name());
+ }
+#endif // HAVE_QUIC
return false;
}

Powered by Google App Engine
This is Rietveld 408576698