| Index: webrtc/api/webrtcsession.cc
|
| diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc
|
| index 9f84840822fce12c4c9012b568e10c0b3b4e651b..2cd592a08241e350d14751127ba964cbaf2edc7b 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;
|
| @@ -561,7 +566,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_) {
|
| + // 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";
|
| + }
|
| +#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;
|
| @@ -1748,8 +1763,8 @@ bool WebRtcSession::CreateChannels(const SessionDescription* desc) {
|
| }
|
|
|
| const cricket::ContentInfo* data = cricket::GetFirstDataContent(desc);
|
| - if (data_channel_type_ != cricket::DCT_NONE &&
|
| - data && !data->rejected && !data_channel_) {
|
| + if (data_channel_type_ != cricket::DCT_NONE && data && !data->rejected &&
|
| + !data_channel_) {
|
| if (!CreateDataChannel(data)) {
|
| LOG(LS_ERROR) << "Failed to create data channel.";
|
| return false;
|
| @@ -1820,7 +1835,27 @@ bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) {
|
| }
|
|
|
| bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) {
|
| - bool sctp = (data_channel_type_ == cricket::DCT_SCTP);
|
| +#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 =
|
| + worker_thread_->Invoke<cricket::TransportChannel*>(
|
| + rtc::Bind(&cricket::TransportController::CreateTransportChannel_w,
|
| + 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
|
| + bool sctp = data_channel_type_ == cricket::DCT_SCTP;
|
| data_channel_.reset(channel_manager_->CreateDataChannel(
|
| transport_controller_.get(), content->name, !sctp, data_channel_type_));
|
| if (!data_channel_) {
|
| @@ -1994,7 +2029,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();
|
| @@ -2019,6 +2054,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;
|
| }
|
|
|
|
|