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