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

Side by Side Diff: webrtc/api/peerconnection.cc

Issue 2206793007: Revert of Modified PeerConnection and WebRtcSession for end-to-end QuicDataChannel usage. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/api/peerconnection_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 PeerConnectionInterface::IceGatheringState 900 PeerConnectionInterface::IceGatheringState
901 PeerConnection::ice_gathering_state() { 901 PeerConnection::ice_gathering_state() {
902 return ice_gathering_state_; 902 return ice_gathering_state_;
903 } 903 }
904 904
905 rtc::scoped_refptr<DataChannelInterface> 905 rtc::scoped_refptr<DataChannelInterface>
906 PeerConnection::CreateDataChannel( 906 PeerConnection::CreateDataChannel(
907 const std::string& label, 907 const std::string& label,
908 const DataChannelInit* config) { 908 const DataChannelInit* config) {
909 TRACE_EVENT0("webrtc", "PeerConnection::CreateDataChannel"); 909 TRACE_EVENT0("webrtc", "PeerConnection::CreateDataChannel");
910 #ifdef HAVE_QUIC
911 if (session_->data_channel_type() == cricket::DCT_QUIC) {
912 // TODO(zhihuang): Handle case when config is NULL.
913 if (!config) {
914 LOG(LS_ERROR) << "Missing config for QUIC data channel.";
915 return nullptr;
916 }
917 // TODO(zhihuang): Allow unreliable or ordered QUIC data channels.
918 if (!config->reliable || config->ordered) {
919 LOG(LS_ERROR) << "QUIC data channel does not implement unreliable or "
920 "ordered delivery.";
921 return nullptr;
922 }
923 return session_->quic_data_transport()->CreateDataChannel(label, config);
924 }
925 #endif // HAVE_QUIC
926
927 bool first_datachannel = !HasDataChannels(); 910 bool first_datachannel = !HasDataChannels();
928 911
929 std::unique_ptr<InternalDataChannelInit> internal_config; 912 std::unique_ptr<InternalDataChannelInit> internal_config;
930 if (config) { 913 if (config) {
931 internal_config.reset(new InternalDataChannelInit(*config)); 914 internal_config.reset(new InternalDataChannelInit(*config));
932 } 915 }
933 rtc::scoped_refptr<DataChannelInterface> channel( 916 rtc::scoped_refptr<DataChannelInterface> channel(
934 InternalCreateDataChannel(label, internal_config.get())); 917 InternalCreateDataChannel(label, internal_config.get()));
935 if (!channel.get()) { 918 if (!channel.get()) {
936 return nullptr; 919 return nullptr;
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 if (rtc_options.offer_to_receive_video == RTCOfferAnswerOptions::kUndefined) { 1611 if (rtc_options.offer_to_receive_video == RTCOfferAnswerOptions::kUndefined) {
1629 session_options->recv_video = 1612 session_options->recv_video =
1630 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO) || 1613 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO) ||
1631 !remote_video_tracks_.empty(); 1614 !remote_video_tracks_.empty();
1632 } 1615 }
1633 session_options->bundle_enabled = 1616 session_options->bundle_enabled =
1634 session_options->bundle_enabled && 1617 session_options->bundle_enabled &&
1635 (session_options->has_audio() || session_options->has_video() || 1618 (session_options->has_audio() || session_options->has_video() ||
1636 session_options->has_data()); 1619 session_options->has_data());
1637 1620
1638 if (HasDataChannels()) { 1621 if (session_->data_channel_type() == cricket::DCT_SCTP && HasDataChannels()) {
1639 session_options->data_channel_type = session_->data_channel_type(); 1622 session_options->data_channel_type = cricket::DCT_SCTP;
1640 } 1623 }
1641 1624
1642 session_options->rtcp_cname = rtcp_cname_; 1625 session_options->rtcp_cname = rtcp_cname_;
1643 session_options->crypto_options = factory_->options().crypto_options; 1626 session_options->crypto_options = factory_->options().crypto_options;
1644 return true; 1627 return true;
1645 } 1628 }
1646 1629
1647 void PeerConnection::FinishOptionsForAnswer( 1630 void PeerConnection::FinishOptionsForAnswer(
1648 cricket::MediaSessionOptions* session_options) { 1631 cricket::MediaSessionOptions* session_options) {
1649 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of 1632 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of
1650 // ContentInfos. 1633 // ContentInfos.
1651 if (session_->remote_description()) { 1634 if (session_->remote_description()) {
1652 // Initialize the transport_options map. 1635 // Initialize the transport_options map.
1653 for (const cricket::ContentInfo& content : 1636 for (const cricket::ContentInfo& content :
1654 session_->remote_description()->description()->contents()) { 1637 session_->remote_description()->description()->contents()) {
1655 session_options->transport_options[content.name] = 1638 session_options->transport_options[content.name] =
1656 cricket::TransportOptions(); 1639 cricket::TransportOptions();
1657 } 1640 }
1658 } 1641 }
1659 AddSendStreams(session_options, senders_, rtp_data_channels_); 1642 AddSendStreams(session_options, senders_, rtp_data_channels_);
1660 session_options->bundle_enabled = 1643 session_options->bundle_enabled =
1661 session_options->bundle_enabled && 1644 session_options->bundle_enabled &&
1662 (session_options->has_audio() || session_options->has_video() || 1645 (session_options->has_audio() || session_options->has_video() ||
1663 session_options->has_data()); 1646 session_options->has_data());
1664 1647
1665 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams 1648 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams
1666 // are not signaled in the SDP so does not go through that path and must be 1649 // are not signaled in the SDP so does not go through that path and must be
1667 // handled here. 1650 // handled here.
1668 session_options->data_channel_type = session_->data_channel_type(); 1651 if (session_->data_channel_type() == cricket::DCT_SCTP) {
1652 session_options->data_channel_type = cricket::DCT_SCTP;
1653 }
1669 session_options->crypto_options = factory_->options().crypto_options; 1654 session_options->crypto_options = factory_->options().crypto_options;
1670 } 1655 }
1671 1656
1672 bool PeerConnection::GetOptionsForAnswer( 1657 bool PeerConnection::GetOptionsForAnswer(
1673 const MediaConstraintsInterface* constraints, 1658 const MediaConstraintsInterface* constraints,
1674 cricket::MediaSessionOptions* session_options) { 1659 cricket::MediaSessionOptions* session_options) {
1675 session_options->recv_audio = false; 1660 session_options->recv_audio = false;
1676 session_options->recv_video = false; 1661 session_options->recv_video = false;
1677 if (!ParseConstraintsForAnswer(constraints, session_options)) { 1662 if (!ParseConstraintsForAnswer(constraints, session_options)) {
1678 return false; 1663 return false;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 RTC_DCHECK(channel->data_channel_type() == cricket::DCT_SCTP); 2047 RTC_DCHECK(channel->data_channel_type() == cricket::DCT_SCTP);
2063 sctp_data_channels_.push_back(channel); 2048 sctp_data_channels_.push_back(channel);
2064 channel->SignalClosed.connect(this, 2049 channel->SignalClosed.connect(this,
2065 &PeerConnection::OnSctpDataChannelClosed); 2050 &PeerConnection::OnSctpDataChannelClosed);
2066 } 2051 }
2067 2052
2068 return channel; 2053 return channel;
2069 } 2054 }
2070 2055
2071 bool PeerConnection::HasDataChannels() const { 2056 bool PeerConnection::HasDataChannels() const {
2072 #ifdef HAVE_QUIC
2073 return !rtp_data_channels_.empty() || !sctp_data_channels_.empty() ||
2074 (session_->quic_data_transport() &&
2075 session_->quic_data_transport()->HasDataChannels());
2076 #else
2077 return !rtp_data_channels_.empty() || !sctp_data_channels_.empty(); 2057 return !rtp_data_channels_.empty() || !sctp_data_channels_.empty();
2078 #endif // HAVE_QUIC
2079 } 2058 }
2080 2059
2081 void PeerConnection::AllocateSctpSids(rtc::SSLRole role) { 2060 void PeerConnection::AllocateSctpSids(rtc::SSLRole role) {
2082 for (const auto& channel : sctp_data_channels_) { 2061 for (const auto& channel : sctp_data_channels_) {
2083 if (channel->id() < 0) { 2062 if (channel->id() < 0) {
2084 int sid; 2063 int sid;
2085 if (!sid_allocator_.AllocateSid(role, &sid)) { 2064 if (!sid_allocator_.AllocateSid(role, &sid)) {
2086 LOG(LS_ERROR) << "Failed to allocate SCTP sid."; 2065 LOG(LS_ERROR) << "Failed to allocate SCTP sid.";
2087 continue; 2066 continue;
2088 } 2067 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 2291
2313 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, 2292 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,
2314 int64_t max_size_bytes) { 2293 int64_t max_size_bytes) {
2315 return media_controller_->call_w()->StartEventLog(file, max_size_bytes); 2294 return media_controller_->call_w()->StartEventLog(file, max_size_bytes);
2316 } 2295 }
2317 2296
2318 void PeerConnection::StopRtcEventLog_w() { 2297 void PeerConnection::StopRtcEventLog_w() {
2319 media_controller_->call_w()->StopEventLog(); 2298 media_controller_->call_w()->StopEventLog();
2320 } 2299 }
2321 } // namespace webrtc 2300 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/peerconnection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698