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