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

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

Issue 1844803002: Modify PeerConnection for end-to-end QuicDataChannel usage (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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
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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 PeerConnectionInterface::IceGatheringState 826 PeerConnectionInterface::IceGatheringState
827 PeerConnection::ice_gathering_state() { 827 PeerConnection::ice_gathering_state() {
828 return ice_gathering_state_; 828 return ice_gathering_state_;
829 } 829 }
830 830
831 rtc::scoped_refptr<DataChannelInterface> 831 rtc::scoped_refptr<DataChannelInterface>
832 PeerConnection::CreateDataChannel( 832 PeerConnection::CreateDataChannel(
833 const std::string& label, 833 const std::string& label,
834 const DataChannelInit* config) { 834 const DataChannelInit* config) {
835 TRACE_EVENT0("webrtc", "PeerConnection::CreateDataChannel"); 835 TRACE_EVENT0("webrtc", "PeerConnection::CreateDataChannel");
836 #ifdef USE_QUIC
837 // TODO(mikescarlett): Handle case when CreateDataChannel() is called
838 // before QUIC is specified in the session description.
Taylor Brandstetter 2016/04/01 23:23:41 Can't "use quic" be a parameter in RTCConfiguratio
mikescarlett 2016/04/05 19:58:49 This seems necessary since QUIC won't be negotiate
839 if (session_->data_channel_type() == cricket::DCT_QUIC) {
840 cricket::QuicTransportChannel* quic_transport_channel =
841 session_->quic_transport_channel();
842 RTC_DCHECK(quic_transport_channel != nullptr);
Taylor Brandstetter 2016/04/01 23:23:41 It should be possible to create a data channel eve
mikescarlett 2016/04/05 19:58:48 Fixed.
843 rtc::scoped_refptr<QuicDataChannel> channel(new QuicDataChannel(
844 quic_transport_channel, session_->signaling_thread(),
845 session_->worker_thread(), label, config));
846 quic_data_channels_.push_back(channel);
847 if (!quic_transport_) {
848 quic_transport_.reset(new QuicTransport(quic_transport_channel));
849 }
pthatcher1 2016/03/30 20:34:47 It seems like this should logically go a few lines
850 quic_transport_->RegisterDataChannel(channel);
851 return channel;
852 }
853 #endif // USE_QUIC
854
836 bool first_datachannel = !HasDataChannels(); 855 bool first_datachannel = !HasDataChannels();
837 856
838 rtc::scoped_ptr<InternalDataChannelInit> internal_config; 857 rtc::scoped_ptr<InternalDataChannelInit> internal_config;
839 if (config) { 858 if (config) {
840 internal_config.reset(new InternalDataChannelInit(*config)); 859 internal_config.reset(new InternalDataChannelInit(*config));
841 } 860 }
842 rtc::scoped_refptr<DataChannelInterface> channel( 861 rtc::scoped_refptr<DataChannelInterface> channel(
843 InternalCreateDataChannel(label, internal_config.get())); 862 InternalCreateDataChannel(label, internal_config.get()));
844 if (!channel.get()) { 863 if (!channel.get()) {
845 return nullptr; 864 return nullptr;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 1042
1024 const cricket::ContentInfo* data_content = 1043 const cricket::ContentInfo* data_content =
1025 GetFirstDataContent(desc->description()); 1044 GetFirstDataContent(desc->description());
1026 if (data_content) { 1045 if (data_content) {
1027 const cricket::DataContentDescription* data_desc = 1046 const cricket::DataContentDescription* data_desc =
1028 static_cast<const cricket::DataContentDescription*>( 1047 static_cast<const cricket::DataContentDescription*>(
1029 data_content->description); 1048 data_content->description);
1030 if (rtc::starts_with(data_desc->protocol().data(), 1049 if (rtc::starts_with(data_desc->protocol().data(),
1031 cricket::kMediaProtocolRtpPrefix)) { 1050 cricket::kMediaProtocolRtpPrefix)) {
1032 UpdateLocalRtpDataChannels(data_desc->streams()); 1051 UpdateLocalRtpDataChannels(data_desc->streams());
1033 } 1052 }
pthatcher 2016/03/30 22:59:48 An alternative to the TransportChannel storing a t
1034 } 1053 }
1035 1054
1036 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); 1055 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
1037 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); 1056 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
1038 1057
1039 // MaybeStartGathering needs to be called after posting 1058 // MaybeStartGathering needs to be called after posting
1040 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates 1059 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates
1041 // before signaling that SetLocalDescription completed. 1060 // before signaling that SetLocalDescription completed.
1042 session_->MaybeStartGathering(); 1061 session_->MaybeStartGathering();
1043 } 1062 }
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 RTC_DCHECK(channel->data_channel_type() == cricket::DCT_SCTP); 1933 RTC_DCHECK(channel->data_channel_type() == cricket::DCT_SCTP);
1915 sctp_data_channels_.push_back(channel); 1934 sctp_data_channels_.push_back(channel);
1916 channel->SignalClosed.connect(this, 1935 channel->SignalClosed.connect(this,
1917 &PeerConnection::OnSctpDataChannelClosed); 1936 &PeerConnection::OnSctpDataChannelClosed);
1918 } 1937 }
1919 1938
1920 return channel; 1939 return channel;
1921 } 1940 }
1922 1941
1923 bool PeerConnection::HasDataChannels() const { 1942 bool PeerConnection::HasDataChannels() const {
1924 return !rtp_data_channels_.empty() || !sctp_data_channels_.empty(); 1943 return !rtp_data_channels_.empty() || !sctp_data_channels_.empty();
Taylor Brandstetter 2016/04/01 23:23:41 || !quic_data_channels_.empty() This is used so t
mikescarlett 2016/04/05 19:58:49 Done.
1925 } 1944 }
1926 1945
1927 void PeerConnection::AllocateSctpSids(rtc::SSLRole role) { 1946 void PeerConnection::AllocateSctpSids(rtc::SSLRole role) {
1928 for (const auto& channel : sctp_data_channels_) { 1947 for (const auto& channel : sctp_data_channels_) {
1929 if (channel->id() < 0) { 1948 if (channel->id() < 0) {
1930 int sid; 1949 int sid;
1931 if (!sid_allocator_.AllocateSid(role, &sid)) { 1950 if (!sid_allocator_.AllocateSid(role, &sid)) {
1932 LOG(LS_ERROR) << "Failed to allocate SCTP sid."; 1951 LOG(LS_ERROR) << "Failed to allocate SCTP sid.";
1933 continue; 1952 continue;
1934 } 1953 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { 2077 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const {
2059 for (const auto& channel : sctp_data_channels_) { 2078 for (const auto& channel : sctp_data_channels_) {
2060 if (channel->id() == sid) { 2079 if (channel->id() == sid) {
2061 return channel; 2080 return channel;
2062 } 2081 }
2063 } 2082 }
2064 return nullptr; 2083 return nullptr;
2065 } 2084 }
2066 2085
2067 } // namespace webrtc 2086 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698