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