| 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 17 matching lines...) Expand all Loading... |
| 28 #include "webrtc/base/checks.h" | 28 #include "webrtc/base/checks.h" |
| 29 #include "webrtc/base/helpers.h" | 29 #include "webrtc/base/helpers.h" |
| 30 #include "webrtc/base/logging.h" | 30 #include "webrtc/base/logging.h" |
| 31 #include "webrtc/base/stringencode.h" | 31 #include "webrtc/base/stringencode.h" |
| 32 #include "webrtc/base/stringutils.h" | 32 #include "webrtc/base/stringutils.h" |
| 33 #include "webrtc/call/call.h" | 33 #include "webrtc/call/call.h" |
| 34 #include "webrtc/media/base/mediaconstants.h" | 34 #include "webrtc/media/base/mediaconstants.h" |
| 35 #include "webrtc/media/base/videocapturer.h" | 35 #include "webrtc/media/base/videocapturer.h" |
| 36 #include "webrtc/media/sctp/sctptransportinternal.h" | 36 #include "webrtc/media/sctp/sctptransportinternal.h" |
| 37 #include "webrtc/p2p/base/portallocator.h" | 37 #include "webrtc/p2p/base/portallocator.h" |
| 38 #include "webrtc/p2p/base/transportchannel.h" | |
| 39 #include "webrtc/pc/channel.h" | 38 #include "webrtc/pc/channel.h" |
| 40 #include "webrtc/pc/channelmanager.h" | 39 #include "webrtc/pc/channelmanager.h" |
| 41 #include "webrtc/pc/mediasession.h" | 40 #include "webrtc/pc/mediasession.h" |
| 42 | 41 |
| 43 #ifdef HAVE_QUIC | 42 #ifdef HAVE_QUIC |
| 44 #include "webrtc/p2p/quic/quictransportchannel.h" | 43 #include "webrtc/p2p/quic/quictransportchannel.h" |
| 45 #endif // HAVE_QUIC | 44 #endif // HAVE_QUIC |
| 46 | 45 |
| 47 using cricket::ContentInfo; | 46 using cricket::ContentInfo; |
| 48 using cricket::ContentInfos; | 47 using cricket::ContentInfos; |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 return true; | 1074 return true; |
| 1076 } | 1075 } |
| 1077 | 1076 |
| 1078 std::string old_transport_name = ch->transport_name(); | 1077 std::string old_transport_name = ch->transport_name(); |
| 1079 if (old_transport_name == transport_name) { | 1078 if (old_transport_name == transport_name) { |
| 1080 LOG(LS_INFO) << "BUNDLE already enabled for " << ch->content_name() | 1079 LOG(LS_INFO) << "BUNDLE already enabled for " << ch->content_name() |
| 1081 << " on " << transport_name << "."; | 1080 << " on " << transport_name << "."; |
| 1082 return true; | 1081 return true; |
| 1083 } | 1082 } |
| 1084 | 1083 |
| 1085 cricket::TransportChannel* rtp_transport = | 1084 cricket::DtlsTransportInternal* rtp_dtls_transport = |
| 1086 transport_controller_->CreateTransportChannel( | 1085 transport_controller_->CreateDtlsTransport( |
| 1087 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1086 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1088 bool need_rtcp = (ch->rtcp_transport() != nullptr); | 1087 bool need_rtcp = (ch->rtcp_dtls_transport() != nullptr); |
| 1089 cricket::TransportChannel* rtcp_transport = nullptr; | 1088 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr; |
| 1090 if (need_rtcp) { | 1089 if (need_rtcp) { |
| 1091 rtcp_transport = transport_controller_->CreateTransportChannel_n( | 1090 rtcp_dtls_transport = transport_controller_->CreateDtlsTransport_n( |
| 1092 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 1091 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 1093 } | 1092 } |
| 1094 | 1093 |
| 1095 ch->SetTransports(rtp_transport, rtcp_transport); | 1094 ch->SetTransports(rtp_dtls_transport, rtcp_dtls_transport); |
| 1096 LOG(LS_INFO) << "Enabled BUNDLE for " << ch->content_name() << " on " | 1095 LOG(LS_INFO) << "Enabled BUNDLE for " << ch->content_name() << " on " |
| 1097 << transport_name << "."; | 1096 << transport_name << "."; |
| 1098 transport_controller_->DestroyTransportChannel( | 1097 transport_controller_->DestroyDtlsTransport( |
| 1099 old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1098 old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1100 // If the channel needs rtcp, it means that the channel used to have a | 1099 // If the channel needs rtcp, it means that the channel used to have a |
| 1101 // rtcp transport which needs to be deleted now. | 1100 // rtcp transport which needs to be deleted now. |
| 1102 if (need_rtcp) { | 1101 if (need_rtcp) { |
| 1103 transport_controller_->DestroyTransportChannel( | 1102 transport_controller_->DestroyDtlsTransport( |
| 1104 old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 1103 old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 1105 } | 1104 } |
| 1106 return true; | 1105 return true; |
| 1107 }; | 1106 }; |
| 1108 | 1107 |
| 1109 if (!maybe_set_transport(voice_channel()) || | 1108 if (!maybe_set_transport(voice_channel()) || |
| 1110 !maybe_set_transport(video_channel()) || | 1109 !maybe_set_transport(video_channel()) || |
| 1111 !maybe_set_transport(rtp_data_channel())) { | 1110 !maybe_set_transport(rtp_data_channel())) { |
| 1112 return false; | 1111 return false; |
| 1113 } | 1112 } |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1782 } | 1781 } |
| 1783 | 1782 |
| 1784 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, | 1783 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, |
| 1785 const std::string* bundle_transport) { | 1784 const std::string* bundle_transport) { |
| 1786 bool require_rtcp_mux = | 1785 bool require_rtcp_mux = |
| 1787 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1786 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1788 | 1787 |
| 1789 std::string transport_name = | 1788 std::string transport_name = |
| 1790 bundle_transport ? *bundle_transport : content->name; | 1789 bundle_transport ? *bundle_transport : content->name; |
| 1791 | 1790 |
| 1792 cricket::TransportChannel* rtp_transport = | 1791 cricket::DtlsTransportInternal* rtp_dtls_transport = |
| 1793 transport_controller_->CreateTransportChannel( | 1792 transport_controller_->CreateDtlsTransport( |
| 1794 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1793 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1795 cricket::TransportChannel* rtcp_transport = nullptr; | 1794 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr; |
| 1796 if (!require_rtcp_mux) { | 1795 if (!require_rtcp_mux) { |
| 1797 rtcp_transport = transport_controller_->CreateTransportChannel( | 1796 rtcp_dtls_transport = transport_controller_->CreateDtlsTransport( |
| 1798 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 1797 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 1799 } | 1798 } |
| 1800 | 1799 |
| 1801 voice_channel_.reset(channel_manager_->CreateVoiceChannel( | 1800 voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
| 1802 media_controller_, rtp_transport, rtcp_transport, | 1801 media_controller_, rtp_dtls_transport, rtcp_dtls_transport, |
| 1803 transport_controller_->signaling_thread(), content->name, | 1802 transport_controller_->signaling_thread(), content->name, |
| 1804 bundle_transport, require_rtcp_mux, SrtpRequired(), audio_options_)); | 1803 bundle_transport, require_rtcp_mux, SrtpRequired(), audio_options_)); |
| 1805 if (!voice_channel_) { | 1804 if (!voice_channel_) { |
| 1806 transport_controller_->DestroyTransportChannel( | 1805 transport_controller_->DestroyDtlsTransport( |
| 1807 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1806 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1808 if (rtcp_transport) { | 1807 if (rtcp_dtls_transport) { |
| 1809 transport_controller_->DestroyTransportChannel( | 1808 transport_controller_->DestroyDtlsTransport( |
| 1810 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1809 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1811 } | 1810 } |
| 1812 return false; | 1811 return false; |
| 1813 } | 1812 } |
| 1814 | 1813 |
| 1815 voice_channel_->SignalRtcpMuxFullyActive.connect( | 1814 voice_channel_->SignalRtcpMuxFullyActive.connect( |
| 1816 this, &WebRtcSession::DestroyRtcpTransport_n); | 1815 this, &WebRtcSession::DestroyRtcpTransport_n); |
| 1817 voice_channel_->SignalDtlsSrtpSetupFailure.connect( | 1816 voice_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1818 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1817 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1819 | 1818 |
| 1820 SignalVoiceChannelCreated(); | 1819 SignalVoiceChannelCreated(); |
| 1821 voice_channel_->SignalSentPacket.connect(this, | 1820 voice_channel_->SignalSentPacket.connect(this, |
| 1822 &WebRtcSession::OnSentPacket_w); | 1821 &WebRtcSession::OnSentPacket_w); |
| 1823 return true; | 1822 return true; |
| 1824 } | 1823 } |
| 1825 | 1824 |
| 1826 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, | 1825 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, |
| 1827 const std::string* bundle_transport) { | 1826 const std::string* bundle_transport) { |
| 1828 bool require_rtcp_mux = | 1827 bool require_rtcp_mux = |
| 1829 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1828 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1830 | 1829 |
| 1831 std::string transport_name = | 1830 std::string transport_name = |
| 1832 bundle_transport ? *bundle_transport : content->name; | 1831 bundle_transport ? *bundle_transport : content->name; |
| 1833 | 1832 |
| 1834 cricket::TransportChannel* rtp_transport = | 1833 cricket::DtlsTransportInternal* rtp_dtls_transport = |
| 1835 transport_controller_->CreateTransportChannel( | 1834 transport_controller_->CreateDtlsTransport( |
| 1836 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1835 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1837 cricket::TransportChannel* rtcp_transport = nullptr; | 1836 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr; |
| 1838 if (!require_rtcp_mux) { | 1837 if (!require_rtcp_mux) { |
| 1839 rtcp_transport = transport_controller_->CreateTransportChannel( | 1838 rtcp_dtls_transport = transport_controller_->CreateDtlsTransport( |
| 1840 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 1839 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 1841 } | 1840 } |
| 1842 | 1841 |
| 1843 video_channel_.reset(channel_manager_->CreateVideoChannel( | 1842 video_channel_.reset(channel_manager_->CreateVideoChannel( |
| 1844 media_controller_, rtp_transport, rtcp_transport, | 1843 media_controller_, rtp_dtls_transport, rtcp_dtls_transport, |
| 1845 transport_controller_->signaling_thread(), content->name, | 1844 transport_controller_->signaling_thread(), content->name, |
| 1846 bundle_transport, require_rtcp_mux, SrtpRequired(), video_options_)); | 1845 bundle_transport, require_rtcp_mux, SrtpRequired(), video_options_)); |
| 1847 | 1846 |
| 1848 if (!video_channel_) { | 1847 if (!video_channel_) { |
| 1849 transport_controller_->DestroyTransportChannel( | 1848 transport_controller_->DestroyDtlsTransport( |
| 1850 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1849 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1851 if (rtcp_transport) { | 1850 if (rtcp_dtls_transport) { |
| 1852 transport_controller_->DestroyTransportChannel( | 1851 transport_controller_->DestroyDtlsTransport( |
| 1853 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1852 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1854 } | 1853 } |
| 1855 return false; | 1854 return false; |
| 1856 } | 1855 } |
| 1857 | 1856 |
| 1858 video_channel_->SignalRtcpMuxFullyActive.connect( | 1857 video_channel_->SignalRtcpMuxFullyActive.connect( |
| 1859 this, &WebRtcSession::DestroyRtcpTransport_n); | 1858 this, &WebRtcSession::DestroyRtcpTransport_n); |
| 1860 video_channel_->SignalDtlsSrtpSetupFailure.connect( | 1859 video_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1861 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1860 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1862 | 1861 |
| 1863 SignalVideoChannelCreated(); | 1862 SignalVideoChannelCreated(); |
| 1864 video_channel_->SignalSentPacket.connect(this, | 1863 video_channel_->SignalSentPacket.connect(this, |
| 1865 &WebRtcSession::OnSentPacket_w); | 1864 &WebRtcSession::OnSentPacket_w); |
| 1866 return true; | 1865 return true; |
| 1867 } | 1866 } |
| 1868 | 1867 |
| 1869 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, | 1868 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, |
| 1870 const std::string* bundle_transport) { | 1869 const std::string* bundle_transport) { |
| 1871 const std::string transport_name = | 1870 const std::string transport_name = |
| 1872 bundle_transport ? *bundle_transport : content->name; | 1871 bundle_transport ? *bundle_transport : content->name; |
| 1873 #ifdef HAVE_QUIC | 1872 #ifdef HAVE_QUIC |
| 1874 if (data_channel_type_ == cricket::DCT_QUIC) { | 1873 if (data_channel_type_ == cricket::DCT_QUIC) { |
| 1875 RTC_DCHECK(transport_controller_->quic()); | 1874 RTC_DCHECK(transport_controller_->quic()); |
| 1876 quic_data_transport_->SetTransport(transport_name); | 1875 quic_data_transport_->SetTransports(transport_name); |
| 1877 return true; | 1876 return true; |
| 1878 } | 1877 } |
| 1879 #endif // HAVE_QUIC | 1878 #endif // HAVE_QUIC |
| 1880 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); | 1879 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); |
| 1881 if (sctp) { | 1880 if (sctp) { |
| 1882 if (!sctp_factory_) { | 1881 if (!sctp_factory_) { |
| 1883 LOG(LS_ERROR) | 1882 LOG(LS_ERROR) |
| 1884 << "Trying to create SCTP transport, but didn't compile with " | 1883 << "Trying to create SCTP transport, but didn't compile with " |
| 1885 "SCTP support (HAVE_SCTP)"; | 1884 "SCTP support (HAVE_SCTP)"; |
| 1886 return false; | 1885 return false; |
| 1887 } | 1886 } |
| 1888 if (!network_thread_->Invoke<bool>( | 1887 if (!network_thread_->Invoke<bool>( |
| 1889 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, | 1888 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, |
| 1890 this, content->name, transport_name))) { | 1889 this, content->name, transport_name))) { |
| 1891 return false; | 1890 return false; |
| 1892 }; | 1891 }; |
| 1893 } else { | 1892 } else { |
| 1894 bool require_rtcp_mux = | 1893 bool require_rtcp_mux = |
| 1895 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1894 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1896 | 1895 |
| 1897 std::string transport_name = | 1896 std::string transport_name = |
| 1898 bundle_transport ? *bundle_transport : content->name; | 1897 bundle_transport ? *bundle_transport : content->name; |
| 1899 cricket::TransportChannel* rtp_transport = | 1898 cricket::DtlsTransportInternal* rtp_dtls_transport = |
| 1900 transport_controller_->CreateTransportChannel( | 1899 transport_controller_->CreateDtlsTransport( |
| 1901 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1900 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1902 cricket::TransportChannel* rtcp_transport = nullptr; | 1901 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr; |
| 1903 if (!require_rtcp_mux) { | 1902 if (!require_rtcp_mux) { |
| 1904 rtcp_transport = transport_controller_->CreateTransportChannel( | 1903 rtcp_dtls_transport = transport_controller_->CreateDtlsTransport( |
| 1905 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 1904 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 1906 } | 1905 } |
| 1907 | 1906 |
| 1908 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( | 1907 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( |
| 1909 media_controller_, rtp_transport, rtcp_transport, | 1908 media_controller_, rtp_dtls_transport, rtcp_dtls_transport, |
| 1910 transport_controller_->signaling_thread(), content->name, | 1909 transport_controller_->signaling_thread(), content->name, |
| 1911 bundle_transport, require_rtcp_mux, SrtpRequired())); | 1910 bundle_transport, require_rtcp_mux, SrtpRequired())); |
| 1912 | 1911 |
| 1913 if (!rtp_data_channel_) { | 1912 if (!rtp_data_channel_) { |
| 1914 transport_controller_->DestroyTransportChannel( | 1913 transport_controller_->DestroyDtlsTransport( |
| 1915 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1914 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1916 if (rtcp_transport) { | 1915 if (rtcp_dtls_transport) { |
| 1917 transport_controller_->DestroyTransportChannel( | 1916 transport_controller_->DestroyDtlsTransport( |
| 1918 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1917 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1919 } | 1918 } |
| 1920 return false; | 1919 return false; |
| 1921 } | 1920 } |
| 1922 | 1921 |
| 1923 rtp_data_channel_->SignalRtcpMuxFullyActive.connect( | 1922 rtp_data_channel_->SignalRtcpMuxFullyActive.connect( |
| 1924 this, &WebRtcSession::DestroyRtcpTransport_n); | 1923 this, &WebRtcSession::DestroyRtcpTransport_n); |
| 1925 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( | 1924 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1926 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1925 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1927 rtp_data_channel_->SignalSentPacket.connect(this, | 1926 rtp_data_channel_->SignalSentPacket.connect(this, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1952 std::move(transport_stats); | 1951 std::move(transport_stats); |
| 1953 } | 1952 } |
| 1954 } | 1953 } |
| 1955 return session_stats; | 1954 return session_stats; |
| 1956 } | 1955 } |
| 1957 | 1956 |
| 1958 bool WebRtcSession::CreateSctpTransport_n(const std::string& content_name, | 1957 bool WebRtcSession::CreateSctpTransport_n(const std::string& content_name, |
| 1959 const std::string& transport_name) { | 1958 const std::string& transport_name) { |
| 1960 RTC_DCHECK(network_thread_->IsCurrent()); | 1959 RTC_DCHECK(network_thread_->IsCurrent()); |
| 1961 RTC_DCHECK(sctp_factory_); | 1960 RTC_DCHECK(sctp_factory_); |
| 1962 cricket::TransportChannel* tc = | 1961 cricket::DtlsTransportInternal* tc = |
| 1963 transport_controller_->CreateTransportChannel_n( | 1962 transport_controller_->CreateDtlsTransport_n( |
| 1964 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1963 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1965 sctp_transport_ = sctp_factory_->CreateSctpTransport(tc); | 1964 sctp_transport_ = sctp_factory_->CreateSctpTransport(tc); |
| 1966 RTC_DCHECK(sctp_transport_); | 1965 RTC_DCHECK(sctp_transport_); |
| 1967 sctp_invoker_.reset(new rtc::AsyncInvoker()); | 1966 sctp_invoker_.reset(new rtc::AsyncInvoker()); |
| 1968 sctp_transport_->SignalReadyToSendData.connect( | 1967 sctp_transport_->SignalReadyToSendData.connect( |
| 1969 this, &WebRtcSession::OnSctpTransportReadyToSendData_n); | 1968 this, &WebRtcSession::OnSctpTransportReadyToSendData_n); |
| 1970 sctp_transport_->SignalDataReceived.connect( | 1969 sctp_transport_->SignalDataReceived.connect( |
| 1971 this, &WebRtcSession::OnSctpTransportDataReceived_n); | 1970 this, &WebRtcSession::OnSctpTransportDataReceived_n); |
| 1972 sctp_transport_->SignalStreamClosedRemotely.connect( | 1971 sctp_transport_->SignalStreamClosedRemotely.connect( |
| 1973 this, &WebRtcSession::OnSctpStreamClosedRemotely_n); | 1972 this, &WebRtcSession::OnSctpStreamClosedRemotely_n); |
| 1974 sctp_transport_name_ = rtc::Optional<std::string>(transport_name); | 1973 sctp_transport_name_ = rtc::Optional<std::string>(transport_name); |
| 1975 sctp_content_name_ = rtc::Optional<std::string>(content_name); | 1974 sctp_content_name_ = rtc::Optional<std::string>(content_name); |
| 1976 return true; | 1975 return true; |
| 1977 } | 1976 } |
| 1978 | 1977 |
| 1979 void WebRtcSession::ChangeSctpTransport_n(const std::string& transport_name) { | 1978 void WebRtcSession::ChangeSctpTransport_n(const std::string& transport_name) { |
| 1980 RTC_DCHECK(network_thread_->IsCurrent()); | 1979 RTC_DCHECK(network_thread_->IsCurrent()); |
| 1981 RTC_DCHECK(sctp_transport_); | 1980 RTC_DCHECK(sctp_transport_); |
| 1982 RTC_DCHECK(sctp_transport_name_); | 1981 RTC_DCHECK(sctp_transport_name_); |
| 1983 std::string old_sctp_transport_name = *sctp_transport_name_; | 1982 std::string old_sctp_transport_name = *sctp_transport_name_; |
| 1984 sctp_transport_name_ = rtc::Optional<std::string>(transport_name); | 1983 sctp_transport_name_ = rtc::Optional<std::string>(transport_name); |
| 1985 cricket::TransportChannel* tc = | 1984 cricket::DtlsTransportInternal* tc = |
| 1986 transport_controller_->CreateTransportChannel_n( | 1985 transport_controller_->CreateDtlsTransport_n( |
| 1987 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1986 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1988 sctp_transport_->SetTransportChannel(tc); | 1987 sctp_transport_->SetTransportChannel(tc); |
| 1989 transport_controller_->DestroyTransportChannel_n( | 1988 transport_controller_->DestroyDtlsTransport_n( |
| 1990 old_sctp_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1989 old_sctp_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1991 } | 1990 } |
| 1992 | 1991 |
| 1993 void WebRtcSession::DestroySctpTransport_n() { | 1992 void WebRtcSession::DestroySctpTransport_n() { |
| 1994 RTC_DCHECK(network_thread_->IsCurrent()); | 1993 RTC_DCHECK(network_thread_->IsCurrent()); |
| 1995 sctp_transport_.reset(nullptr); | 1994 sctp_transport_.reset(nullptr); |
| 1996 sctp_content_name_.reset(); | 1995 sctp_content_name_.reset(); |
| 1997 sctp_transport_name_.reset(); | 1996 sctp_transport_name_.reset(); |
| 1998 sctp_invoker_.reset(nullptr); | 1997 sctp_invoker_.reset(nullptr); |
| 1999 sctp_ready_to_send_data_ = false; | 1998 sctp_ready_to_send_data_ = false; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2376 } | 2375 } |
| 2377 } | 2376 } |
| 2378 // Return an empty string if failed to retrieve the transport name. | 2377 // Return an empty string if failed to retrieve the transport name. |
| 2379 return ""; | 2378 return ""; |
| 2380 } | 2379 } |
| 2381 return channel->transport_name(); | 2380 return channel->transport_name(); |
| 2382 } | 2381 } |
| 2383 | 2382 |
| 2384 void WebRtcSession::DestroyRtcpTransport_n(const std::string& transport_name) { | 2383 void WebRtcSession::DestroyRtcpTransport_n(const std::string& transport_name) { |
| 2385 RTC_DCHECK(network_thread()->IsCurrent()); | 2384 RTC_DCHECK(network_thread()->IsCurrent()); |
| 2386 transport_controller_->DestroyTransportChannel_n( | 2385 transport_controller_->DestroyDtlsTransport_n( |
| 2387 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 2386 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 2388 } | 2387 } |
| 2389 | 2388 |
| 2390 void WebRtcSession::DestroyVideoChannel() { | 2389 void WebRtcSession::DestroyVideoChannel() { |
| 2391 SignalVideoChannelDestroyed(); | 2390 SignalVideoChannelDestroyed(); |
| 2392 RTC_DCHECK(video_channel_->rtp_transport()); | 2391 RTC_DCHECK(video_channel_->rtp_dtls_transport()); |
| 2393 std::string transport_name; | 2392 std::string transport_name; |
| 2394 transport_name = video_channel_->rtp_transport()->transport_name(); | 2393 transport_name = video_channel_->rtp_dtls_transport()->transport_name(); |
| 2395 bool need_to_delete_rtcp = (video_channel_->rtcp_transport() != nullptr); | 2394 bool need_to_delete_rtcp = (video_channel_->rtcp_dtls_transport() != nullptr); |
| 2396 channel_manager_->DestroyVideoChannel(video_channel_.release()); | 2395 channel_manager_->DestroyVideoChannel(video_channel_.release()); |
| 2397 transport_controller_->DestroyTransportChannel( | 2396 transport_controller_->DestroyDtlsTransport( |
| 2398 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 2397 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 2399 if (need_to_delete_rtcp) { | 2398 if (need_to_delete_rtcp) { |
| 2400 transport_controller_->DestroyTransportChannel( | 2399 transport_controller_->DestroyDtlsTransport( |
| 2401 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 2400 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 2402 } | 2401 } |
| 2403 } | 2402 } |
| 2404 | 2403 |
| 2405 void WebRtcSession::DestroyVoiceChannel() { | 2404 void WebRtcSession::DestroyVoiceChannel() { |
| 2406 SignalVoiceChannelDestroyed(); | 2405 SignalVoiceChannelDestroyed(); |
| 2407 RTC_DCHECK(voice_channel_->rtp_transport()); | 2406 RTC_DCHECK(voice_channel_->rtp_dtls_transport()); |
| 2408 std::string transport_name; | 2407 std::string transport_name; |
| 2409 transport_name = voice_channel_->rtp_transport()->transport_name(); | 2408 transport_name = voice_channel_->rtp_dtls_transport()->transport_name(); |
| 2410 bool need_to_delete_rtcp = (voice_channel_->rtcp_transport() != nullptr); | 2409 bool need_to_delete_rtcp = (voice_channel_->rtcp_dtls_transport() != nullptr); |
| 2411 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); | 2410 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); |
| 2412 transport_controller_->DestroyTransportChannel( | 2411 transport_controller_->DestroyDtlsTransport( |
| 2413 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 2412 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 2414 if (need_to_delete_rtcp) { | 2413 if (need_to_delete_rtcp) { |
| 2415 transport_controller_->DestroyTransportChannel( | 2414 transport_controller_->DestroyDtlsTransport( |
| 2416 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 2415 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 2417 } | 2416 } |
| 2418 } | 2417 } |
| 2419 | 2418 |
| 2420 void WebRtcSession::DestroyDataChannel() { | 2419 void WebRtcSession::DestroyDataChannel() { |
| 2421 SignalDataChannelDestroyed(); | 2420 SignalDataChannelDestroyed(); |
| 2422 RTC_DCHECK(rtp_data_channel_->rtp_transport()); | 2421 RTC_DCHECK(rtp_data_channel_->rtp_dtls_transport()); |
| 2423 std::string transport_name; | 2422 std::string transport_name; |
| 2424 transport_name = rtp_data_channel_->rtp_transport()->transport_name(); | 2423 transport_name = rtp_data_channel_->rtp_dtls_transport()->transport_name(); |
| 2425 bool need_to_delete_rtcp = (rtp_data_channel_->rtcp_transport() != nullptr); | 2424 bool need_to_delete_rtcp = |
| 2425 (rtp_data_channel_->rtcp_dtls_transport() != nullptr); |
| 2426 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); | 2426 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); |
| 2427 transport_controller_->DestroyTransportChannel( | 2427 transport_controller_->DestroyDtlsTransport( |
| 2428 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 2428 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 2429 if (need_to_delete_rtcp) { | 2429 if (need_to_delete_rtcp) { |
| 2430 transport_controller_->DestroyTransportChannel( | 2430 transport_controller_->DestroyDtlsTransport( |
| 2431 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 2431 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 2432 } | 2432 } |
| 2433 } | 2433 } |
| 2434 } // namespace webrtc | 2434 } // namespace webrtc |
| OLD | NEW |