Index: talk/app/webrtc/peerconnection.cc |
diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc |
index 41df847cd68ddaa344c703def4549aa3ed81701d..121565593d718c83e2f884268a59c3e090691a1a 100644 |
--- a/talk/app/webrtc/peerconnection.cc |
+++ b/talk/app/webrtc/peerconnection.cc |
@@ -616,6 +616,10 @@ void PeerConnection::SetLocalDescription( |
} |
SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); |
signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); |
+ // MaybeStartGathering needs to be called after posting |
+ // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates |
+ // before signaling that SetLocalDescription completed. |
+ session_->MaybeStartGathering(); |
} |
void PeerConnection::SetRemoteDescription( |
@@ -868,6 +872,11 @@ void PeerConnection::OnRemoveLocalStream(MediaStreamInterface* stream) { |
void PeerConnection::OnIceConnectionChange( |
PeerConnectionInterface::IceConnectionState new_state) { |
ASSERT(signaling_thread()->IsCurrent()); |
+ // After transitioning to "closed", ignore any additional states from |
+ // WebRtcSession (such as "disconnected"). |
+ if (ice_connection_state_ == kIceConnectionClosed) { |
+ return; |
+ } |
ice_connection_state_ = new_state; |
observer_->OnIceConnectionChange(ice_connection_state_); |
} |