OLD | NEW |
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 bool Get() const { | 485 bool Get() const { |
486 return ice_restart_; | 486 return ice_restart_; |
487 } | 487 } |
488 | 488 |
489 void Reset() { | 489 void Reset() { |
490 if (ice_restart_) { | 490 if (ice_restart_) { |
491 ice_restart_ = false; | 491 ice_restart_ = false; |
492 } | 492 } |
493 } | 493 } |
494 | 494 |
| 495 // This method has two purposes: 1. Return whether |new_desc| requests |
| 496 // an ICE restart (i.e., new ufrag/pwd). 2. If it requests an ICE restart |
| 497 // and it is an OFFER, remember this in |ice_restart_| so that the next |
| 498 // Local Answer will be created with new ufrag and pwd. |
495 bool CheckForRemoteIceRestart(const SessionDescriptionInterface* old_desc, | 499 bool CheckForRemoteIceRestart(const SessionDescriptionInterface* old_desc, |
496 const SessionDescriptionInterface* new_desc) { | 500 const SessionDescriptionInterface* new_desc) { |
497 if (!old_desc || new_desc->type() != SessionDescriptionInterface::kOffer) { | 501 if (!old_desc) { |
498 return false; | 502 return false; |
499 } | 503 } |
500 const SessionDescription* new_sd = new_desc->description(); | 504 const SessionDescription* new_sd = new_desc->description(); |
501 const SessionDescription* old_sd = old_desc->description(); | 505 const SessionDescription* old_sd = old_desc->description(); |
502 const ContentInfos& contents = new_sd->contents(); | 506 const ContentInfos& contents = new_sd->contents(); |
503 for (size_t index = 0; index < contents.size(); ++index) { | 507 for (size_t index = 0; index < contents.size(); ++index) { |
504 const ContentInfo* cinfo = &contents[index]; | 508 const ContentInfo* cinfo = &contents[index]; |
505 if (cinfo->rejected) { | 509 if (cinfo->rejected) { |
506 continue; | 510 continue; |
507 } | 511 } |
508 // If the content isn't rejected, check if ufrag and password has | 512 // If the content isn't rejected, check if ufrag and password has |
509 // changed. | 513 // changed. |
510 const cricket::TransportDescription* new_transport_desc = | 514 const cricket::TransportDescription* new_transport_desc = |
511 new_sd->GetTransportDescriptionByName(cinfo->name); | 515 new_sd->GetTransportDescriptionByName(cinfo->name); |
512 const cricket::TransportDescription* old_transport_desc = | 516 const cricket::TransportDescription* old_transport_desc = |
513 old_sd->GetTransportDescriptionByName(cinfo->name); | 517 old_sd->GetTransportDescriptionByName(cinfo->name); |
514 if (!new_transport_desc || !old_transport_desc) { | 518 if (!new_transport_desc || !old_transport_desc) { |
515 // No transport description exist. This is not an ice restart. | 519 // No transport description exist. This is not an ice restart. |
516 continue; | 520 continue; |
517 } | 521 } |
518 if (cricket::IceCredentialsChanged(old_transport_desc->ice_ufrag, | 522 if (cricket::IceCredentialsChanged(old_transport_desc->ice_ufrag, |
519 old_transport_desc->ice_pwd, | 523 old_transport_desc->ice_pwd, |
520 new_transport_desc->ice_ufrag, | 524 new_transport_desc->ice_ufrag, |
521 new_transport_desc->ice_pwd)) { | 525 new_transport_desc->ice_pwd)) { |
522 LOG(LS_INFO) << "Remote peer request ice restart."; | 526 LOG(LS_INFO) << "Remote peer request ice restart."; |
523 ice_restart_ = true; | 527 if (new_desc->type() == SessionDescriptionInterface::kOffer) { |
| 528 ice_restart_ = true; |
| 529 } |
524 return true; | 530 return true; |
525 } | 531 } |
526 } | 532 } |
527 return false; | 533 return false; |
528 } | 534 } |
529 | 535 |
530 private: | 536 private: |
531 bool ice_restart_; | 537 bool ice_restart_; |
532 }; | 538 }; |
533 | 539 |
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2189 } | 2195 } |
2190 } | 2196 } |
2191 | 2197 |
2192 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2198 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
2193 const rtc::SentPacket& sent_packet) { | 2199 const rtc::SentPacket& sent_packet) { |
2194 RTC_DCHECK(worker_thread()->IsCurrent()); | 2200 RTC_DCHECK(worker_thread()->IsCurrent()); |
2195 media_controller_->call_w()->OnSentPacket(sent_packet); | 2201 media_controller_->call_w()->OnSentPacket(sent_packet); |
2196 } | 2202 } |
2197 | 2203 |
2198 } // namespace webrtc | 2204 } // namespace webrtc |
OLD | NEW |