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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 media_controller_.get(), factory_->network_thread(), | 626 media_controller_.get(), factory_->network_thread(), |
627 factory_->worker_thread(), factory_->signaling_thread(), | 627 factory_->worker_thread(), factory_->signaling_thread(), |
628 port_allocator_.get(), | 628 port_allocator_.get(), |
629 std::unique_ptr<cricket::TransportController>( | 629 std::unique_ptr<cricket::TransportController>( |
630 factory_->CreateTransportController( | 630 factory_->CreateTransportController( |
631 port_allocator_.get(), | 631 port_allocator_.get(), |
632 configuration.redetermine_role_on_ice_restart)))); | 632 configuration.redetermine_role_on_ice_restart)))); |
633 | 633 |
634 stats_.reset(new StatsCollector(this)); | 634 stats_.reset(new StatsCollector(this)); |
635 | 635 |
| 636 enable_ice_renomination_ = configuration.enable_ice_renomination; |
| 637 |
636 // Initialize the WebRtcSession. It creates transport channels etc. | 638 // Initialize the WebRtcSession. It creates transport channels etc. |
637 if (!session_->Initialize(factory_->options(), std::move(cert_generator), | 639 if (!session_->Initialize(factory_->options(), std::move(cert_generator), |
638 configuration)) { | 640 configuration)) { |
639 return false; | 641 return false; |
640 } | 642 } |
641 | 643 |
642 // Register PeerConnection as receiver of local ice candidates. | 644 // Register PeerConnection as receiver of local ice candidates. |
643 // All the callbacks will be posted to the application from PeerConnection. | 645 // All the callbacks will be posted to the application from PeerConnection. |
644 session_->RegisterIceObserver(this); | 646 session_->RegisterIceObserver(this); |
645 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange); | 647 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange); |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 if (!network_thread()->Invoke<bool>( | 1257 if (!network_thread()->Invoke<bool>( |
1256 RTC_FROM_HERE, | 1258 RTC_FROM_HERE, |
1257 rtc::Bind(&PeerConnection::ReconfigurePortAllocator_n, this, | 1259 rtc::Bind(&PeerConnection::ReconfigurePortAllocator_n, this, |
1258 configuration))) { | 1260 configuration))) { |
1259 return false; | 1261 return false; |
1260 } | 1262 } |
1261 } | 1263 } |
1262 | 1264 |
1263 // TODO(deadbeef): Shouldn't have to hop to the worker thread twice... | 1265 // TODO(deadbeef): Shouldn't have to hop to the worker thread twice... |
1264 session_->SetIceConfig(session_->ParseIceConfig(configuration)); | 1266 session_->SetIceConfig(session_->ParseIceConfig(configuration)); |
| 1267 |
| 1268 enable_ice_renomination_ = configuration.enable_ice_renomination; |
1265 return true; | 1269 return true; |
1266 } | 1270 } |
1267 | 1271 |
1268 bool PeerConnection::AddIceCandidate( | 1272 bool PeerConnection::AddIceCandidate( |
1269 const IceCandidateInterface* ice_candidate) { | 1273 const IceCandidateInterface* ice_candidate) { |
1270 TRACE_EVENT0("webrtc", "PeerConnection::AddIceCandidate"); | 1274 TRACE_EVENT0("webrtc", "PeerConnection::AddIceCandidate"); |
1271 if (IsClosed()) { | 1275 if (IsClosed()) { |
1272 return false; | 1276 return false; |
1273 } | 1277 } |
1274 return session_->ProcessIceMessage(ice_candidate); | 1278 return session_->ProcessIceMessage(ice_candidate); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 cricket::MediaSessionOptions* session_options) { | 1612 cricket::MediaSessionOptions* session_options) { |
1609 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of | 1613 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of |
1610 // ContentInfos. | 1614 // ContentInfos. |
1611 if (session_->local_description()) { | 1615 if (session_->local_description()) { |
1612 for (const cricket::ContentInfo& content : | 1616 for (const cricket::ContentInfo& content : |
1613 session_->local_description()->description()->contents()) { | 1617 session_->local_description()->description()->contents()) { |
1614 session_options->transport_options[content.name] = | 1618 session_options->transport_options[content.name] = |
1615 cricket::TransportOptions(); | 1619 cricket::TransportOptions(); |
1616 } | 1620 } |
1617 } | 1621 } |
| 1622 session_options->enable_ice_renomination = enable_ice_renomination_; |
| 1623 |
1618 if (!ExtractMediaSessionOptions(rtc_options, true, session_options)) { | 1624 if (!ExtractMediaSessionOptions(rtc_options, true, session_options)) { |
1619 return false; | 1625 return false; |
1620 } | 1626 } |
1621 | 1627 |
1622 AddSendStreams(session_options, senders_, rtp_data_channels_); | 1628 AddSendStreams(session_options, senders_, rtp_data_channels_); |
1623 // Offer to receive audio/video if the constraint is not set and there are | 1629 // Offer to receive audio/video if the constraint is not set and there are |
1624 // send streams, or we're currently receiving. | 1630 // send streams, or we're currently receiving. |
1625 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) { | 1631 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) { |
1626 session_options->recv_audio = | 1632 session_options->recv_audio = |
1627 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) || | 1633 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) || |
(...skipping 16 matching lines...) Expand all Loading... |
1644 // people won't try to use them. | 1650 // people won't try to use them. |
1645 if (HasDataChannels() && session_->data_channel_type() != cricket::DCT_RTP) { | 1651 if (HasDataChannels() && session_->data_channel_type() != cricket::DCT_RTP) { |
1646 session_options->data_channel_type = session_->data_channel_type(); | 1652 session_options->data_channel_type = session_->data_channel_type(); |
1647 } | 1653 } |
1648 | 1654 |
1649 session_options->rtcp_cname = rtcp_cname_; | 1655 session_options->rtcp_cname = rtcp_cname_; |
1650 session_options->crypto_options = factory_->options().crypto_options; | 1656 session_options->crypto_options = factory_->options().crypto_options; |
1651 return true; | 1657 return true; |
1652 } | 1658 } |
1653 | 1659 |
| 1660 void PeerConnection::InitializeOptionsForAnswer( |
| 1661 cricket::MediaSessionOptions* session_options) { |
| 1662 session_options->recv_audio = false; |
| 1663 session_options->recv_video = false; |
| 1664 session_options->enable_ice_renomination = enable_ice_renomination_; |
| 1665 } |
| 1666 |
1654 void PeerConnection::FinishOptionsForAnswer( | 1667 void PeerConnection::FinishOptionsForAnswer( |
1655 cricket::MediaSessionOptions* session_options) { | 1668 cricket::MediaSessionOptions* session_options) { |
1656 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of | 1669 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of |
1657 // ContentInfos. | 1670 // ContentInfos. |
1658 if (session_->remote_description()) { | 1671 if (session_->remote_description()) { |
1659 // Initialize the transport_options map. | 1672 // Initialize the transport_options map. |
1660 for (const cricket::ContentInfo& content : | 1673 for (const cricket::ContentInfo& content : |
1661 session_->remote_description()->description()->contents()) { | 1674 session_->remote_description()->description()->contents()) { |
1662 session_options->transport_options[content.name] = | 1675 session_options->transport_options[content.name] = |
1663 cricket::TransportOptions(); | 1676 cricket::TransportOptions(); |
(...skipping 14 matching lines...) Expand all Loading... |
1678 // We want to leave RTP data channels broken, so people won't try to use them. | 1691 // We want to leave RTP data channels broken, so people won't try to use them. |
1679 if (session_->data_channel_type() != cricket::DCT_RTP) { | 1692 if (session_->data_channel_type() != cricket::DCT_RTP) { |
1680 session_options->data_channel_type = session_->data_channel_type(); | 1693 session_options->data_channel_type = session_->data_channel_type(); |
1681 } | 1694 } |
1682 session_options->crypto_options = factory_->options().crypto_options; | 1695 session_options->crypto_options = factory_->options().crypto_options; |
1683 } | 1696 } |
1684 | 1697 |
1685 bool PeerConnection::GetOptionsForAnswer( | 1698 bool PeerConnection::GetOptionsForAnswer( |
1686 const MediaConstraintsInterface* constraints, | 1699 const MediaConstraintsInterface* constraints, |
1687 cricket::MediaSessionOptions* session_options) { | 1700 cricket::MediaSessionOptions* session_options) { |
1688 session_options->recv_audio = false; | 1701 InitializeOptionsForAnswer(session_options); |
1689 session_options->recv_video = false; | |
1690 if (!ParseConstraintsForAnswer(constraints, session_options)) { | 1702 if (!ParseConstraintsForAnswer(constraints, session_options)) { |
1691 return false; | 1703 return false; |
1692 } | 1704 } |
1693 session_options->rtcp_cname = rtcp_cname_; | 1705 session_options->rtcp_cname = rtcp_cname_; |
1694 | 1706 |
1695 FinishOptionsForAnswer(session_options); | 1707 FinishOptionsForAnswer(session_options); |
1696 return true; | 1708 return true; |
1697 } | 1709 } |
1698 | 1710 |
1699 bool PeerConnection::GetOptionsForAnswer( | 1711 bool PeerConnection::GetOptionsForAnswer( |
1700 const RTCOfferAnswerOptions& options, | 1712 const RTCOfferAnswerOptions& options, |
1701 cricket::MediaSessionOptions* session_options) { | 1713 cricket::MediaSessionOptions* session_options) { |
1702 session_options->recv_audio = false; | 1714 InitializeOptionsForAnswer(session_options); |
1703 session_options->recv_video = false; | |
1704 if (!ExtractMediaSessionOptions(options, false, session_options)) { | 1715 if (!ExtractMediaSessionOptions(options, false, session_options)) { |
1705 return false; | 1716 return false; |
1706 } | 1717 } |
1707 session_options->rtcp_cname = rtcp_cname_; | 1718 session_options->rtcp_cname = rtcp_cname_; |
1708 | 1719 |
1709 FinishOptionsForAnswer(session_options); | 1720 FinishOptionsForAnswer(session_options); |
1710 return true; | 1721 return true; |
1711 } | 1722 } |
1712 | 1723 |
1713 void PeerConnection::RemoveTracks(cricket::MediaType media_type) { | 1724 void PeerConnection::RemoveTracks(cricket::MediaType media_type) { |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 | 2336 |
2326 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, | 2337 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, |
2327 int64_t max_size_bytes) { | 2338 int64_t max_size_bytes) { |
2328 return media_controller_->call_w()->StartEventLog(file, max_size_bytes); | 2339 return media_controller_->call_w()->StartEventLog(file, max_size_bytes); |
2329 } | 2340 } |
2330 | 2341 |
2331 void PeerConnection::StopRtcEventLog_w() { | 2342 void PeerConnection::StopRtcEventLog_w() { |
2332 media_controller_->call_w()->StopEventLog(); | 2343 media_controller_->call_w()->StopEventLog(); |
2333 } | 2344 } |
2334 } // namespace webrtc | 2345 } // namespace webrtc |
OLD | NEW |