Index: talk/app/webrtc/webrtcsession.cc |
diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc |
index 2533328968945e4c2c67a2694e95ae8d19c288ea..42deec150bb605bb1e21e9343adf485012e7c35e 100644 |
--- a/talk/app/webrtc/webrtcsession.cc |
+++ b/talk/app/webrtc/webrtcsession.cc |
@@ -432,11 +432,10 @@ class IceRestartAnswerLatch { |
} |
} |
- void CheckForRemoteIceRestart( |
- const SessionDescriptionInterface* old_desc, |
- const SessionDescriptionInterface* new_desc) { |
+ bool CheckForRemoteIceRestart(const SessionDescriptionInterface* old_desc, |
+ const SessionDescriptionInterface* new_desc) { |
if (!old_desc || new_desc->type() != SessionDescriptionInterface::kOffer) { |
- return; |
+ return false; |
} |
const SessionDescription* new_sd = new_desc->description(); |
const SessionDescription* old_sd = old_desc->description(); |
@@ -462,9 +461,10 @@ class IceRestartAnswerLatch { |
new_transport_desc->ice_pwd)) { |
LOG(LS_INFO) << "Remote peer request ice restart."; |
ice_restart_ = true; |
pthatcher1
2015/07/29 21:09:42
Instead of setting ice_restart_ here, can you move
honghaiz3
2015/07/30 17:16:16
It was called outside the class and we cannot set
|
- break; |
+ return true; |
} |
} |
+ return false; |
} |
private: |
@@ -838,13 +838,17 @@ bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc, |
// Copy all saved candidates. |
CopySavedCandidates(desc); |
- // We retain all received candidates. |
- WebRtcSessionDescriptionFactory::CopyCandidatesFromSessionDescription( |
- remote_desc_.get(), desc); |
+ |
// Check if this new SessionDescription contains new ice ufrag and password |
// that indicates the remote peer requests ice restart. |
- ice_restart_latch_->CheckForRemoteIceRestart(remote_desc_.get(), |
- desc); |
+ bool ice_restart = |
+ ice_restart_latch_->CheckForRemoteIceRestart(remote_desc_.get(), desc); |
+ // We retain all received candidates unless ICE is restarted; |
pthatcher1
2015/07/29 21:09:42
Can you expand the comment to explain in more deta
honghaiz3
2015/07/30 17:16:16
Done.
|
+ if (!ice_restart) { |
+ WebRtcSessionDescriptionFactory::CopyCandidatesFromSessionDescription( |
+ remote_desc_.get(), desc); |
+ } |
+ |
remote_desc_.reset(desc_temp.release()); |
rtc::SSLRole role; |
@@ -1506,7 +1510,6 @@ bool WebRtcSession::UseCandidatesInSessionDescription( |
if (!remote_desc) |
return true; |
bool ret = true; |
- |
for (size_t m = 0; m < remote_desc->number_of_mediasections(); ++m) { |
const IceCandidateCollection* candidates = remote_desc->candidates(m); |
for (size_t n = 0; n < candidates->count(); ++n) { |
@@ -1522,7 +1525,6 @@ bool WebRtcSession::UseCandidatesInSessionDescription( |
} |
continue; |
} |
- |
ret = UseCandidate(candidate); |
if (!ret) |
break; |