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

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

Issue 2473603002: Fix the issue of setting local description with datachannel only and max-bundle. (Closed)
Patch Set: minor fix Created 4 years, 1 month 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 | « no previous file | webrtc/api/peerconnection_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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) { 1636 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) {
1637 session_options->recv_audio = 1637 session_options->recv_audio =
1638 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) || 1638 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) ||
1639 !remote_audio_tracks_.empty(); 1639 !remote_audio_tracks_.empty();
1640 } 1640 }
1641 if (rtc_options.offer_to_receive_video == RTCOfferAnswerOptions::kUndefined) { 1641 if (rtc_options.offer_to_receive_video == RTCOfferAnswerOptions::kUndefined) {
1642 session_options->recv_video = 1642 session_options->recv_video =
1643 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO) || 1643 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO) ||
1644 !remote_video_tracks_.empty(); 1644 !remote_video_tracks_.empty();
1645 } 1645 }
1646 session_options->bundle_enabled =
1647 session_options->bundle_enabled &&
1648 (session_options->has_audio() || session_options->has_video() ||
1649 session_options->has_data());
1650 1646
1651 // Intentionally unset the data channel type for RTP data channel with the 1647 // Intentionally unset the data channel type for RTP data channel with the
1652 // second condition. Otherwise the RTP data channels would be successfully 1648 // second condition. Otherwise the RTP data channels would be successfully
1653 // negotiated by default and the unit tests in WebRtcDataBrowserTest will fail 1649 // negotiated by default and the unit tests in WebRtcDataBrowserTest will fail
1654 // when building with chromium. We want to leave RTP data channels broken, so 1650 // when building with chromium. We want to leave RTP data channels broken, so
1655 // people won't try to use them. 1651 // people won't try to use them.
1656 if (HasDataChannels() && session_->data_channel_type() != cricket::DCT_RTP) { 1652 if (HasDataChannels() && session_->data_channel_type() != cricket::DCT_RTP) {
1657 session_options->data_channel_type = session_->data_channel_type(); 1653 session_options->data_channel_type = session_->data_channel_type();
1658 } 1654 }
1659 1655
1656 session_options->bundle_enabled =
1657 session_options->bundle_enabled &&
1658 (session_options->has_audio() || session_options->has_video() ||
1659 session_options->has_data());
1660
1660 session_options->rtcp_cname = rtcp_cname_; 1661 session_options->rtcp_cname = rtcp_cname_;
1661 session_options->crypto_options = factory_->options().crypto_options; 1662 session_options->crypto_options = factory_->options().crypto_options;
1662 return true; 1663 return true;
1663 } 1664 }
1664 1665
1665 void PeerConnection::InitializeOptionsForAnswer( 1666 void PeerConnection::InitializeOptionsForAnswer(
1666 cricket::MediaSessionOptions* session_options) { 1667 cricket::MediaSessionOptions* session_options) {
1667 session_options->recv_audio = false; 1668 session_options->recv_audio = false;
1668 session_options->recv_video = false; 1669 session_options->recv_video = false;
1669 session_options->enable_ice_renomination = enable_ice_renomination_; 1670 session_options->enable_ice_renomination = enable_ice_renomination_;
1670 } 1671 }
1671 1672
1672 void PeerConnection::FinishOptionsForAnswer( 1673 void PeerConnection::FinishOptionsForAnswer(
1673 cricket::MediaSessionOptions* session_options) { 1674 cricket::MediaSessionOptions* session_options) {
1674 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of 1675 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of
1675 // ContentInfos. 1676 // ContentInfos.
1676 if (session_->remote_description()) { 1677 if (session_->remote_description()) {
1677 // Initialize the transport_options map. 1678 // Initialize the transport_options map.
1678 for (const cricket::ContentInfo& content : 1679 for (const cricket::ContentInfo& content :
1679 session_->remote_description()->description()->contents()) { 1680 session_->remote_description()->description()->contents()) {
1680 session_options->transport_options[content.name] = 1681 session_options->transport_options[content.name] =
1681 cricket::TransportOptions(); 1682 cricket::TransportOptions();
1682 } 1683 }
1683 } 1684 }
1684 AddSendStreams(session_options, senders_, rtp_data_channels_); 1685 AddSendStreams(session_options, senders_, rtp_data_channels_);
1685 session_options->bundle_enabled =
1686 session_options->bundle_enabled &&
1687 (session_options->has_audio() || session_options->has_video() ||
1688 session_options->has_data());
1689
1690 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams 1686 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams
1691 // are not signaled in the SDP so does not go through that path and must be 1687 // are not signaled in the SDP so does not go through that path and must be
1692 // handled here. 1688 // handled here.
1693 // Intentionally unset the data channel type for RTP data channel. Otherwise 1689 // Intentionally unset the data channel type for RTP data channel. Otherwise
1694 // the RTP data channels would be successfully negotiated by default and the 1690 // the RTP data channels would be successfully negotiated by default and the
1695 // unit tests in WebRtcDataBrowserTest will fail when building with chromium. 1691 // unit tests in WebRtcDataBrowserTest will fail when building with chromium.
1696 // We want to leave RTP data channels broken, so people won't try to use them. 1692 // We want to leave RTP data channels broken, so people won't try to use them.
1697 if (session_->data_channel_type() != cricket::DCT_RTP) { 1693 if (session_->data_channel_type() != cricket::DCT_RTP) {
1698 session_options->data_channel_type = session_->data_channel_type(); 1694 session_options->data_channel_type = session_->data_channel_type();
1699 } 1695 }
1696 session_options->bundle_enabled =
1697 session_options->bundle_enabled &&
1698 (session_options->has_audio() || session_options->has_video() ||
1699 session_options->has_data());
1700
1700 session_options->crypto_options = factory_->options().crypto_options; 1701 session_options->crypto_options = factory_->options().crypto_options;
1701 } 1702 }
1702 1703
1703 bool PeerConnection::GetOptionsForAnswer( 1704 bool PeerConnection::GetOptionsForAnswer(
1704 const MediaConstraintsInterface* constraints, 1705 const MediaConstraintsInterface* constraints,
1705 cricket::MediaSessionOptions* session_options) { 1706 cricket::MediaSessionOptions* session_options) {
1706 InitializeOptionsForAnswer(session_options); 1707 InitializeOptionsForAnswer(session_options);
1707 if (!ParseConstraintsForAnswer(constraints, session_options)) { 1708 if (!ParseConstraintsForAnswer(constraints, session_options)) {
1708 return false; 1709 return false;
1709 } 1710 }
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
2341 2342
2342 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, 2343 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,
2343 int64_t max_size_bytes) { 2344 int64_t max_size_bytes) {
2344 return event_log_->StartLogging(file, max_size_bytes); 2345 return event_log_->StartLogging(file, max_size_bytes);
2345 } 2346 }
2346 2347
2347 void PeerConnection::StopRtcEventLog_w() { 2348 void PeerConnection::StopRtcEventLog_w() {
2348 event_log_->StopLogging(); 2349 event_log_->StopLogging();
2349 } 2350 }
2350 } // namespace webrtc 2351 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/peerconnection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698