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

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel.cc

Issue 2005573002: Move the ICE state transition ASSERTS to a lower level. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing patch conflict. Created 4 years, 7 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
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 // is added, deleted, or the write state of any connection changes so that the 1205 // is added, deleted, or the write state of any connection changes so that the
1206 // transport controller will get the up-to-date channel state. However it 1206 // transport controller will get the up-to-date channel state. However it
1207 // should not be called too often; in the case that multiple connection states 1207 // should not be called too often; in the case that multiple connection states
1208 // change, it should be called after all the connection states have changed. For 1208 // change, it should be called after all the connection states have changed. For
1209 // example, we call this at the end of SortConnections. 1209 // example, we call this at the end of SortConnections.
1210 void P2PTransportChannel::UpdateState() { 1210 void P2PTransportChannel::UpdateState() {
1211 TransportChannelState state = ComputeState(); 1211 TransportChannelState state = ComputeState();
1212 if (state_ != state) { 1212 if (state_ != state) {
1213 LOG_J(LS_INFO, this) << "Transport channel state changed from " << state_ 1213 LOG_J(LS_INFO, this) << "Transport channel state changed from " << state_
1214 << " to " << state; 1214 << " to " << state;
1215 // Check that the requested transition is allowed. Note that
1216 // P2PTransportChannel does not (yet) implement a direct mapping of the ICE
1217 // states from the standard; the difference is covered by
1218 // TransportController and PeerConnection.
1219 switch (state_) {
1220 case STATE_INIT:
1221 // TODO(deadbeef): Once we implement end-of-candidates signaling,
1222 // we shouldn't go from INIT to COMPLETED.
1223 RTC_DCHECK(state == STATE_CONNECTING || state == STATE_COMPLETED);
1224 break;
1225 case STATE_CONNECTING:
1226 RTC_DCHECK(state == STATE_COMPLETED || state == STATE_FAILED);
1227 break;
1228 case STATE_COMPLETED:
1229 // TODO(deadbeef): Once we implement end-of-candidates signaling,
1230 // we shouldn't go from COMPLETED to CONNECTING.
1231 // Though we *can* go from COMPlETED to FAILED, if consent expires.
1232 RTC_DCHECK(state == STATE_CONNECTING || state == STATE_FAILED);
1233 break;
1234 case STATE_FAILED:
1235 // TODO(deadbeef): Once we implement end-of-candidates signaling,
1236 // we shouldn't go from FAILED to CONNECTING or COMPLETED.
1237 RTC_DCHECK(state == STATE_CONNECTING || state == STATE_COMPLETED);
1238 break;
1239 default:
1240 RTC_DCHECK(false);
1241 break;
1242 }
1215 state_ = state; 1243 state_ = state;
1216 SignalStateChanged(this); 1244 SignalStateChanged(this);
1217 } 1245 }
1218 1246
1219 bool writable = best_connection_ && best_connection_->writable(); 1247 bool writable = best_connection_ && best_connection_->writable();
1220 set_writable(writable); 1248 set_writable(writable);
1221 1249
1222 bool receiving = false; 1250 bool receiving = false;
1223 for (const Connection* connection : connections_) { 1251 for (const Connection* connection : connections_) {
1224 if (connection->receiving()) { 1252 if (connection->receiving()) {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 1695
1668 // During the initial state when nothing has been pinged yet, return the first 1696 // During the initial state when nothing has been pinged yet, return the first
1669 // one in the ordered |connections_|. 1697 // one in the ordered |connections_|.
1670 return *(std::find_if(connections_.begin(), connections_.end(), 1698 return *(std::find_if(connections_.begin(), connections_.end(),
1671 [conn1, conn2](Connection* conn) { 1699 [conn1, conn2](Connection* conn) {
1672 return conn == conn1 || conn == conn2; 1700 return conn == conn1 || conn == conn2;
1673 })); 1701 }));
1674 } 1702 }
1675 1703
1676 } // namespace cricket 1704 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698