Index: webrtc/p2p/base/p2ptransportchannel.cc |
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc |
index 46ed40ad76f9ced65929339594e5757ae435bb32..94eb01754d459111533fa7f9a7c71e9e5e3223d1 100644 |
--- a/webrtc/p2p/base/p2ptransportchannel.cc |
+++ b/webrtc/p2p/base/p2ptransportchannel.cc |
@@ -666,6 +666,17 @@ void P2PTransportChannel::OnUseCandidate(Connection* conn) { |
void P2PTransportChannel::OnCandidate(const Candidate& candidate) { |
ASSERT(worker_thread_ == rtc::Thread::Current()); |
+ uint32 generation = candidate.generation(); |
+ // Network may not guarantee the order of the candidate delivery. If a |
+ // remote candidate with an older generation arrives, drop it. |
+ if (generation != 0 && generation < remote_candidate_generation_) { |
+ LOG(LS_WARNING) << "Dropping a remote candidate because its generation " |
+ << generation |
+ << " is lower than the current remote generation " |
+ << remote_candidate_generation_; |
+ return; |
+ } |
+ |
// Create connections to this remote candidate. |
CreateConnections(candidate, NULL, false); |