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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« webrtc/api/webrtcsession.cc ('K') | « webrtc/api/webrtcsession.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 2801c446461679011e091ccd5fd5af46dcb81cdf..0294f1b41154134e8af990994810aec4b238c7ce 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -1209,8 +1209,43 @@ void P2PTransportChannel::SwitchBestConnectionTo(Connection* conn) {
// change, it should be called after all the connection states have changed. For
// example, we call this at the end of SortConnections.
void P2PTransportChannel::UpdateState() {
+ TransportChannelState old_state = state_;
state_ = ComputeState();
+ if (old_state != state_) {
+ LOG_J(LS_INFO, this) << "Changing TransportChannelState " << old_state
+ << " => " << state_;
+
+ // Check that the requested transition is allowed. Note that
+ // P2PTransportChannel does not (yet) implement a direct mapping of the ICE
+ // states from the standard; the difference is covered by
+ // TransportController and PeerConnection.
+ switch (old_state) {
+ case STATE_INIT:
+ // TODO(deadbeef): Once we implement end-of-candidates signaling,
+ // we shouldn't go from INIT to COMPLETED.
+ RTC_DCHECK(state_ == STATE_CONNECTING || state_ == STATE_COMPLETED);
+ break;
+ case STATE_CONNECTING:
+ RTC_DCHECK(state_ == STATE_COMPLETED || state_ == STATE_FAILED);
+ break;
+ case STATE_COMPLETED:
+ // TODO(deadbeef): Once we implement end-of-candidates signaling,
+ // we shouldn't go from COMPLETED to CONNECTING.
+ // Though we *can* go from COMPlETED to FAILED, if consent expires.
+ RTC_DCHECK(state_ == STATE_CONNECTING || state_ == STATE_FAILED);
+ break;
+ case STATE_FAILED:
+ // TODO(deadbeef): Once we implement end-of-candidates signaling,
+ // we shouldn't go from FAILED to CONNECTING or COMPLETED.
+ RTC_DCHECK(state_ == STATE_CONNECTING || state_ == STATE_COMPLETED);
+ break;
+ default:
+ RTC_DCHECK(false);
+ break;
+ }
+ }
+
bool writable = best_connection_ && best_connection_->writable();
set_writable(writable);
« webrtc/api/webrtcsession.cc ('K') | « webrtc/api/webrtcsession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698