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

Side by Side Diff: webrtc/api/peerconnection.cc

Issue 1671173002: Track pending ICE restarts independently for different media sections. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Extend ICE restart test to check that a second answer has new credentials. Created 4 years, 10 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 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 437 }
438 438
439 if (rtc_options.offer_to_receive_audio != RTCOfferAnswerOptions::kUndefined) { 439 if (rtc_options.offer_to_receive_audio != RTCOfferAnswerOptions::kUndefined) {
440 session_options->recv_audio = (rtc_options.offer_to_receive_audio > 0); 440 session_options->recv_audio = (rtc_options.offer_to_receive_audio > 0);
441 } 441 }
442 if (rtc_options.offer_to_receive_video != RTCOfferAnswerOptions::kUndefined) { 442 if (rtc_options.offer_to_receive_video != RTCOfferAnswerOptions::kUndefined) {
443 session_options->recv_video = (rtc_options.offer_to_receive_video > 0); 443 session_options->recv_video = (rtc_options.offer_to_receive_video > 0);
444 } 444 }
445 445
446 session_options->vad_enabled = rtc_options.voice_activity_detection; 446 session_options->vad_enabled = rtc_options.voice_activity_detection;
447 session_options->audio_transport_options.ice_restart =
448 rtc_options.ice_restart;
449 session_options->video_transport_options.ice_restart =
450 rtc_options.ice_restart;
451 session_options->data_transport_options.ice_restart = rtc_options.ice_restart;
452 session_options->bundle_enabled = rtc_options.use_rtp_mux; 447 session_options->bundle_enabled = rtc_options.use_rtp_mux;
448 for (auto& kv : session_options->transport_options) {
449 kv.second.ice_restart = rtc_options.ice_restart;
450 }
453 451
454 return true; 452 return true;
455 } 453 }
456 454
457 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, 455 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints,
458 cricket::MediaSessionOptions* session_options) { 456 cricket::MediaSessionOptions* session_options) {
459 bool value = false; 457 bool value = false;
460 size_t mandatory_constraints_satisfied = 0; 458 size_t mandatory_constraints_satisfied = 0;
461 459
462 // kOfferToReceiveAudio defaults to true according to spec. 460 // kOfferToReceiveAudio defaults to true according to spec.
(...skipping 22 matching lines...) Expand all
485 } 483 }
486 484
487 if (FindConstraint(constraints, MediaConstraintsInterface::kUseRtpMux, &value, 485 if (FindConstraint(constraints, MediaConstraintsInterface::kUseRtpMux, &value,
488 &mandatory_constraints_satisfied)) { 486 &mandatory_constraints_satisfied)) {
489 session_options->bundle_enabled = value; 487 session_options->bundle_enabled = value;
490 } else { 488 } else {
491 // kUseRtpMux defaults to true according to spec. 489 // kUseRtpMux defaults to true according to spec.
492 session_options->bundle_enabled = true; 490 session_options->bundle_enabled = true;
493 } 491 }
494 492
493 bool ice_restart = false;
495 if (FindConstraint(constraints, MediaConstraintsInterface::kIceRestart, 494 if (FindConstraint(constraints, MediaConstraintsInterface::kIceRestart,
496 &value, &mandatory_constraints_satisfied)) { 495 &value, &mandatory_constraints_satisfied)) {
497 session_options->audio_transport_options.ice_restart = value;
498 session_options->video_transport_options.ice_restart = value;
499 session_options->data_transport_options.ice_restart = value;
500 } else {
501 // kIceRestart defaults to false according to spec. 496 // kIceRestart defaults to false according to spec.
502 session_options->audio_transport_options.ice_restart = false; 497 ice_restart = true;
503 session_options->video_transport_options.ice_restart = false; 498 }
504 session_options->data_transport_options.ice_restart = false; 499 for (auto& kv : session_options->transport_options) {
500 kv.second.ice_restart = ice_restart;
505 } 501 }
506 502
507 if (!constraints) { 503 if (!constraints) {
508 return true; 504 return true;
509 } 505 }
510 return mandatory_constraints_satisfied == constraints->GetMandatory().size(); 506 return mandatory_constraints_satisfied == constraints->GetMandatory().size();
511 } 507 }
512 508
513 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, 509 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers,
514 cricket::ServerAddresses* stun_servers, 510 cricket::ServerAddresses* stun_servers,
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 CreateSessionDescriptionObserver* observer, 1476 CreateSessionDescriptionObserver* observer,
1481 const std::string& error) { 1477 const std::string& error) {
1482 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); 1478 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer);
1483 msg->error = error; 1479 msg->error = error;
1484 signaling_thread()->Post(this, MSG_CREATE_SESSIONDESCRIPTION_FAILED, msg); 1480 signaling_thread()->Post(this, MSG_CREATE_SESSIONDESCRIPTION_FAILED, msg);
1485 } 1481 }
1486 1482
1487 bool PeerConnection::GetOptionsForOffer( 1483 bool PeerConnection::GetOptionsForOffer(
1488 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, 1484 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
1489 cricket::MediaSessionOptions* session_options) { 1485 cricket::MediaSessionOptions* session_options) {
1486 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of
1487 // ContentInfos.
1488 if (session_->local_description()) {
1489 for (const cricket::ContentInfo& content :
1490 session_->local_description()->description()->contents()) {
1491 session_options->transport_options[content.name] =
1492 cricket::TransportOptions();
1493 }
1494 }
1490 if (!ConvertRtcOptionsForOffer(rtc_options, session_options)) { 1495 if (!ConvertRtcOptionsForOffer(rtc_options, session_options)) {
1491 return false; 1496 return false;
1492 } 1497 }
1493 1498
1494 AddSendStreams(session_options, senders_, rtp_data_channels_); 1499 AddSendStreams(session_options, senders_, rtp_data_channels_);
1495 // Offer to receive audio/video if the constraint is not set and there are 1500 // Offer to receive audio/video if the constraint is not set and there are
1496 // send streams, or we're currently receiving. 1501 // send streams, or we're currently receiving.
1497 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) { 1502 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) {
1498 session_options->recv_audio = 1503 session_options->recv_audio =
1499 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) || 1504 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) ||
(...skipping 13 matching lines...) Expand all
1513 session_options->data_channel_type = cricket::DCT_SCTP; 1518 session_options->data_channel_type = cricket::DCT_SCTP;
1514 } 1519 }
1515 return true; 1520 return true;
1516 } 1521 }
1517 1522
1518 bool PeerConnection::GetOptionsForAnswer( 1523 bool PeerConnection::GetOptionsForAnswer(
1519 const MediaConstraintsInterface* constraints, 1524 const MediaConstraintsInterface* constraints,
1520 cricket::MediaSessionOptions* session_options) { 1525 cricket::MediaSessionOptions* session_options) {
1521 session_options->recv_audio = false; 1526 session_options->recv_audio = false;
1522 session_options->recv_video = false; 1527 session_options->recv_video = false;
1528 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of
1529 // ContentInfos.
1530 if (session_->remote_description()) {
1531 // Initialize the transport_options map.
1532 for (const cricket::ContentInfo& content :
1533 session_->remote_description()->description()->contents()) {
1534 session_options->transport_options[content.name] =
1535 cricket::TransportOptions();
1536 }
1537 }
1523 if (!ParseConstraintsForAnswer(constraints, session_options)) { 1538 if (!ParseConstraintsForAnswer(constraints, session_options)) {
1524 return false; 1539 return false;
1525 } 1540 }
1526 1541
1527 AddSendStreams(session_options, senders_, rtp_data_channels_); 1542 AddSendStreams(session_options, senders_, rtp_data_channels_);
1528 session_options->bundle_enabled = 1543 session_options->bundle_enabled =
1529 session_options->bundle_enabled && 1544 session_options->bundle_enabled &&
1530 (session_options->has_audio() || session_options->has_video() || 1545 (session_options->has_audio() || session_options->has_video() ||
1531 session_options->has_data()); 1546 session_options->has_data());
1532 1547
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { 2080 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const {
2066 for (const auto& channel : sctp_data_channels_) { 2081 for (const auto& channel : sctp_data_channels_) {
2067 if (channel->id() == sid) { 2082 if (channel->id() == sid) {
2068 return channel; 2083 return channel;
2069 } 2084 }
2070 } 2085 }
2071 return nullptr; 2086 return nullptr;
2072 } 2087 }
2073 2088
2074 } // namespace webrtc 2089 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698