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

Unified Diff: talk/app/webrtc/webrtcsession.cc

Issue 1248063002: Fix the generation mismatch assertion error. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | talk/app/webrtc/webrtcsession_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/webrtcsession.cc
diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc
index 2533328968945e4c2c67a2694e95ae8d19c288ea..b6a178cf392c2a671453de59da79410ac477b658 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;
- break;
+ return true;
}
}
+ return false;
}
private:
@@ -838,13 +838,19 @@ 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 only if ICE is not restarted.
+ // When ICE is restarted, all previous candidates belong to an old generation
+ // and should not be kept.
+ if (!ice_restart) {
+ WebRtcSessionDescriptionFactory::CopyCandidatesFromSessionDescription(
+ remote_desc_.get(), desc);
+ }
+
remote_desc_.reset(desc_temp.release());
rtc::SSLRole role;
@@ -1522,7 +1528,6 @@ bool WebRtcSession::UseCandidatesInSessionDescription(
}
continue;
}
-
ret = UseCandidate(candidate);
if (!ret)
break;
« no previous file with comments | « no previous file | talk/app/webrtc/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698