| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 // we shouldn't go from COMPLETED to CONNECTING. | 1413 // we shouldn't go from COMPLETED to CONNECTING. |
| 1414 // Though we *can* go from COMPlETED to FAILED, if consent expires. | 1414 // Though we *can* go from COMPlETED to FAILED, if consent expires. |
| 1415 RTC_DCHECK(state == STATE_CONNECTING || state == STATE_FAILED); | 1415 RTC_DCHECK(state == STATE_CONNECTING || state == STATE_FAILED); |
| 1416 break; | 1416 break; |
| 1417 case STATE_FAILED: | 1417 case STATE_FAILED: |
| 1418 // TODO(deadbeef): Once we implement end-of-candidates signaling, | 1418 // TODO(deadbeef): Once we implement end-of-candidates signaling, |
| 1419 // we shouldn't go from FAILED to CONNECTING or COMPLETED. | 1419 // we shouldn't go from FAILED to CONNECTING or COMPLETED. |
| 1420 RTC_DCHECK(state == STATE_CONNECTING || state == STATE_COMPLETED); | 1420 RTC_DCHECK(state == STATE_CONNECTING || state == STATE_COMPLETED); |
| 1421 break; | 1421 break; |
| 1422 default: | 1422 default: |
| 1423 RTC_DCHECK(false); | 1423 RTC_NOTREACHED(); |
| 1424 break; | 1424 break; |
| 1425 } | 1425 } |
| 1426 state_ = state; | 1426 state_ = state; |
| 1427 SignalStateChanged(this); | 1427 SignalStateChanged(this); |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 // If our selected connection is "presumed writable" (TURN-TURN with no | 1430 // If our selected connection is "presumed writable" (TURN-TURN with no |
| 1431 // CreatePermission required), act like we're already writable to the upper | 1431 // CreatePermission required), act like we're already writable to the upper |
| 1432 // layers, so they can start media quicker. | 1432 // layers, so they can start media quicker. |
| 1433 bool writable = | 1433 bool writable = |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 bool selected = conn == selected_connection_; | 1752 bool selected = conn == selected_connection_; |
| 1753 if (remote_ice_mode_ == ICEMODE_LITE) { | 1753 if (remote_ice_mode_ == ICEMODE_LITE) { |
| 1754 return selected && conn->writable(); | 1754 return selected && conn->writable(); |
| 1755 } | 1755 } |
| 1756 bool better_than_selected = | 1756 bool better_than_selected = |
| 1757 !selected_connection_ || !selected_connection_->writable() || | 1757 !selected_connection_ || !selected_connection_->writable() || |
| 1758 CompareConnectionCandidates(selected_connection_, conn) < 0; | 1758 CompareConnectionCandidates(selected_connection_, conn) < 0; |
| 1759 return selected || better_than_selected; | 1759 return selected || better_than_selected; |
| 1760 } | 1760 } |
| 1761 default: | 1761 default: |
| 1762 RTC_DCHECK(false); | 1762 RTC_NOTREACHED(); |
| 1763 return false; | 1763 return false; |
| 1764 } | 1764 } |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 // When a connection's state changes, we need to figure out who to use as | 1767 // When a connection's state changes, we need to figure out who to use as |
| 1768 // the selected connection again. It could have become usable, or become | 1768 // the selected connection again. It could have become usable, or become |
| 1769 // unusable. | 1769 // unusable. |
| 1770 void P2PTransportChannel::OnConnectionStateChange(Connection* connection) { | 1770 void P2PTransportChannel::OnConnectionStateChange(Connection* connection) { |
| 1771 ASSERT(network_thread_ == rtc::Thread::Current()); | 1771 ASSERT(network_thread_ == rtc::Thread::Current()); |
| 1772 | 1772 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2008 | 2008 |
| 2009 // During the initial state when nothing has been pinged yet, return the first | 2009 // During the initial state when nothing has been pinged yet, return the first |
| 2010 // one in the ordered |connections_|. | 2010 // one in the ordered |connections_|. |
| 2011 return *(std::find_if(connections_.begin(), connections_.end(), | 2011 return *(std::find_if(connections_.begin(), connections_.end(), |
| 2012 [conn1, conn2](Connection* conn) { | 2012 [conn1, conn2](Connection* conn) { |
| 2013 return conn == conn1 || conn == conn2; | 2013 return conn == conn1 || conn == conn2; |
| 2014 })); | 2014 })); |
| 2015 } | 2015 } |
| 2016 | 2016 |
| 2017 } // namespace cricket | 2017 } // namespace cricket |
| OLD | NEW |