Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: webrtc/api/webrtcsession.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Fix the format. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 if (!ch->SetTransport(rtp_transport, rtcp_transport)) { 1094 if (!ch->SetTransports(rtp_dtls_transport, rtcp_dtls_transport)) {
1096 LOG(LS_WARNING) << "Failed to enable BUNDLE for " << ch->content_name(); 1095 LOG(LS_WARNING) << "Failed to enable BUNDLE for " << ch->content_name();
1097 return false; 1096 return false;
1098 } 1097 }
1099 LOG(LS_INFO) << "Enabled BUNDLE for " << ch->content_name() << " on " 1098 LOG(LS_INFO) << "Enabled BUNDLE for " << ch->content_name() << " on "
1100 << transport_name << "."; 1099 << transport_name << ".";
1101 DestroyTransport(old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 1100 DestroyTransport(old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
1102 // If the channel needs rtcp, it means that the channel used to have a 1101 // If the channel needs rtcp, it means that the channel used to have a
1103 // rtcp transport which needs to be deleted now. 1102 // rtcp transport which needs to be deleted now.
1104 if (need_rtcp) { 1103 if (need_rtcp) {
1105 DestroyTransport(old_transport_name, 1104 DestroyTransport(old_transport_name,
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 } 1783 }
1785 1784
1786 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, 1785 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content,
1787 const std::string* bundle_transport) { 1786 const std::string* bundle_transport) {
1788 bool require_rtcp_mux = 1787 bool require_rtcp_mux =
1789 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; 1788 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire;
1790 1789
1791 std::string transport_name = 1790 std::string transport_name =
1792 bundle_transport ? *bundle_transport : content->name; 1791 bundle_transport ? *bundle_transport : content->name;
1793 1792
1794 cricket::TransportChannel* rtp_transport = 1793 cricket::DtlsTransportInternal* rtp_dtls_transport =
1795 transport_controller_->CreateTransportChannel( 1794 transport_controller_->CreateDtlsTransport(
1796 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 1795 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
1797 cricket::TransportChannel* rtcp_transport = nullptr; 1796 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr;
1798 if (!require_rtcp_mux) { 1797 if (!require_rtcp_mux) {
1799 rtcp_transport = transport_controller_->CreateTransportChannel( 1798 rtcp_dtls_transport = transport_controller_->CreateDtlsTransport(
1800 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); 1799 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
1801 } 1800 }
1802 1801
1803 voice_channel_.reset(channel_manager_->CreateVoiceChannel( 1802 voice_channel_.reset(channel_manager_->CreateVoiceChannel(
1804 media_controller_, rtp_transport, rtcp_transport, 1803 media_controller_, rtp_dtls_transport, rtcp_dtls_transport,
1805 transport_controller_->signaling_thread(), content->name, 1804 transport_controller_->signaling_thread(), content->name,
1806 bundle_transport, require_rtcp_mux, SrtpRequired(), audio_options_)); 1805 bundle_transport, require_rtcp_mux, SrtpRequired(), audio_options_));
1807 if (!voice_channel_) { 1806 if (!voice_channel_) {
1808 return false; 1807 return false;
1809 } 1808 }
1810 1809
1811 voice_channel_->SignalRtcpMuxFullyActive.connect( 1810 voice_channel_->SignalRtcpMuxFullyActive.connect(
1812 this, &WebRtcSession::DestroyRtcpTransport_n); 1811 this, &WebRtcSession::DestroyRtcpTransport_n);
1813 voice_channel_->SignalDtlsSrtpSetupFailure.connect( 1812 voice_channel_->SignalDtlsSrtpSetupFailure.connect(
1814 this, &WebRtcSession::OnDtlsSrtpSetupFailure); 1813 this, &WebRtcSession::OnDtlsSrtpSetupFailure);
1815 1814
1816 SignalVoiceChannelCreated(); 1815 SignalVoiceChannelCreated();
1817 voice_channel_->SignalSentPacket.connect(this, 1816 voice_channel_->SignalSentPacket.connect(this,
1818 &WebRtcSession::OnSentPacket_w); 1817 &WebRtcSession::OnSentPacket_w);
1819 return true; 1818 return true;
1820 } 1819 }
1821 1820
1822 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, 1821 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content,
1823 const std::string* bundle_transport) { 1822 const std::string* bundle_transport) {
1824 bool require_rtcp_mux = 1823 bool require_rtcp_mux =
1825 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; 1824 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire;
1826 1825
1827 std::string transport_name = 1826 std::string transport_name =
1828 bundle_transport ? *bundle_transport : content->name; 1827 bundle_transport ? *bundle_transport : content->name;
1829 1828
1830 cricket::TransportChannel* rtp_transport = 1829 cricket::DtlsTransportInternal* rtp_dtls_transport =
1831 transport_controller_->CreateTransportChannel( 1830 transport_controller_->CreateDtlsTransport(
1832 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 1831 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
1833 cricket::TransportChannel* rtcp_transport = nullptr; 1832 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr;
1834 if (!require_rtcp_mux) { 1833 if (!require_rtcp_mux) {
1835 rtcp_transport = transport_controller_->CreateTransportChannel( 1834 rtcp_dtls_transport = transport_controller_->CreateDtlsTransport(
1836 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); 1835 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
1837 } 1836 }
1838 1837
1839 video_channel_.reset(channel_manager_->CreateVideoChannel( 1838 video_channel_.reset(channel_manager_->CreateVideoChannel(
1840 media_controller_, rtp_transport, rtcp_transport, 1839 media_controller_, rtp_dtls_transport, rtcp_dtls_transport,
1841 transport_controller_->signaling_thread(), content->name, 1840 transport_controller_->signaling_thread(), content->name,
1842 bundle_transport, require_rtcp_mux, SrtpRequired(), video_options_)); 1841 bundle_transport, require_rtcp_mux, SrtpRequired(), video_options_));
1843 1842
1844 if (!video_channel_) { 1843 if (!video_channel_) {
1845 return false; 1844 return false;
1846 } 1845 }
1847 1846
1848 video_channel_->SignalRtcpMuxFullyActive.connect( 1847 video_channel_->SignalRtcpMuxFullyActive.connect(
1849 this, &WebRtcSession::DestroyRtcpTransport_n); 1848 this, &WebRtcSession::DestroyRtcpTransport_n);
1850 video_channel_->SignalDtlsSrtpSetupFailure.connect( 1849 video_channel_->SignalDtlsSrtpSetupFailure.connect(
1851 this, &WebRtcSession::OnDtlsSrtpSetupFailure); 1850 this, &WebRtcSession::OnDtlsSrtpSetupFailure);
1852 1851
1853 SignalVideoChannelCreated(); 1852 SignalVideoChannelCreated();
1854 video_channel_->SignalSentPacket.connect(this, 1853 video_channel_->SignalSentPacket.connect(this,
1855 &WebRtcSession::OnSentPacket_w); 1854 &WebRtcSession::OnSentPacket_w);
1856 return true; 1855 return true;
1857 } 1856 }
1858 1857
1859 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, 1858 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content,
1860 const std::string* bundle_transport) { 1859 const std::string* bundle_transport) {
1861 const std::string transport_name = 1860 const std::string transport_name =
1862 bundle_transport ? *bundle_transport : content->name; 1861 bundle_transport ? *bundle_transport : content->name;
1863 #ifdef HAVE_QUIC 1862 #ifdef HAVE_QUIC
1864 if (data_channel_type_ == cricket::DCT_QUIC) { 1863 if (data_channel_type_ == cricket::DCT_QUIC) {
1865 RTC_DCHECK(transport_controller_->quic()); 1864 RTC_DCHECK(transport_controller_->quic());
1866 quic_data_transport_->SetTransport(transport_name); 1865 quic_data_transport_->SetTransports(transport_name);
1867 return true; 1866 return true;
1868 } 1867 }
1869 #endif // HAVE_QUIC 1868 #endif // HAVE_QUIC
1870 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); 1869 bool sctp = (data_channel_type_ == cricket::DCT_SCTP);
1871 if (sctp) { 1870 if (sctp) {
1872 if (!sctp_factory_) { 1871 if (!sctp_factory_) {
1873 LOG(LS_ERROR) 1872 LOG(LS_ERROR)
1874 << "Trying to create SCTP transport, but didn't compile with " 1873 << "Trying to create SCTP transport, but didn't compile with "
1875 "SCTP support (HAVE_SCTP)"; 1874 "SCTP support (HAVE_SCTP)";
1876 return false; 1875 return false;
1877 } 1876 }
1878 if (!network_thread_->Invoke<bool>( 1877 if (!network_thread_->Invoke<bool>(
1879 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, 1878 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n,
1880 this, content->name, transport_name))) { 1879 this, content->name, transport_name))) {
1881 return false; 1880 return false;
1882 }; 1881 };
1883 } else { 1882 } else {
1884 bool require_rtcp_mux = 1883 bool require_rtcp_mux =
1885 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; 1884 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire;
1886 1885
1887 std::string transport_name = 1886 std::string transport_name =
1888 bundle_transport ? *bundle_transport : content->name; 1887 bundle_transport ? *bundle_transport : content->name;
1889 cricket::TransportChannel* rtp_transport = 1888 cricket::DtlsTransportInternal* rtp_dtls_transport =
1890 transport_controller_->CreateTransportChannel( 1889 transport_controller_->CreateDtlsTransport(
1891 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 1890 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
1892 cricket::TransportChannel* rtcp_transport = nullptr; 1891 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr;
1893 if (!require_rtcp_mux) { 1892 if (!require_rtcp_mux) {
1894 rtcp_transport = transport_controller_->CreateTransportChannel( 1893 rtcp_dtls_transport = transport_controller_->CreateDtlsTransport(
1895 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); 1894 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
1896 } 1895 }
1897 1896
1898 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( 1897 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel(
1899 media_controller_, rtp_transport, rtcp_transport, 1898 media_controller_, rtp_dtls_transport, rtcp_dtls_transport,
1900 transport_controller_->signaling_thread(), content->name, 1899 transport_controller_->signaling_thread(), content->name,
1901 bundle_transport, require_rtcp_mux, SrtpRequired())); 1900 bundle_transport, require_rtcp_mux, SrtpRequired()));
1902 1901
1903 if (!rtp_data_channel_) { 1902 if (!rtp_data_channel_) {
1904 return false; 1903 return false;
1905 } 1904 }
1906 1905
1907 rtp_data_channel_->SignalRtcpMuxFullyActive.connect( 1906 rtp_data_channel_->SignalRtcpMuxFullyActive.connect(
1908 this, &WebRtcSession::DestroyRtcpTransport_n); 1907 this, &WebRtcSession::DestroyRtcpTransport_n);
1909 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( 1908 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect(
(...skipping 26 matching lines...) Expand all
1936 std::move(transport_stats); 1935 std::move(transport_stats);
1937 } 1936 }
1938 } 1937 }
1939 return session_stats; 1938 return session_stats;
1940 } 1939 }
1941 1940
1942 bool WebRtcSession::CreateSctpTransport_n(const std::string& content_name, 1941 bool WebRtcSession::CreateSctpTransport_n(const std::string& content_name,
1943 const std::string& transport_name) { 1942 const std::string& transport_name) {
1944 RTC_DCHECK(network_thread_->IsCurrent()); 1943 RTC_DCHECK(network_thread_->IsCurrent());
1945 RTC_DCHECK(sctp_factory_); 1944 RTC_DCHECK(sctp_factory_);
1946 cricket::TransportChannel* tc = 1945 cricket::DtlsTransportInternal* tc =
1947 transport_controller_->CreateTransportChannel_n( 1946 transport_controller_->CreateDtlsTransport_n(
1948 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 1947 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
1949 sctp_transport_ = sctp_factory_->CreateSctpTransport(tc); 1948 sctp_transport_ = sctp_factory_->CreateSctpTransport(tc);
1950 RTC_DCHECK(sctp_transport_); 1949 RTC_DCHECK(sctp_transport_);
1951 sctp_invoker_.reset(new rtc::AsyncInvoker()); 1950 sctp_invoker_.reset(new rtc::AsyncInvoker());
1952 sctp_transport_->SignalReadyToSendData.connect( 1951 sctp_transport_->SignalReadyToSendData.connect(
1953 this, &WebRtcSession::OnSctpTransportReadyToSendData_n); 1952 this, &WebRtcSession::OnSctpTransportReadyToSendData_n);
1954 sctp_transport_->SignalDataReceived.connect( 1953 sctp_transport_->SignalDataReceived.connect(
1955 this, &WebRtcSession::OnSctpTransportDataReceived_n); 1954 this, &WebRtcSession::OnSctpTransportDataReceived_n);
1956 sctp_transport_->SignalStreamClosedRemotely.connect( 1955 sctp_transport_->SignalStreamClosedRemotely.connect(
1957 this, &WebRtcSession::OnSctpStreamClosedRemotely_n); 1956 this, &WebRtcSession::OnSctpStreamClosedRemotely_n);
1958 sctp_transport_name_ = rtc::Optional<std::string>(transport_name); 1957 sctp_transport_name_ = rtc::Optional<std::string>(transport_name);
1959 sctp_content_name_ = rtc::Optional<std::string>(content_name); 1958 sctp_content_name_ = rtc::Optional<std::string>(content_name);
1960 return true; 1959 return true;
1961 } 1960 }
1962 1961
1963 void WebRtcSession::ChangeSctpTransport_n(const std::string& transport_name) { 1962 void WebRtcSession::ChangeSctpTransport_n(const std::string& transport_name) {
1964 RTC_DCHECK(network_thread_->IsCurrent()); 1963 RTC_DCHECK(network_thread_->IsCurrent());
1965 RTC_DCHECK(sctp_transport_); 1964 RTC_DCHECK(sctp_transport_);
1966 RTC_DCHECK(sctp_transport_name_); 1965 RTC_DCHECK(sctp_transport_name_);
1967 std::string old_sctp_transport_name = *sctp_transport_name_; 1966 std::string old_sctp_transport_name = *sctp_transport_name_;
1968 sctp_transport_name_ = rtc::Optional<std::string>(transport_name); 1967 sctp_transport_name_ = rtc::Optional<std::string>(transport_name);
1969 cricket::TransportChannel* tc = 1968 cricket::DtlsTransportInternal* tc =
1970 transport_controller_->CreateTransportChannel_n( 1969 transport_controller_->CreateDtlsTransport_n(
1971 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 1970 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
1972 sctp_transport_->SetTransportChannel(tc); 1971 sctp_transport_->SetTransportChannel(tc);
1973 transport_controller_->DestroyTransportChannel_n( 1972 transport_controller_->DestroyDtlsTransport_n(
1974 old_sctp_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 1973 old_sctp_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
1975 } 1974 }
1976 1975
1977 void WebRtcSession::DestroySctpTransport_n() { 1976 void WebRtcSession::DestroySctpTransport_n() {
1978 RTC_DCHECK(network_thread_->IsCurrent()); 1977 RTC_DCHECK(network_thread_->IsCurrent());
1979 sctp_transport_.reset(nullptr); 1978 sctp_transport_.reset(nullptr);
1980 sctp_content_name_.reset(); 1979 sctp_content_name_.reset();
1981 sctp_transport_name_.reset(); 1980 sctp_transport_name_.reset();
1982 sctp_invoker_.reset(nullptr); 1981 sctp_invoker_.reset(nullptr);
1983 sctp_ready_to_send_data_ = false; 1982 sctp_ready_to_send_data_ = false;
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 // Return an empty string if failed to retrieve the transport name. 2361 // Return an empty string if failed to retrieve the transport name.
2363 return ""; 2362 return "";
2364 } 2363 }
2365 return channel->transport_name(); 2364 return channel->transport_name();
2366 } 2365 }
2367 2366
2368 void WebRtcSession::DestroyTransport(const std::string& transport_name, 2367 void WebRtcSession::DestroyTransport(const std::string& transport_name,
2369 int component) { 2368 int component) {
2370 network_thread_->Invoke<void>( 2369 network_thread_->Invoke<void>(
2371 RTC_FROM_HERE, 2370 RTC_FROM_HERE,
2372 rtc::Bind(&cricket::TransportController::DestroyTransportChannel_n, 2371 rtc::Bind(&cricket::TransportController::DestroyDtlsTransport_n,
2373 transport_controller_.get(), transport_name, component)); 2372 transport_controller_.get(), transport_name, component));
2374 } 2373 }
2375 2374
2376 void WebRtcSession::DestroyRtcpTransport_n(const std::string& transport_name) { 2375 void WebRtcSession::DestroyRtcpTransport_n(const std::string& transport_name) {
2377 RTC_DCHECK(network_thread()->IsCurrent()); 2376 RTC_DCHECK(network_thread()->IsCurrent());
2378 transport_controller_->DestroyTransportChannel_n( 2377 transport_controller_->DestroyDtlsTransport_n(
2379 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); 2378 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
2380 } 2379 }
2381 2380
2382 void WebRtcSession::DestroyVideoChannel() { 2381 void WebRtcSession::DestroyVideoChannel() {
2383 SignalVideoChannelDestroyed(); 2382 SignalVideoChannelDestroyed();
2384 RTC_DCHECK(video_channel_->rtp_transport()); 2383 RTC_DCHECK(video_channel_->rtp_dtls_transport());
2385 std::string transport_name; 2384 std::string transport_name;
2386 transport_name = video_channel_->rtp_transport()->transport_name(); 2385 transport_name = video_channel_->rtp_dtls_transport()->transport_name();
2387 bool need_to_delete_rtcp = (video_channel_->rtcp_transport() != nullptr); 2386 bool need_to_delete_rtcp = (video_channel_->rtcp_dtls_transport() != nullptr);
2388 channel_manager_->DestroyVideoChannel(video_channel_.release()); 2387 channel_manager_->DestroyVideoChannel(video_channel_.release());
2389 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 2388 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
2390 if (need_to_delete_rtcp) { 2389 if (need_to_delete_rtcp) {
2391 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); 2390 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
2392 } 2391 }
2393 } 2392 }
2394 2393
2395 void WebRtcSession::DestroyVoiceChannel() { 2394 void WebRtcSession::DestroyVoiceChannel() {
2396 SignalVoiceChannelDestroyed(); 2395 SignalVoiceChannelDestroyed();
2397 RTC_DCHECK(voice_channel_->rtp_transport()); 2396 RTC_DCHECK(voice_channel_->rtp_dtls_transport());
2398 std::string transport_name; 2397 std::string transport_name;
2399 transport_name = voice_channel_->rtp_transport()->transport_name(); 2398 transport_name = voice_channel_->rtp_dtls_transport()->transport_name();
2400 bool need_to_delete_rtcp = (voice_channel_->rtcp_transport() != nullptr); 2399 bool need_to_delete_rtcp = (voice_channel_->rtcp_dtls_transport() != nullptr);
2401 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); 2400 channel_manager_->DestroyVoiceChannel(voice_channel_.release());
2402 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 2401 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
2403 if (need_to_delete_rtcp) { 2402 if (need_to_delete_rtcp) {
2404 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); 2403 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
2405 } 2404 }
2406 } 2405 }
2407 2406
2408 void WebRtcSession::DestroyDataChannel() { 2407 void WebRtcSession::DestroyDataChannel() {
2409 SignalDataChannelDestroyed(); 2408 SignalDataChannelDestroyed();
2410 RTC_DCHECK(rtp_data_channel_->rtp_transport()); 2409 RTC_DCHECK(rtp_data_channel_->rtp_dtls_transport());
2411 std::string transport_name; 2410 std::string transport_name;
2412 transport_name = rtp_data_channel_->rtp_transport()->transport_name(); 2411 transport_name = rtp_data_channel_->rtp_dtls_transport()->transport_name();
2413 bool need_to_delete_rtcp = (rtp_data_channel_->rtcp_transport() != nullptr); 2412 bool need_to_delete_rtcp =
2413 (rtp_data_channel_->rtcp_dtls_transport() != nullptr);
2414 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); 2414 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release());
2415 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); 2415 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
2416 if (need_to_delete_rtcp) { 2416 if (need_to_delete_rtcp) {
2417 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); 2417 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP);
2418 } 2418 }
2419 } 2419 }
2420 } // namespace webrtc 2420 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698