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