OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 #include "webrtc/api/videocapturertracksource.h" | 31 #include "webrtc/api/videocapturertracksource.h" |
32 #include "webrtc/api/videotrack.h" | 32 #include "webrtc/api/videotrack.h" |
33 #include "webrtc/base/arraysize.h" | 33 #include "webrtc/base/arraysize.h" |
34 #include "webrtc/base/bind.h" | 34 #include "webrtc/base/bind.h" |
35 #include "webrtc/base/logging.h" | 35 #include "webrtc/base/logging.h" |
36 #include "webrtc/base/stringencode.h" | 36 #include "webrtc/base/stringencode.h" |
37 #include "webrtc/base/stringutils.h" | 37 #include "webrtc/base/stringutils.h" |
38 #include "webrtc/base/trace_event.h" | 38 #include "webrtc/base/trace_event.h" |
39 #include "webrtc/call/call.h" | 39 #include "webrtc/call/call.h" |
40 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 40 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
41 #include "webrtc/media/sctp/sctptransport.h" | 41 #include "webrtc/media/sctp/sctpdataengine.h" |
42 #include "webrtc/pc/channelmanager.h" | 42 #include "webrtc/pc/channelmanager.h" |
43 #include "webrtc/system_wrappers/include/field_trial.h" | 43 #include "webrtc/system_wrappers/include/field_trial.h" |
44 | 44 |
45 namespace { | 45 namespace { |
46 | 46 |
47 using webrtc::DataChannel; | 47 using webrtc::DataChannel; |
48 using webrtc::MediaConstraintsInterface; | 48 using webrtc::MediaConstraintsInterface; |
49 using webrtc::MediaStreamInterface; | 49 using webrtc::MediaStreamInterface; |
50 using webrtc::PeerConnectionInterface; | 50 using webrtc::PeerConnectionInterface; |
51 using webrtc::RtpSenderInternal; | 51 using webrtc::RtpSenderInternal; |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 media_controller_.reset(factory_->CreateMediaController( | 645 media_controller_.reset(factory_->CreateMediaController( |
646 configuration.media_config, event_log_.get())); | 646 configuration.media_config, event_log_.get())); |
647 | 647 |
648 session_.reset(new WebRtcSession( | 648 session_.reset(new WebRtcSession( |
649 media_controller_.get(), factory_->network_thread(), | 649 media_controller_.get(), factory_->network_thread(), |
650 factory_->worker_thread(), factory_->signaling_thread(), | 650 factory_->worker_thread(), factory_->signaling_thread(), |
651 port_allocator_.get(), | 651 port_allocator_.get(), |
652 std::unique_ptr<cricket::TransportController>( | 652 std::unique_ptr<cricket::TransportController>( |
653 factory_->CreateTransportController( | 653 factory_->CreateTransportController( |
654 port_allocator_.get(), | 654 port_allocator_.get(), |
655 configuration.redetermine_role_on_ice_restart)), | 655 configuration.redetermine_role_on_ice_restart)))); |
656 #ifdef HAVE_SCTP | |
657 std::unique_ptr<cricket::SctpTransportInternalFactory>( | |
658 new cricket::SctpTransportFactory(factory_->network_thread())) | |
659 #else | |
660 nullptr | |
661 #endif | |
662 )); | |
663 | 656 |
664 stats_.reset(new StatsCollector(this)); | 657 stats_.reset(new StatsCollector(this)); |
665 stats_collector_ = RTCStatsCollector::Create(this); | 658 stats_collector_ = RTCStatsCollector::Create(this); |
666 | 659 |
667 // Initialize the WebRtcSession. It creates transport channels etc. | 660 // Initialize the WebRtcSession. It creates transport channels etc. |
668 if (!session_->Initialize(factory_->options(), std::move(cert_generator), | 661 if (!session_->Initialize(factory_->options(), std::move(cert_generator), |
669 configuration)) { | 662 configuration)) { |
670 return false; | 663 return false; |
671 } | 664 } |
672 | 665 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 std::string error; | 1112 std::string error; |
1120 if (!session_->SetLocalDescription(desc, &error)) { | 1113 if (!session_->SetLocalDescription(desc, &error)) { |
1121 PostSetSessionDescriptionFailure(observer, error); | 1114 PostSetSessionDescriptionFailure(observer, error); |
1122 return; | 1115 return; |
1123 } | 1116 } |
1124 | 1117 |
1125 // If setting the description decided our SSL role, allocate any necessary | 1118 // If setting the description decided our SSL role, allocate any necessary |
1126 // SCTP sids. | 1119 // SCTP sids. |
1127 rtc::SSLRole role; | 1120 rtc::SSLRole role; |
1128 if (session_->data_channel_type() == cricket::DCT_SCTP && | 1121 if (session_->data_channel_type() == cricket::DCT_SCTP && |
1129 session_->GetSctpSslRole(&role)) { | 1122 session_->GetSslRole(session_->data_channel(), &role)) { |
1130 AllocateSctpSids(role); | 1123 AllocateSctpSids(role); |
1131 } | 1124 } |
1132 | 1125 |
1133 // Update state and SSRC of local MediaStreams and DataChannels based on the | 1126 // Update state and SSRC of local MediaStreams and DataChannels based on the |
1134 // local session description. | 1127 // local session description. |
1135 const cricket::ContentInfo* audio_content = | 1128 const cricket::ContentInfo* audio_content = |
1136 GetFirstAudioContent(desc->description()); | 1129 GetFirstAudioContent(desc->description()); |
1137 if (audio_content) { | 1130 if (audio_content) { |
1138 if (audio_content->rejected) { | 1131 if (audio_content->rejected) { |
1139 RemoveTracks(cricket::MEDIA_TYPE_AUDIO); | 1132 RemoveTracks(cricket::MEDIA_TYPE_AUDIO); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 std::string error; | 1194 std::string error; |
1202 if (!session_->SetRemoteDescription(desc, &error)) { | 1195 if (!session_->SetRemoteDescription(desc, &error)) { |
1203 PostSetSessionDescriptionFailure(observer, error); | 1196 PostSetSessionDescriptionFailure(observer, error); |
1204 return; | 1197 return; |
1205 } | 1198 } |
1206 | 1199 |
1207 // If setting the description decided our SSL role, allocate any necessary | 1200 // If setting the description decided our SSL role, allocate any necessary |
1208 // SCTP sids. | 1201 // SCTP sids. |
1209 rtc::SSLRole role; | 1202 rtc::SSLRole role; |
1210 if (session_->data_channel_type() == cricket::DCT_SCTP && | 1203 if (session_->data_channel_type() == cricket::DCT_SCTP && |
1211 session_->GetSctpSslRole(&role)) { | 1204 session_->GetSslRole(session_->data_channel(), &role)) { |
1212 AllocateSctpSids(role); | 1205 AllocateSctpSids(role); |
1213 } | 1206 } |
1214 | 1207 |
1215 const cricket::SessionDescription* remote_desc = desc->description(); | 1208 const cricket::SessionDescription* remote_desc = desc->description(); |
1216 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc); | 1209 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc); |
1217 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc); | 1210 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc); |
1218 const cricket::AudioContentDescription* audio_desc = | 1211 const cricket::AudioContentDescription* audio_desc = |
1219 GetFirstAudioContentDescription(remote_desc); | 1212 GetFirstAudioContentDescription(remote_desc); |
1220 const cricket::VideoContentDescription* video_desc = | 1213 const cricket::VideoContentDescription* video_desc = |
1221 GetFirstVideoContentDescription(remote_desc); | 1214 GetFirstVideoContentDescription(remote_desc); |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2143 if (session_->data_channel_type() == cricket::DCT_NONE) { | 2136 if (session_->data_channel_type() == cricket::DCT_NONE) { |
2144 LOG(LS_ERROR) | 2137 LOG(LS_ERROR) |
2145 << "InternalCreateDataChannel: Data is not supported in this call."; | 2138 << "InternalCreateDataChannel: Data is not supported in this call."; |
2146 return nullptr; | 2139 return nullptr; |
2147 } | 2140 } |
2148 InternalDataChannelInit new_config = | 2141 InternalDataChannelInit new_config = |
2149 config ? (*config) : InternalDataChannelInit(); | 2142 config ? (*config) : InternalDataChannelInit(); |
2150 if (session_->data_channel_type() == cricket::DCT_SCTP) { | 2143 if (session_->data_channel_type() == cricket::DCT_SCTP) { |
2151 if (new_config.id < 0) { | 2144 if (new_config.id < 0) { |
2152 rtc::SSLRole role; | 2145 rtc::SSLRole role; |
2153 if ((session_->GetSctpSslRole(&role)) && | 2146 if ((session_->GetSslRole(session_->data_channel(), &role)) && |
2154 !sid_allocator_.AllocateSid(role, &new_config.id)) { | 2147 !sid_allocator_.AllocateSid(role, &new_config.id)) { |
2155 LOG(LS_ERROR) << "No id can be allocated for the SCTP data channel."; | 2148 LOG(LS_ERROR) << "No id can be allocated for the SCTP data channel."; |
2156 return nullptr; | 2149 return nullptr; |
2157 } | 2150 } |
2158 } else if (!sid_allocator_.ReserveSid(new_config.id)) { | 2151 } else if (!sid_allocator_.ReserveSid(new_config.id)) { |
2159 LOG(LS_ERROR) << "Failed to create a SCTP data channel " | 2152 LOG(LS_ERROR) << "Failed to create a SCTP data channel " |
2160 << "because the id is already in use or out of range."; | 2153 << "because the id is already in use or out of range."; |
2161 return nullptr; | 2154 return nullptr; |
2162 } | 2155 } |
2163 } | 2156 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 | 2423 |
2431 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, | 2424 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, |
2432 int64_t max_size_bytes) { | 2425 int64_t max_size_bytes) { |
2433 return event_log_->StartLogging(file, max_size_bytes); | 2426 return event_log_->StartLogging(file, max_size_bytes); |
2434 } | 2427 } |
2435 | 2428 |
2436 void PeerConnection::StopRtcEventLog_w() { | 2429 void PeerConnection::StopRtcEventLog_w() { |
2437 event_log_->StopLogging(); | 2430 event_log_->StopLogging(); |
2438 } | 2431 } |
2439 } // namespace webrtc | 2432 } // namespace webrtc |
OLD | NEW |