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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 bool Get() const { 425 bool Get() const {
426 return ice_restart_; 426 return ice_restart_;
427 } 427 }
428 428
429 void Reset() { 429 void Reset() {
430 if (ice_restart_) { 430 if (ice_restart_) {
431 ice_restart_ = false; 431 ice_restart_ = false;
432 } 432 }
433 } 433 }
434 434
435 void CheckForRemoteIceRestart( 435 bool CheckForRemoteIceRestart(const SessionDescriptionInterface* old_desc,
436 const SessionDescriptionInterface* old_desc, 436 const SessionDescriptionInterface* new_desc) {
437 const SessionDescriptionInterface* new_desc) {
438 if (!old_desc || new_desc->type() != SessionDescriptionInterface::kOffer) { 437 if (!old_desc || new_desc->type() != SessionDescriptionInterface::kOffer) {
439 return; 438 return false;
440 } 439 }
441 const SessionDescription* new_sd = new_desc->description(); 440 const SessionDescription* new_sd = new_desc->description();
442 const SessionDescription* old_sd = old_desc->description(); 441 const SessionDescription* old_sd = old_desc->description();
443 const ContentInfos& contents = new_sd->contents(); 442 const ContentInfos& contents = new_sd->contents();
444 for (size_t index = 0; index < contents.size(); ++index) { 443 for (size_t index = 0; index < contents.size(); ++index) {
445 const ContentInfo* cinfo = &contents[index]; 444 const ContentInfo* cinfo = &contents[index];
446 if (cinfo->rejected) { 445 if (cinfo->rejected) {
447 continue; 446 continue;
448 } 447 }
449 // If the content isn't rejected, check if ufrag and password has 448 // If the content isn't rejected, check if ufrag and password has
450 // changed. 449 // changed.
451 const cricket::TransportDescription* new_transport_desc = 450 const cricket::TransportDescription* new_transport_desc =
452 new_sd->GetTransportDescriptionByName(cinfo->name); 451 new_sd->GetTransportDescriptionByName(cinfo->name);
453 const cricket::TransportDescription* old_transport_desc = 452 const cricket::TransportDescription* old_transport_desc =
454 old_sd->GetTransportDescriptionByName(cinfo->name); 453 old_sd->GetTransportDescriptionByName(cinfo->name);
455 if (!new_transport_desc || !old_transport_desc) { 454 if (!new_transport_desc || !old_transport_desc) {
456 // No transport description exist. This is not an ice restart. 455 // No transport description exist. This is not an ice restart.
457 continue; 456 continue;
458 } 457 }
459 if (cricket::IceCredentialsChanged(old_transport_desc->ice_ufrag, 458 if (cricket::IceCredentialsChanged(old_transport_desc->ice_ufrag,
460 old_transport_desc->ice_pwd, 459 old_transport_desc->ice_pwd,
461 new_transport_desc->ice_ufrag, 460 new_transport_desc->ice_ufrag,
462 new_transport_desc->ice_pwd)) { 461 new_transport_desc->ice_pwd)) {
463 LOG(LS_INFO) << "Remote peer request ice restart."; 462 LOG(LS_INFO) << "Remote peer request ice restart.";
464 ice_restart_ = true; 463 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
465 break; 464 return true;
466 } 465 }
467 } 466 }
467 return false;
468 } 468 }
469 469
470 private: 470 private:
471 bool ice_restart_; 471 bool ice_restart_;
472 }; 472 };
473 473
474 WebRtcSession::WebRtcSession( 474 WebRtcSession::WebRtcSession(
475 cricket::ChannelManager* channel_manager, 475 cricket::ChannelManager* channel_manager,
476 rtc::Thread* signaling_thread, 476 rtc::Thread* signaling_thread,
477 rtc::Thread* worker_thread, 477 rtc::Thread* worker_thread,
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 831 }
832 832
833 // Update remote MediaStreams. 833 // Update remote MediaStreams.
834 mediastream_signaling_->OnRemoteDescriptionChanged(desc); 834 mediastream_signaling_->OnRemoteDescriptionChanged(desc);
835 if (local_description() && !UseCandidatesInSessionDescription(desc)) { 835 if (local_description() && !UseCandidatesInSessionDescription(desc)) {
836 return BadRemoteSdp(desc->type(), kInvalidCandidates, err_desc); 836 return BadRemoteSdp(desc->type(), kInvalidCandidates, err_desc);
837 } 837 }
838 838
839 // Copy all saved candidates. 839 // Copy all saved candidates.
840 CopySavedCandidates(desc); 840 CopySavedCandidates(desc);
841 // We retain all received candidates. 841
842 WebRtcSessionDescriptionFactory::CopyCandidatesFromSessionDescription(
843 remote_desc_.get(), desc);
844 // Check if this new SessionDescription contains new ice ufrag and password 842 // Check if this new SessionDescription contains new ice ufrag and password
845 // that indicates the remote peer requests ice restart. 843 // that indicates the remote peer requests ice restart.
846 ice_restart_latch_->CheckForRemoteIceRestart(remote_desc_.get(), 844 bool ice_restart =
847 desc); 845 ice_restart_latch_->CheckForRemoteIceRestart(remote_desc_.get(), desc);
846 // 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.
847 if (!ice_restart) {
848 WebRtcSessionDescriptionFactory::CopyCandidatesFromSessionDescription(
849 remote_desc_.get(), desc);
850 }
851
848 remote_desc_.reset(desc_temp.release()); 852 remote_desc_.reset(desc_temp.release());
849 853
850 rtc::SSLRole role; 854 rtc::SSLRole role;
851 if (data_channel_type_ == cricket::DCT_SCTP && GetSslRole(&role)) { 855 if (data_channel_type_ == cricket::DCT_SCTP && GetSslRole(&role)) {
852 mediastream_signaling_->OnDtlsRoleReadyForSctp(role); 856 mediastream_signaling_->OnDtlsRoleReadyForSctp(role);
853 } 857 }
854 858
855 if (error() != cricket::BaseSession::ERROR_NONE) { 859 if (error() != cricket::BaseSession::ERROR_NONE) {
856 return BadRemoteSdp(desc->type(), GetSessionErrorMsg(), err_desc); 860 return BadRemoteSdp(desc->type(), GetSessionErrorMsg(), err_desc);
857 } 861 }
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 } 1503 }
1500 } 1504 }
1501 return content_found; 1505 return content_found;
1502 } 1506 }
1503 1507
1504 bool WebRtcSession::UseCandidatesInSessionDescription( 1508 bool WebRtcSession::UseCandidatesInSessionDescription(
1505 const SessionDescriptionInterface* remote_desc) { 1509 const SessionDescriptionInterface* remote_desc) {
1506 if (!remote_desc) 1510 if (!remote_desc)
1507 return true; 1511 return true;
1508 bool ret = true; 1512 bool ret = true;
1509
1510 for (size_t m = 0; m < remote_desc->number_of_mediasections(); ++m) { 1513 for (size_t m = 0; m < remote_desc->number_of_mediasections(); ++m) {
1511 const IceCandidateCollection* candidates = remote_desc->candidates(m); 1514 const IceCandidateCollection* candidates = remote_desc->candidates(m);
1512 for (size_t n = 0; n < candidates->count(); ++n) { 1515 for (size_t n = 0; n < candidates->count(); ++n) {
1513 const IceCandidateInterface* candidate = candidates->at(n); 1516 const IceCandidateInterface* candidate = candidates->at(n);
1514 bool valid = false; 1517 bool valid = false;
1515 if (!ReadyToUseRemoteCandidate(candidate, remote_desc, &valid)) { 1518 if (!ReadyToUseRemoteCandidate(candidate, remote_desc, &valid)) {
1516 if (valid) { 1519 if (valid) {
1517 LOG(LS_INFO) << "UseCandidatesInSessionDescription: Candidate saved."; 1520 LOG(LS_INFO) << "UseCandidatesInSessionDescription: Candidate saved.";
1518 saved_candidates_.push_back( 1521 saved_candidates_.push_back(
1519 new JsepIceCandidate(candidate->sdp_mid(), 1522 new JsepIceCandidate(candidate->sdp_mid(),
1520 candidate->sdp_mline_index(), 1523 candidate->sdp_mline_index(),
1521 candidate->candidate())); 1524 candidate->candidate()));
1522 } 1525 }
1523 continue; 1526 continue;
1524 } 1527 }
1525
1526 ret = UseCandidate(candidate); 1528 ret = UseCandidate(candidate);
1527 if (!ret) 1529 if (!ret)
1528 break; 1530 break;
1529 } 1531 }
1530 } 1532 }
1531 return ret; 1533 return ret;
1532 } 1534 }
1533 1535
1534 bool WebRtcSession::UseCandidate( 1536 bool WebRtcSession::UseCandidate(
1535 const IceCandidateInterface* candidate) { 1537 const IceCandidateInterface* candidate) {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 1962
1961 if (!srtp_cipher.empty()) { 1963 if (!srtp_cipher.empty()) {
1962 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); 1964 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher);
1963 } 1965 }
1964 if (!ssl_cipher.empty()) { 1966 if (!ssl_cipher.empty()) {
1965 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); 1967 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher);
1966 } 1968 }
1967 } 1969 }
1968 1970
1969 } // namespace webrtc 1971 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | webrtc/p2p/base/p2ptransportchannel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698