OLD | NEW |
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 } else if (is_offer) { | 463 } else if (is_offer) { |
464 session_options->recv_video = false; | 464 session_options->recv_video = false; |
465 } else { | 465 } else { |
466 session_options->recv_video = true; | 466 session_options->recv_video = true; |
467 } | 467 } |
468 | 468 |
469 session_options->vad_enabled = rtc_options.voice_activity_detection; | 469 session_options->vad_enabled = rtc_options.voice_activity_detection; |
470 session_options->bundle_enabled = rtc_options.use_rtp_mux; | 470 session_options->bundle_enabled = rtc_options.use_rtp_mux; |
471 for (auto& kv : session_options->transport_options) { | 471 for (auto& kv : session_options->transport_options) { |
472 kv.second.ice_restart = rtc_options.ice_restart; | 472 kv.second.ice_restart = rtc_options.ice_restart; |
| 473 kv.second.ice_renomination = rtc_options.ice_renomination; |
473 } | 474 } |
474 | 475 |
475 return true; | 476 return true; |
476 } | 477 } |
477 | 478 |
478 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, | 479 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, |
479 cricket::MediaSessionOptions* session_options) { | 480 cricket::MediaSessionOptions* session_options) { |
480 bool value = false; | 481 bool value = false; |
481 size_t mandatory_constraints_satisfied = 0; | 482 size_t mandatory_constraints_satisfied = 0; |
482 | 483 |
(...skipping 23 matching lines...) Expand all Loading... |
506 } | 507 } |
507 | 508 |
508 if (FindConstraint(constraints, MediaConstraintsInterface::kUseRtpMux, &value, | 509 if (FindConstraint(constraints, MediaConstraintsInterface::kUseRtpMux, &value, |
509 &mandatory_constraints_satisfied)) { | 510 &mandatory_constraints_satisfied)) { |
510 session_options->bundle_enabled = value; | 511 session_options->bundle_enabled = value; |
511 } else { | 512 } else { |
512 // kUseRtpMux defaults to true according to spec. | 513 // kUseRtpMux defaults to true according to spec. |
513 session_options->bundle_enabled = true; | 514 session_options->bundle_enabled = true; |
514 } | 515 } |
515 | 516 |
516 bool ice_restart = false; | 517 bool ice_renomination = false; |
517 if (FindConstraint(constraints, MediaConstraintsInterface::kIceRestart, | 518 if (FindConstraint(constraints, MediaConstraintsInterface::kIceRenomination, |
518 &value, &mandatory_constraints_satisfied)) { | 519 &value, &mandatory_constraints_satisfied)) { |
519 // kIceRestart defaults to false according to spec. | 520 ice_renomination = value; |
520 ice_restart = true; | |
521 } | 521 } |
522 for (auto& kv : session_options->transport_options) { | 522 for (auto& kv : session_options->transport_options) { |
523 kv.second.ice_restart = ice_restart; | 523 kv.second.ice_renomination = ice_renomination; |
524 } | 524 } |
525 | 525 |
526 if (!constraints) { | 526 if (!constraints) { |
527 return true; | 527 return true; |
528 } | 528 } |
529 return mandatory_constraints_satisfied == constraints->GetMandatory().size(); | 529 return mandatory_constraints_satisfied == constraints->GetMandatory().size(); |
530 } | 530 } |
531 | 531 |
532 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, | 532 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, |
533 cricket::ServerAddresses* stun_servers, | 533 cricket::ServerAddresses* stun_servers, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 options.voice_activity_detection = value; | 980 options.voice_activity_detection = value; |
981 } | 981 } |
982 | 982 |
983 if (FindConstraint(constraints, | 983 if (FindConstraint(constraints, |
984 MediaConstraintsInterface::kIceRestart, | 984 MediaConstraintsInterface::kIceRestart, |
985 &value, | 985 &value, |
986 &mandatory_constraints)) { | 986 &mandatory_constraints)) { |
987 options.ice_restart = value; | 987 options.ice_restart = value; |
988 } | 988 } |
989 | 989 |
| 990 if (FindConstraint(constraints, MediaConstraintsInterface::kIceRenomination, |
| 991 &value, &mandatory_constraints)) { |
| 992 options.ice_renomination = value; |
| 993 } |
| 994 |
990 if (FindConstraint(constraints, | 995 if (FindConstraint(constraints, |
991 MediaConstraintsInterface::kUseRtpMux, | 996 MediaConstraintsInterface::kUseRtpMux, |
992 &value, | 997 &value, |
993 &mandatory_constraints)) { | 998 &mandatory_constraints)) { |
994 options.use_rtp_mux = value; | 999 options.use_rtp_mux = value; |
995 } | 1000 } |
996 | 1001 |
997 CreateOffer(observer, options); | 1002 CreateOffer(observer, options); |
998 } | 1003 } |
999 | 1004 |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 // people won't try to use them. | 1647 // people won't try to use them. |
1643 if (HasDataChannels() && session_->data_channel_type() != cricket::DCT_RTP) { | 1648 if (HasDataChannels() && session_->data_channel_type() != cricket::DCT_RTP) { |
1644 session_options->data_channel_type = session_->data_channel_type(); | 1649 session_options->data_channel_type = session_->data_channel_type(); |
1645 } | 1650 } |
1646 | 1651 |
1647 session_options->rtcp_cname = rtcp_cname_; | 1652 session_options->rtcp_cname = rtcp_cname_; |
1648 session_options->crypto_options = factory_->options().crypto_options; | 1653 session_options->crypto_options = factory_->options().crypto_options; |
1649 return true; | 1654 return true; |
1650 } | 1655 } |
1651 | 1656 |
1652 void PeerConnection::FinishOptionsForAnswer( | 1657 void PeerConnection::InitializeOptionsForAnswer( |
1653 cricket::MediaSessionOptions* session_options) { | 1658 cricket::MediaSessionOptions* session_options) { |
1654 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of | 1659 session_options->recv_audio = false; |
1655 // ContentInfos. | 1660 session_options->recv_video = false; |
1656 if (session_->remote_description()) { | 1661 if (session_->remote_description()) { |
1657 // Initialize the transport_options map. | 1662 // Initialize the transport_options map. |
1658 for (const cricket::ContentInfo& content : | 1663 for (const cricket::ContentInfo& content : |
1659 session_->remote_description()->description()->contents()) { | 1664 session_->remote_description()->description()->contents()) { |
1660 session_options->transport_options[content.name] = | 1665 session_options->transport_options[content.name] = |
1661 cricket::TransportOptions(); | 1666 cricket::TransportOptions(); |
1662 } | 1667 } |
1663 } | 1668 } |
| 1669 } |
| 1670 |
| 1671 void PeerConnection::FinishOptionsForAnswer( |
| 1672 cricket::MediaSessionOptions* session_options) { |
| 1673 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of |
| 1674 // ContentInfos. |
1664 AddSendStreams(session_options, senders_, rtp_data_channels_); | 1675 AddSendStreams(session_options, senders_, rtp_data_channels_); |
1665 session_options->bundle_enabled = | 1676 session_options->bundle_enabled = |
1666 session_options->bundle_enabled && | 1677 session_options->bundle_enabled && |
1667 (session_options->has_audio() || session_options->has_video() || | 1678 (session_options->has_audio() || session_options->has_video() || |
1668 session_options->has_data()); | 1679 session_options->has_data()); |
1669 | 1680 |
1670 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams | 1681 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams |
1671 // are not signaled in the SDP so does not go through that path and must be | 1682 // are not signaled in the SDP so does not go through that path and must be |
1672 // handled here. | 1683 // handled here. |
1673 // Intentionally unset the data channel type for RTP data channel. Otherwise | 1684 // Intentionally unset the data channel type for RTP data channel. Otherwise |
1674 // the RTP data channels would be successfully negotiated by default and the | 1685 // the RTP data channels would be successfully negotiated by default and the |
1675 // unit tests in WebRtcDataBrowserTest will fail when building with chromium. | 1686 // unit tests in WebRtcDataBrowserTest will fail when building with chromium. |
1676 // We want to leave RTP data channels broken, so people won't try to use them. | 1687 // We want to leave RTP data channels broken, so people won't try to use them. |
1677 if (session_->data_channel_type() != cricket::DCT_RTP) { | 1688 if (session_->data_channel_type() != cricket::DCT_RTP) { |
1678 session_options->data_channel_type = session_->data_channel_type(); | 1689 session_options->data_channel_type = session_->data_channel_type(); |
1679 } | 1690 } |
1680 session_options->crypto_options = factory_->options().crypto_options; | 1691 session_options->crypto_options = factory_->options().crypto_options; |
1681 } | 1692 } |
1682 | 1693 |
1683 bool PeerConnection::GetOptionsForAnswer( | 1694 bool PeerConnection::GetOptionsForAnswer( |
1684 const MediaConstraintsInterface* constraints, | 1695 const MediaConstraintsInterface* constraints, |
1685 cricket::MediaSessionOptions* session_options) { | 1696 cricket::MediaSessionOptions* session_options) { |
1686 session_options->recv_audio = false; | 1697 InitializeOptionsForAnswer(session_options); |
1687 session_options->recv_video = false; | |
1688 if (!ParseConstraintsForAnswer(constraints, session_options)) { | 1698 if (!ParseConstraintsForAnswer(constraints, session_options)) { |
1689 return false; | 1699 return false; |
1690 } | 1700 } |
1691 session_options->rtcp_cname = rtcp_cname_; | 1701 session_options->rtcp_cname = rtcp_cname_; |
1692 | 1702 |
1693 FinishOptionsForAnswer(session_options); | 1703 FinishOptionsForAnswer(session_options); |
1694 return true; | 1704 return true; |
1695 } | 1705 } |
1696 | 1706 |
1697 bool PeerConnection::GetOptionsForAnswer( | 1707 bool PeerConnection::GetOptionsForAnswer( |
1698 const RTCOfferAnswerOptions& options, | 1708 const RTCOfferAnswerOptions& options, |
1699 cricket::MediaSessionOptions* session_options) { | 1709 cricket::MediaSessionOptions* session_options) { |
1700 session_options->recv_audio = false; | 1710 InitializeOptionsForAnswer(session_options); |
1701 session_options->recv_video = false; | |
1702 if (!ExtractMediaSessionOptions(options, false, session_options)) { | 1711 if (!ExtractMediaSessionOptions(options, false, session_options)) { |
1703 return false; | 1712 return false; |
1704 } | 1713 } |
1705 session_options->rtcp_cname = rtcp_cname_; | 1714 session_options->rtcp_cname = rtcp_cname_; |
1706 | 1715 |
1707 FinishOptionsForAnswer(session_options); | 1716 FinishOptionsForAnswer(session_options); |
1708 return true; | 1717 return true; |
1709 } | 1718 } |
1710 | 1719 |
1711 void PeerConnection::RemoveTracks(cricket::MediaType media_type) { | 1720 void PeerConnection::RemoveTracks(cricket::MediaType media_type) { |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 | 2332 |
2324 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, | 2333 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, |
2325 int64_t max_size_bytes) { | 2334 int64_t max_size_bytes) { |
2326 return media_controller_->call_w()->StartEventLog(file, max_size_bytes); | 2335 return media_controller_->call_w()->StartEventLog(file, max_size_bytes); |
2327 } | 2336 } |
2328 | 2337 |
2329 void PeerConnection::StopRtcEventLog_w() { | 2338 void PeerConnection::StopRtcEventLog_w() { |
2330 media_controller_->call_w()->StopEventLog(); | 2339 media_controller_->call_w()->StopEventLog(); |
2331 } | 2340 } |
2332 } // namespace webrtc | 2341 } // namespace webrtc |
OLD | NEW |