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

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

Issue 2717893003: Making candidate pool size behave as decided in JSEP. (Closed)
Patch Set: Get rid of now-unnecessary test. Created 3 years, 9 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 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 if (rtc::starts_with(data_desc->protocol().data(), 1273 if (rtc::starts_with(data_desc->protocol().data(),
1274 cricket::kMediaProtocolRtpPrefix)) { 1274 cricket::kMediaProtocolRtpPrefix)) {
1275 UpdateLocalRtpDataChannels(data_desc->streams()); 1275 UpdateLocalRtpDataChannels(data_desc->streams());
1276 } 1276 }
1277 } 1277 }
1278 1278
1279 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); 1279 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
1280 signaling_thread()->Post(RTC_FROM_HERE, this, 1280 signaling_thread()->Post(RTC_FROM_HERE, this,
1281 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); 1281 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
1282 1282
1283 // According to JSEP, after setLocalDescription, changing the candidate pool
1284 // size is not allowed, and changing the set of ICE servers will not result
1285 // in new candidates being gathered.
1286 port_allocator_->FreezeCandidatePool();
1287
1283 // MaybeStartGathering needs to be called after posting 1288 // MaybeStartGathering needs to be called after posting
1284 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates 1289 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates
1285 // before signaling that SetLocalDescription completed. 1290 // before signaling that SetLocalDescription completed.
1286 session_->MaybeStartGathering(); 1291 session_->MaybeStartGathering();
1292
1293 if (desc->type() == SessionDescriptionInterface::kAnswer) {
1294 // TODO(deadbeef): We already had to hop to the network thread for
1295 // MaybeStartGathering...
1296 network_thread()->Invoke<void>(
1297 RTC_FROM_HERE,
1298 rtc::Bind(&cricket::PortAllocator::DiscardPooledSessions,
1299 port_allocator_.get()));
1300 }
1287 } 1301 }
1288 1302
1289 void PeerConnection::SetRemoteDescription( 1303 void PeerConnection::SetRemoteDescription(
1290 SetSessionDescriptionObserver* observer, 1304 SetSessionDescriptionObserver* observer,
1291 SessionDescriptionInterface* desc) { 1305 SessionDescriptionInterface* desc) {
1292 TRACE_EVENT0("webrtc", "PeerConnection::SetRemoteDescription"); 1306 TRACE_EVENT0("webrtc", "PeerConnection::SetRemoteDescription");
1293 if (IsClosed()) { 1307 if (IsClosed()) {
1294 return; 1308 return;
1295 } 1309 }
1296 if (!observer) { 1310 if (!observer) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 observer_->OnAddStream(new_stream); 1401 observer_->OnAddStream(new_stream);
1388 observer_->OnAddStream( 1402 observer_->OnAddStream(
1389 rtc::scoped_refptr<MediaStreamInterface>(new_stream)); 1403 rtc::scoped_refptr<MediaStreamInterface>(new_stream));
1390 } 1404 }
1391 1405
1392 UpdateEndedRemoteMediaStreams(); 1406 UpdateEndedRemoteMediaStreams();
1393 1407
1394 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); 1408 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
1395 signaling_thread()->Post(RTC_FROM_HERE, this, 1409 signaling_thread()->Post(RTC_FROM_HERE, this,
1396 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); 1410 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
1411
1412 if (desc->type() == SessionDescriptionInterface::kAnswer) {
1413 // TODO(deadbeef): We already had to hop to the network thread for
1414 // MaybeStartGathering...
1415 network_thread()->Invoke<void>(
1416 RTC_FROM_HERE,
1417 rtc::Bind(&cricket::PortAllocator::DiscardPooledSessions,
1418 port_allocator_.get()));
1419 }
1397 } 1420 }
1398 1421
1399 PeerConnectionInterface::RTCConfiguration PeerConnection::GetConfiguration() { 1422 PeerConnectionInterface::RTCConfiguration PeerConnection::GetConfiguration() {
1400 return configuration_; 1423 return configuration_;
1401 } 1424 }
1402 1425
1403 bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration, 1426 bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration,
1404 RTCError* error) { 1427 RTCError* error) {
1405 TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration"); 1428 TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration");
1406 1429
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 } 1575 }
1553 1576
1554 void PeerConnection::Close() { 1577 void PeerConnection::Close() {
1555 TRACE_EVENT0("webrtc", "PeerConnection::Close"); 1578 TRACE_EVENT0("webrtc", "PeerConnection::Close");
1556 // Update stats here so that we have the most recent stats for tracks and 1579 // Update stats here so that we have the most recent stats for tracks and
1557 // streams before the channels are closed. 1580 // streams before the channels are closed.
1558 stats_->UpdateStats(kStatsOutputLevelStandard); 1581 stats_->UpdateStats(kStatsOutputLevelStandard);
1559 1582
1560 session_->Close(); 1583 session_->Close();
1561 event_log_.reset(); 1584 event_log_.reset();
1585 network_thread()->Invoke<void>(
1586 RTC_FROM_HERE,
1587 rtc::Bind(&cricket::PortAllocator::DiscardPooledSessions,
1588 port_allocator_.get()));
1562 } 1589 }
1563 1590
1564 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, 1591 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/,
1565 WebRtcSession::State state) { 1592 WebRtcSession::State state) {
1566 switch (state) { 1593 switch (state) {
1567 case WebRtcSession::STATE_INIT: 1594 case WebRtcSession::STATE_INIT:
1568 ChangeSignalingState(PeerConnectionInterface::kStable); 1595 ChangeSignalingState(PeerConnectionInterface::kStable);
1569 break; 1596 break;
1570 case WebRtcSession::STATE_SENTOFFER: 1597 case WebRtcSession::STATE_SENTOFFER:
1571 ChangeSignalingState(PeerConnectionInterface::kHaveLocalOffer); 1598 ChangeSignalingState(PeerConnectionInterface::kHaveLocalOffer);
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 } 2606 }
2580 return event_log_->StartLogging(file, max_size_bytes); 2607 return event_log_->StartLogging(file, max_size_bytes);
2581 } 2608 }
2582 2609
2583 void PeerConnection::StopRtcEventLog_w() { 2610 void PeerConnection::StopRtcEventLog_w() {
2584 if (event_log_) { 2611 if (event_log_) {
2585 event_log_->StopLogging(); 2612 event_log_->StopLogging();
2586 } 2613 }
2587 } 2614 }
2588 } // namespace webrtc 2615 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698