| 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 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1780 } | 1780 } |
| 1781 } | 1781 } |
| 1782 | 1782 |
| 1783 return true; | 1783 return true; |
| 1784 } | 1784 } |
| 1785 | 1785 |
| 1786 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, | 1786 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, |
| 1787 const std::string* bundle_transport) { | 1787 const std::string* bundle_transport) { |
| 1788 bool require_rtcp_mux = | 1788 bool require_rtcp_mux = |
| 1789 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1789 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1790 bool create_rtcp_transport_channel = !require_rtcp_mux; |
| 1790 | 1791 |
| 1791 std::string transport_name = | 1792 std::string transport_name = |
| 1792 bundle_transport ? *bundle_transport : content->name; | 1793 bundle_transport ? *bundle_transport : content->name; |
| 1793 | 1794 |
| 1794 cricket::TransportChannel* rtp_transport = | 1795 cricket::TransportChannel* rtp_transport = |
| 1795 transport_controller_->CreateTransportChannel( | 1796 transport_controller_->CreateTransportChannel( |
| 1796 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1797 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1797 cricket::TransportChannel* rtcp_transport = nullptr; | 1798 cricket::TransportChannel* rtcp_transport = nullptr; |
| 1798 if (!require_rtcp_mux) { | 1799 if (create_rtcp_transport_channel) { |
| 1799 rtcp_transport = transport_controller_->CreateTransportChannel( | 1800 rtcp_transport = transport_controller_->CreateTransportChannel( |
| 1800 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 1801 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 1801 } | 1802 } |
| 1802 | 1803 |
| 1803 voice_channel_.reset(channel_manager_->CreateVoiceChannel( | 1804 voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
| 1804 media_controller_, rtp_transport, rtcp_transport, | 1805 media_controller_, rtp_transport, rtcp_transport, |
| 1805 transport_controller_->signaling_thread(), content->name, | 1806 transport_controller_->signaling_thread(), content->name, |
| 1806 bundle_transport, require_rtcp_mux, SrtpRequired(), audio_options_)); | 1807 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), |
| 1808 audio_options_)); |
| 1807 if (!voice_channel_) { | 1809 if (!voice_channel_) { |
| 1808 return false; | 1810 return false; |
| 1809 } | 1811 } |
| 1810 | 1812 |
| 1811 voice_channel_->SignalRtcpMuxFullyActive.connect( | 1813 voice_channel_->SignalDestroyRtcpTransport.connect( |
| 1812 this, &WebRtcSession::DestroyRtcpTransport_n); | 1814 this, &WebRtcSession::OnDestroyRtcpTransport_n); |
| 1815 if (require_rtcp_mux) { |
| 1816 voice_channel_->ActivateRtcpMux(); |
| 1817 } |
| 1818 |
| 1813 voice_channel_->SignalDtlsSrtpSetupFailure.connect( | 1819 voice_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1814 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1820 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1815 | 1821 |
| 1816 SignalVoiceChannelCreated(); | 1822 SignalVoiceChannelCreated(); |
| 1817 voice_channel_->SignalSentPacket.connect(this, | 1823 voice_channel_->SignalSentPacket.connect(this, |
| 1818 &WebRtcSession::OnSentPacket_w); | 1824 &WebRtcSession::OnSentPacket_w); |
| 1819 return true; | 1825 return true; |
| 1820 } | 1826 } |
| 1821 | 1827 |
| 1822 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, | 1828 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, |
| 1823 const std::string* bundle_transport) { | 1829 const std::string* bundle_transport) { |
| 1824 bool require_rtcp_mux = | 1830 bool require_rtcp_mux = |
| 1825 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1831 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1832 bool create_rtcp_transport_channel = !require_rtcp_mux; |
| 1826 | 1833 |
| 1827 std::string transport_name = | 1834 std::string transport_name = |
| 1828 bundle_transport ? *bundle_transport : content->name; | 1835 bundle_transport ? *bundle_transport : content->name; |
| 1829 | 1836 |
| 1830 cricket::TransportChannel* rtp_transport = | 1837 cricket::TransportChannel* rtp_transport = |
| 1831 transport_controller_->CreateTransportChannel( | 1838 transport_controller_->CreateTransportChannel( |
| 1832 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1839 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1833 cricket::TransportChannel* rtcp_transport = nullptr; | 1840 cricket::TransportChannel* rtcp_transport = nullptr; |
| 1834 if (!require_rtcp_mux) { | 1841 if (create_rtcp_transport_channel) { |
| 1835 rtcp_transport = transport_controller_->CreateTransportChannel( | 1842 rtcp_transport = transport_controller_->CreateTransportChannel( |
| 1836 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 1843 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 1837 } | 1844 } |
| 1838 | 1845 |
| 1839 video_channel_.reset(channel_manager_->CreateVideoChannel( | 1846 video_channel_.reset(channel_manager_->CreateVideoChannel( |
| 1840 media_controller_, rtp_transport, rtcp_transport, | 1847 media_controller_, rtp_transport, rtcp_transport, |
| 1841 transport_controller_->signaling_thread(), content->name, | 1848 transport_controller_->signaling_thread(), content->name, |
| 1842 bundle_transport, require_rtcp_mux, SrtpRequired(), video_options_)); | 1849 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), |
| 1850 video_options_)); |
| 1843 | 1851 |
| 1844 if (!video_channel_) { | 1852 if (!video_channel_) { |
| 1845 return false; | 1853 return false; |
| 1846 } | 1854 } |
| 1847 | 1855 |
| 1848 video_channel_->SignalRtcpMuxFullyActive.connect( | 1856 video_channel_->SignalDestroyRtcpTransport.connect( |
| 1849 this, &WebRtcSession::DestroyRtcpTransport_n); | 1857 this, &WebRtcSession::OnDestroyRtcpTransport_n); |
| 1858 if (require_rtcp_mux) { |
| 1859 video_channel_->ActivateRtcpMux(); |
| 1860 } |
| 1850 video_channel_->SignalDtlsSrtpSetupFailure.connect( | 1861 video_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1851 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1862 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1852 | 1863 |
| 1853 SignalVideoChannelCreated(); | 1864 SignalVideoChannelCreated(); |
| 1854 video_channel_->SignalSentPacket.connect(this, | 1865 video_channel_->SignalSentPacket.connect(this, |
| 1855 &WebRtcSession::OnSentPacket_w); | 1866 &WebRtcSession::OnSentPacket_w); |
| 1856 return true; | 1867 return true; |
| 1857 } | 1868 } |
| 1858 | 1869 |
| 1859 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, | 1870 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1876 return false; | 1887 return false; |
| 1877 } | 1888 } |
| 1878 if (!network_thread_->Invoke<bool>( | 1889 if (!network_thread_->Invoke<bool>( |
| 1879 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, | 1890 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, |
| 1880 this, content->name, transport_name))) { | 1891 this, content->name, transport_name))) { |
| 1881 return false; | 1892 return false; |
| 1882 }; | 1893 }; |
| 1883 } else { | 1894 } else { |
| 1884 bool require_rtcp_mux = | 1895 bool require_rtcp_mux = |
| 1885 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1896 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1897 bool create_rtcp_transport_channel = !sctp && !require_rtcp_mux; |
| 1886 | 1898 |
| 1887 std::string transport_name = | 1899 std::string transport_name = |
| 1888 bundle_transport ? *bundle_transport : content->name; | 1900 bundle_transport ? *bundle_transport : content->name; |
| 1889 cricket::TransportChannel* rtp_transport = | 1901 cricket::TransportChannel* rtp_transport = |
| 1890 transport_controller_->CreateTransportChannel( | 1902 transport_controller_->CreateTransportChannel( |
| 1891 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1903 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1892 cricket::TransportChannel* rtcp_transport = nullptr; | 1904 cricket::TransportChannel* rtcp_transport = nullptr; |
| 1893 if (!require_rtcp_mux) { | 1905 if (create_rtcp_transport_channel) { |
| 1894 rtcp_transport = transport_controller_->CreateTransportChannel( | 1906 rtcp_transport = transport_controller_->CreateTransportChannel( |
| 1895 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 1907 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 1896 } | 1908 } |
| 1897 | 1909 |
| 1898 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( | 1910 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( |
| 1899 media_controller_, rtp_transport, rtcp_transport, | 1911 media_controller_, rtp_transport, rtcp_transport, |
| 1900 transport_controller_->signaling_thread(), content->name, | 1912 transport_controller_->signaling_thread(), content->name, |
| 1901 bundle_transport, require_rtcp_mux, SrtpRequired())); | 1913 bundle_transport, create_rtcp_transport_channel, SrtpRequired())); |
| 1902 | 1914 |
| 1903 if (!rtp_data_channel_) { | 1915 if (!rtp_data_channel_) { |
| 1904 return false; | 1916 return false; |
| 1905 } | 1917 } |
| 1906 | 1918 |
| 1907 rtp_data_channel_->SignalRtcpMuxFullyActive.connect( | 1919 rtp_data_channel_->SignalDestroyRtcpTransport.connect( |
| 1908 this, &WebRtcSession::DestroyRtcpTransport_n); | 1920 this, &WebRtcSession::OnDestroyRtcpTransport_n); |
| 1921 |
| 1922 if (require_rtcp_mux) { |
| 1923 rtp_data_channel_->ActivateRtcpMux(); |
| 1924 } |
| 1909 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( | 1925 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1910 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1926 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1911 rtp_data_channel_->SignalSentPacket.connect(this, | 1927 rtp_data_channel_->SignalSentPacket.connect(this, |
| 1912 &WebRtcSession::OnSentPacket_w); | 1928 &WebRtcSession::OnSentPacket_w); |
| 1913 } | 1929 } |
| 1914 | 1930 |
| 1915 SignalDataChannelCreated(); | 1931 SignalDataChannelCreated(); |
| 1916 | 1932 |
| 1917 return true; | 1933 return true; |
| 1918 } | 1934 } |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2366 } | 2382 } |
| 2367 | 2383 |
| 2368 void WebRtcSession::DestroyTransport(const std::string& transport_name, | 2384 void WebRtcSession::DestroyTransport(const std::string& transport_name, |
| 2369 int component) { | 2385 int component) { |
| 2370 network_thread_->Invoke<void>( | 2386 network_thread_->Invoke<void>( |
| 2371 RTC_FROM_HERE, | 2387 RTC_FROM_HERE, |
| 2372 rtc::Bind(&cricket::TransportController::DestroyTransportChannel_n, | 2388 rtc::Bind(&cricket::TransportController::DestroyTransportChannel_n, |
| 2373 transport_controller_.get(), transport_name, component)); | 2389 transport_controller_.get(), transport_name, component)); |
| 2374 } | 2390 } |
| 2375 | 2391 |
| 2376 void WebRtcSession::DestroyRtcpTransport_n(const std::string& transport_name) { | 2392 void WebRtcSession::OnDestroyRtcpTransport_n( |
| 2393 const std::string& transport_name) { |
| 2377 ASSERT(network_thread()->IsCurrent()); | 2394 ASSERT(network_thread()->IsCurrent()); |
| 2378 transport_controller_->DestroyTransportChannel_n( | 2395 transport_controller_->DestroyTransportChannel_n( |
| 2379 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 2396 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 2380 } | 2397 } |
| 2381 | 2398 |
| 2382 void WebRtcSession::DestroyVideoChannel() { | 2399 void WebRtcSession::DestroyVideoChannel() { |
| 2383 SignalVideoChannelDestroyed(); | 2400 SignalVideoChannelDestroyed(); |
| 2384 RTC_DCHECK(video_channel_->rtp_transport()); | 2401 RTC_DCHECK(video_channel_->rtp_transport()); |
| 2385 std::string transport_name; | 2402 std::string transport_name; |
| 2386 transport_name = video_channel_->rtp_transport()->transport_name(); | 2403 transport_name = video_channel_->rtp_transport()->transport_name(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2411 std::string transport_name; | 2428 std::string transport_name; |
| 2412 transport_name = rtp_data_channel_->rtp_transport()->transport_name(); | 2429 transport_name = rtp_data_channel_->rtp_transport()->transport_name(); |
| 2413 bool need_to_delete_rtcp = (rtp_data_channel_->rtcp_transport() != nullptr); | 2430 bool need_to_delete_rtcp = (rtp_data_channel_->rtcp_transport() != nullptr); |
| 2414 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); | 2431 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); |
| 2415 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 2432 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 2416 if (need_to_delete_rtcp) { | 2433 if (need_to_delete_rtcp) { |
| 2417 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 2434 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 2418 } | 2435 } |
| 2419 } | 2436 } |
| 2420 } // namespace webrtc | 2437 } // namespace webrtc |
| OLD | NEW |