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

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: Merging with master. 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
« no previous file with comments | « webrtc/api/peerconnection.h ('k') | webrtc/api/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 CreateSessionDescriptionObserver* observer, 1489 CreateSessionDescriptionObserver* observer,
1494 const std::string& error) { 1490 const std::string& error) {
1495 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); 1491 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer);
1496 msg->error = error; 1492 msg->error = error;
1497 signaling_thread()->Post(this, MSG_CREATE_SESSIONDESCRIPTION_FAILED, msg); 1493 signaling_thread()->Post(this, MSG_CREATE_SESSIONDESCRIPTION_FAILED, msg);
1498 } 1494 }
1499 1495
1500 bool PeerConnection::GetOptionsForOffer( 1496 bool PeerConnection::GetOptionsForOffer(
1501 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, 1497 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
1502 cricket::MediaSessionOptions* session_options) { 1498 cricket::MediaSessionOptions* session_options) {
1499 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of
1500 // ContentInfos.
1501 if (session_->local_description()) {
1502 for (const cricket::ContentInfo& content :
1503 session_->local_description()->description()->contents()) {
1504 session_options->transport_options[content.name] =
1505 cricket::TransportOptions();
1506 }
1507 }
1503 if (!ConvertRtcOptionsForOffer(rtc_options, session_options)) { 1508 if (!ConvertRtcOptionsForOffer(rtc_options, session_options)) {
1504 return false; 1509 return false;
1505 } 1510 }
1506 1511
1507 AddSendStreams(session_options, senders_, rtp_data_channels_); 1512 AddSendStreams(session_options, senders_, rtp_data_channels_);
1508 // Offer to receive audio/video if the constraint is not set and there are 1513 // Offer to receive audio/video if the constraint is not set and there are
1509 // send streams, or we're currently receiving. 1514 // send streams, or we're currently receiving.
1510 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) { 1515 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) {
1511 session_options->recv_audio = 1516 session_options->recv_audio =
1512 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) || 1517 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) ||
(...skipping 13 matching lines...) Expand all
1526 session_options->data_channel_type = cricket::DCT_SCTP; 1531 session_options->data_channel_type = cricket::DCT_SCTP;
1527 } 1532 }
1528 return true; 1533 return true;
1529 } 1534 }
1530 1535
1531 bool PeerConnection::GetOptionsForAnswer( 1536 bool PeerConnection::GetOptionsForAnswer(
1532 const MediaConstraintsInterface* constraints, 1537 const MediaConstraintsInterface* constraints,
1533 cricket::MediaSessionOptions* session_options) { 1538 cricket::MediaSessionOptions* session_options) {
1534 session_options->recv_audio = false; 1539 session_options->recv_audio = false;
1535 session_options->recv_video = false; 1540 session_options->recv_video = false;
1541 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of
1542 // ContentInfos.
1543 if (session_->remote_description()) {
1544 // Initialize the transport_options map.
1545 for (const cricket::ContentInfo& content :
1546 session_->remote_description()->description()->contents()) {
1547 session_options->transport_options[content.name] =
1548 cricket::TransportOptions();
1549 }
1550 }
1536 if (!ParseConstraintsForAnswer(constraints, session_options)) { 1551 if (!ParseConstraintsForAnswer(constraints, session_options)) {
1537 return false; 1552 return false;
1538 } 1553 }
1539 1554
1540 AddSendStreams(session_options, senders_, rtp_data_channels_); 1555 AddSendStreams(session_options, senders_, rtp_data_channels_);
1541 session_options->bundle_enabled = 1556 session_options->bundle_enabled =
1542 session_options->bundle_enabled && 1557 session_options->bundle_enabled &&
1543 (session_options->has_audio() || session_options->has_video() || 1558 (session_options->has_audio() || session_options->has_video() ||
1544 session_options->has_data()); 1559 session_options->has_data());
1545 1560
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { 2093 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const {
2079 for (const auto& channel : sctp_data_channels_) { 2094 for (const auto& channel : sctp_data_channels_) {
2080 if (channel->id() == sid) { 2095 if (channel->id() == sid) {
2081 return channel; 2096 return channel;
2082 } 2097 }
2083 } 2098 }
2084 return nullptr; 2099 return nullptr;
2085 } 2100 }
2086 2101
2087 } // namespace webrtc 2102 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/peerconnection.h ('k') | webrtc/api/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698