| Index: webrtc/api/peerconnection.cc
|
| diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
|
| index be614727b9fa50f9876167e2bfeff7602c6a730e..47fdc8d5596c079e2c3c9721753fa25349d54a72 100644
|
| --- a/webrtc/api/peerconnection.cc
|
| +++ b/webrtc/api/peerconnection.cc
|
| @@ -898,6 +898,23 @@ PeerConnection::CreateDataChannel(
|
| const std::string& label,
|
| const DataChannelInit* config) {
|
| TRACE_EVENT0("webrtc", "PeerConnection::CreateDataChannel");
|
| +#ifdef HAVE_QUIC
|
| + if (session_->data_channel_type() == cricket::DCT_QUIC) {
|
| + // TODO(mikescarlett): Handle case when config is NULL.
|
| + if (!config) {
|
| + LOG(LS_ERROR) << "Missing config for QUIC data channel.";
|
| + return nullptr;
|
| + }
|
| + // TODO(mikescarlett): Allow unreliable or ordered QUIC data channels.
|
| + if (!config->reliable || config->ordered) {
|
| + LOG(LS_ERROR) << "QUIC data channel does not implement unreliable or "
|
| + "ordered delivery.";
|
| + return nullptr;
|
| + }
|
| + return session_->quic_data_transport()->CreateDataChannel(label, config);
|
| + }
|
| +#endif // HAVE_QUIC
|
| +
|
| bool first_datachannel = !HasDataChannels();
|
|
|
| std::unique_ptr<InternalDataChannelInit> internal_config;
|
| @@ -1579,8 +1596,8 @@ bool PeerConnection::GetOptionsForOffer(
|
| (session_options->has_audio() || session_options->has_video() ||
|
| session_options->has_data());
|
|
|
| - if (session_->data_channel_type() == cricket::DCT_SCTP && HasDataChannels()) {
|
| - session_options->data_channel_type = cricket::DCT_SCTP;
|
| + if (HasDataChannels()) {
|
| + session_options->data_channel_type = session_->data_channel_type();
|
| }
|
|
|
| session_options->rtcp_cname = rtcp_cname_;
|
| @@ -1608,9 +1625,7 @@ void PeerConnection::FinishOptionsForAnswer(
|
| // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams
|
| // are not signaled in the SDP so does not go through that path and must be
|
| // handled here.
|
| - if (session_->data_channel_type() == cricket::DCT_SCTP) {
|
| - session_options->data_channel_type = cricket::DCT_SCTP;
|
| - }
|
| + session_options->data_channel_type = session_->data_channel_type();
|
| }
|
|
|
| bool PeerConnection::GetOptionsForAnswer(
|
| @@ -2013,7 +2028,13 @@ rtc::scoped_refptr<DataChannel> PeerConnection::InternalCreateDataChannel(
|
| }
|
|
|
| bool PeerConnection::HasDataChannels() const {
|
| +#ifdef HAVE_QUIC
|
| + return !rtp_data_channels_.empty() || !sctp_data_channels_.empty() ||
|
| + (session_->quic_data_transport() &&
|
| + session_->quic_data_transport()->HasDataChannels());
|
| +#else
|
| return !rtp_data_channels_.empty() || !sctp_data_channels_.empty();
|
| +#endif // HAVE_QUIC
|
| }
|
|
|
| void PeerConnection::AllocateSctpSids(rtc::SSLRole role) {
|
|
|