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 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 if (rtc::starts_with(data_desc->protocol().data(), | 1252 if (rtc::starts_with(data_desc->protocol().data(), |
1253 cricket::kMediaProtocolRtpPrefix)) { | 1253 cricket::kMediaProtocolRtpPrefix)) { |
1254 UpdateLocalRtpDataChannels(data_desc->streams()); | 1254 UpdateLocalRtpDataChannels(data_desc->streams()); |
1255 } | 1255 } |
1256 } | 1256 } |
1257 | 1257 |
1258 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); | 1258 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); |
1259 signaling_thread()->Post(RTC_FROM_HERE, this, | 1259 signaling_thread()->Post(RTC_FROM_HERE, this, |
1260 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); | 1260 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); |
1261 | 1261 |
| 1262 // According to JSEP, after setLocalDescription, changing the candidate pool |
| 1263 // size is not allowed, and changing the set of ICE servers will not result |
| 1264 // in new candidates being gathered. |
| 1265 port_allocator_->FreezeCandidatePool(); |
| 1266 |
1262 // MaybeStartGathering needs to be called after posting | 1267 // MaybeStartGathering needs to be called after posting |
1263 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates | 1268 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates |
1264 // before signaling that SetLocalDescription completed. | 1269 // before signaling that SetLocalDescription completed. |
1265 session_->MaybeStartGathering(); | 1270 session_->MaybeStartGathering(); |
| 1271 |
| 1272 if (desc->type() == SessionDescriptionInterface::kAnswer) { |
| 1273 // TODO(deadbeef): We already had to hop to the network thread for |
| 1274 // MaybeStartGathering... |
| 1275 network_thread()->Invoke<void>( |
| 1276 RTC_FROM_HERE, |
| 1277 rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, |
| 1278 port_allocator_.get())); |
| 1279 } |
1266 } | 1280 } |
1267 | 1281 |
1268 void PeerConnection::SetRemoteDescription( | 1282 void PeerConnection::SetRemoteDescription( |
1269 SetSessionDescriptionObserver* observer, | 1283 SetSessionDescriptionObserver* observer, |
1270 SessionDescriptionInterface* desc) { | 1284 SessionDescriptionInterface* desc) { |
1271 TRACE_EVENT0("webrtc", "PeerConnection::SetRemoteDescription"); | 1285 TRACE_EVENT0("webrtc", "PeerConnection::SetRemoteDescription"); |
1272 if (IsClosed()) { | 1286 if (IsClosed()) { |
1273 return; | 1287 return; |
1274 } | 1288 } |
1275 if (!observer) { | 1289 if (!observer) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 observer_->OnAddStream(new_stream); | 1380 observer_->OnAddStream(new_stream); |
1367 observer_->OnAddStream( | 1381 observer_->OnAddStream( |
1368 rtc::scoped_refptr<MediaStreamInterface>(new_stream)); | 1382 rtc::scoped_refptr<MediaStreamInterface>(new_stream)); |
1369 } | 1383 } |
1370 | 1384 |
1371 UpdateEndedRemoteMediaStreams(); | 1385 UpdateEndedRemoteMediaStreams(); |
1372 | 1386 |
1373 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); | 1387 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); |
1374 signaling_thread()->Post(RTC_FROM_HERE, this, | 1388 signaling_thread()->Post(RTC_FROM_HERE, this, |
1375 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); | 1389 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); |
| 1390 |
| 1391 if (desc->type() == SessionDescriptionInterface::kAnswer) { |
| 1392 // TODO(deadbeef): We already had to hop to the network thread for |
| 1393 // MaybeStartGathering... |
| 1394 network_thread()->Invoke<void>( |
| 1395 RTC_FROM_HERE, |
| 1396 rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, |
| 1397 port_allocator_.get())); |
| 1398 } |
1376 } | 1399 } |
1377 | 1400 |
1378 PeerConnectionInterface::RTCConfiguration PeerConnection::GetConfiguration() { | 1401 PeerConnectionInterface::RTCConfiguration PeerConnection::GetConfiguration() { |
1379 return configuration_; | 1402 return configuration_; |
1380 } | 1403 } |
1381 | 1404 |
1382 bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration, | 1405 bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration, |
1383 RTCError* error) { | 1406 RTCError* error) { |
1384 TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration"); | 1407 TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration"); |
1385 | 1408 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 } | 1554 } |
1532 | 1555 |
1533 void PeerConnection::Close() { | 1556 void PeerConnection::Close() { |
1534 TRACE_EVENT0("webrtc", "PeerConnection::Close"); | 1557 TRACE_EVENT0("webrtc", "PeerConnection::Close"); |
1535 // Update stats here so that we have the most recent stats for tracks and | 1558 // Update stats here so that we have the most recent stats for tracks and |
1536 // streams before the channels are closed. | 1559 // streams before the channels are closed. |
1537 stats_->UpdateStats(kStatsOutputLevelStandard); | 1560 stats_->UpdateStats(kStatsOutputLevelStandard); |
1538 | 1561 |
1539 session_->Close(); | 1562 session_->Close(); |
1540 event_log_.reset(); | 1563 event_log_.reset(); |
| 1564 network_thread()->Invoke<void>( |
| 1565 RTC_FROM_HERE, |
| 1566 rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, |
| 1567 port_allocator_.get())); |
1541 } | 1568 } |
1542 | 1569 |
1543 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, | 1570 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, |
1544 WebRtcSession::State state) { | 1571 WebRtcSession::State state) { |
1545 switch (state) { | 1572 switch (state) { |
1546 case WebRtcSession::STATE_INIT: | 1573 case WebRtcSession::STATE_INIT: |
1547 ChangeSignalingState(PeerConnectionInterface::kStable); | 1574 ChangeSignalingState(PeerConnectionInterface::kStable); |
1548 break; | 1575 break; |
1549 case WebRtcSession::STATE_SENTOFFER: | 1576 case WebRtcSession::STATE_SENTOFFER: |
1550 ChangeSignalingState(PeerConnectionInterface::kHaveLocalOffer); | 1577 ChangeSignalingState(PeerConnectionInterface::kHaveLocalOffer); |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 } | 2588 } |
2562 return event_log_->StartLogging(file, max_size_bytes); | 2589 return event_log_->StartLogging(file, max_size_bytes); |
2563 } | 2590 } |
2564 | 2591 |
2565 void PeerConnection::StopRtcEventLog_w() { | 2592 void PeerConnection::StopRtcEventLog_w() { |
2566 if (event_log_) { | 2593 if (event_log_) { |
2567 event_log_->StopLogging(); | 2594 event_log_->StopLogging(); |
2568 } | 2595 } |
2569 } | 2596 } |
2570 } // namespace webrtc | 2597 } // namespace webrtc |
OLD | NEW |