Chromium Code Reviews| Index: webrtc/api/peerconnection.cc |
| diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc |
| index b2b8062ca843a00015851e2f9a735d53e13fee0f..1fc1eb11016c0304d8a724644a40c76f762655c6 100644 |
| --- a/webrtc/api/peerconnection.cc |
| +++ b/webrtc/api/peerconnection.cc |
| @@ -596,6 +596,10 @@ bool PeerConnection::Initialize( |
| this, &PeerConnection::OnDataChannelDestroyed); |
| session_->SignalDataChannelOpenMessage.connect( |
| this, &PeerConnection::OnDataChannelOpenMessage); |
| +#ifdef HAVE_QUIC |
| + session_->SignalQuicTransportChannelCreated.connect( |
| + this, &PeerConnection::OnQuicTransportChannelCreated); |
| +#endif // HAVE_QUIC |
| return true; |
| } |
| @@ -833,6 +837,24 @@ 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 quic_data_transport_.CreateDataChannel( |
| + session_->signaling_thread(), session_->worker_thread(), label, config); |
| + } |
| +#endif // HAVE_QUIC |
| + |
| bool first_datachannel = !HasDataChannels(); |
| rtc::scoped_ptr<InternalDataChannelInit> internal_config; |
| @@ -1500,8 +1522,12 @@ 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()) { |
| + if (session_->data_channel_type() == cricket::DCT_SCTP) { |
| + session_options->data_channel_type = cricket::DCT_SCTP; |
| + } else if (session_->data_channel_type() == cricket::DCT_QUIC) { |
| + session_options->data_channel_type = cricket::DCT_QUIC; |
|
pthatcher1
2016/04/12 00:58:38
Why not just do session_options->data_channel_type
mikescarlett
2016/04/13 16:53:37
Sure I'll do that. I didn't know if RTP data chann
|
| + } |
| } |
| return true; |
| } |
| @@ -1530,6 +1556,9 @@ void PeerConnection::FinishOptionsForAnswer( |
| if (session_->data_channel_type() == cricket::DCT_SCTP) { |
| session_options->data_channel_type = cricket::DCT_SCTP; |
| } |
| + if (session_->data_channel_type() == cricket::DCT_QUIC) { |
| + session_options->data_channel_type = cricket::DCT_QUIC; |
| + } |
|
pthatcher1
2016/04/12 00:58:38
Same here.
mikescarlett
2016/04/13 16:53:37
Done.
|
| } |
| bool PeerConnection::GetOptionsForAnswer( |
| @@ -1921,7 +1950,12 @@ rtc::scoped_refptr<DataChannel> PeerConnection::InternalCreateDataChannel( |
| } |
| bool PeerConnection::HasDataChannels() const { |
| +#ifdef HAVE_QUIC |
| + return !rtp_data_channels_.empty() || !sctp_data_channels_.empty() || |
| + quic_data_transport_.HasDataChannels(); |
| +#else |
| return !rtp_data_channels_.empty() || !sctp_data_channels_.empty(); |
| +#endif // HAVE_QUIC |
| } |
| void PeerConnection::AllocateSctpSids(rtc::SSLRole role) { |
| @@ -2064,4 +2098,11 @@ DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { |
| return nullptr; |
| } |
| +#ifdef HAVE_QUIC |
| +void PeerConnection::OnQuicTransportChannelCreated( |
| + cricket::QuicTransportChannel* channel) { |
| + quic_data_transport_.SetTransportChannel(channel); |
| +} |
| +#endif // HAVE_QUIC |
| + |
| } // namespace webrtc |