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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 this, &WebRtcSession::OnTransportControllerCandidatesRemoved); | 499 this, &WebRtcSession::OnTransportControllerCandidatesRemoved); |
500 transport_controller_->SignalDtlsHandshakeError.connect( | 500 transport_controller_->SignalDtlsHandshakeError.connect( |
501 this, &WebRtcSession::OnTransportControllerDtlsHandshakeError); | 501 this, &WebRtcSession::OnTransportControllerDtlsHandshakeError); |
502 } | 502 } |
503 | 503 |
504 WebRtcSession::~WebRtcSession() { | 504 WebRtcSession::~WebRtcSession() { |
505 ASSERT(signaling_thread()->IsCurrent()); | 505 ASSERT(signaling_thread()->IsCurrent()); |
506 // Destroy video_channel_ first since it may have a pointer to the | 506 // Destroy video_channel_ first since it may have a pointer to the |
507 // voice_channel_. | 507 // voice_channel_. |
508 if (video_channel_) { | 508 if (video_channel_) { |
509 SignalVideoChannelDestroyed(); | 509 DestroyVideoChannel(); |
510 channel_manager_->DestroyVideoChannel(video_channel_.release()); | |
511 } | 510 } |
512 if (voice_channel_) { | 511 if (voice_channel_) { |
513 SignalVoiceChannelDestroyed(); | 512 DestroyVoiceChannel(); |
514 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); | |
515 } | 513 } |
516 if (rtp_data_channel_) { | 514 if (rtp_data_channel_) { |
517 SignalDataChannelDestroyed(); | 515 DestroyDataChannel(); |
518 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); | |
519 } | 516 } |
520 if (sctp_transport_) { | 517 if (sctp_transport_) { |
521 SignalDataChannelDestroyed(); | 518 SignalDataChannelDestroyed(); |
522 network_thread_->Invoke<void>( | 519 network_thread_->Invoke<void>( |
523 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::DestroySctpTransport_n, this)); | 520 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::DestroySctpTransport_n, this)); |
524 } | 521 } |
525 #ifdef HAVE_QUIC | 522 #ifdef HAVE_QUIC |
526 if (quic_data_transport_) { | 523 if (quic_data_transport_) { |
527 quic_data_transport_.reset(); | 524 quic_data_transport_.reset(); |
528 } | 525 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
729 // is applied. Restore back to old description. | 726 // is applied. Restore back to old description. |
730 return BadLocalSdp(desc->type(), kCreateChannelFailed, err_desc); | 727 return BadLocalSdp(desc->type(), kCreateChannelFailed, err_desc); |
731 } | 728 } |
732 | 729 |
733 // Remove unused channels if MediaContentDescription is rejected. | 730 // Remove unused channels if MediaContentDescription is rejected. |
734 RemoveUnusedChannels(local_description()->description()); | 731 RemoveUnusedChannels(local_description()->description()); |
735 | 732 |
736 if (!UpdateSessionState(action, cricket::CS_LOCAL, err_desc)) { | 733 if (!UpdateSessionState(action, cricket::CS_LOCAL, err_desc)) { |
737 return false; | 734 return false; |
738 } | 735 } |
739 | |
740 if (remote_description()) { | 736 if (remote_description()) { |
741 // Now that we have a local description, we can push down remote candidates. | 737 // Now that we have a local description, we can push down remote candidates. |
742 UseCandidatesInSessionDescription(remote_description()); | 738 UseCandidatesInSessionDescription(remote_description()); |
743 } | 739 } |
744 | 740 |
745 pending_ice_restarts_.clear(); | 741 pending_ice_restarts_.clear(); |
746 | |
747 if (error() != ERROR_NONE) { | 742 if (error() != ERROR_NONE) { |
748 return BadLocalSdp(desc->type(), GetSessionErrorMsg(), err_desc); | 743 return BadLocalSdp(desc->type(), GetSessionErrorMsg(), err_desc); |
749 } | 744 } |
750 return true; | 745 return true; |
751 } | 746 } |
752 | 747 |
753 bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc, | 748 bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc, |
754 std::string* err_desc) { | 749 std::string* err_desc) { |
755 ASSERT(signaling_thread()->IsCurrent()); | 750 ASSERT(signaling_thread()->IsCurrent()); |
756 | 751 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1067 const std::string& transport_name = *first_content_name; | 1062 const std::string& transport_name = *first_content_name; |
1068 | 1063 |
1069 #ifdef HAVE_QUIC | 1064 #ifdef HAVE_QUIC |
1070 if (quic_data_transport_ && | 1065 if (quic_data_transport_ && |
1071 bundle.HasContentName(quic_data_transport_->content_name()) && | 1066 bundle.HasContentName(quic_data_transport_->content_name()) && |
1072 quic_data_transport_->transport_name() != transport_name) { | 1067 quic_data_transport_->transport_name() != transport_name) { |
1073 LOG(LS_ERROR) << "Unable to BUNDLE " << quic_data_transport_->content_name() | 1068 LOG(LS_ERROR) << "Unable to BUNDLE " << quic_data_transport_->content_name() |
1074 << " on " << transport_name << "with QUIC."; | 1069 << " on " << transport_name << "with QUIC."; |
1075 } | 1070 } |
1076 #endif | 1071 #endif |
1077 | |
1078 auto maybe_set_transport = [this, bundle, | 1072 auto maybe_set_transport = [this, bundle, |
1079 transport_name](cricket::BaseChannel* ch) { | 1073 transport_name](cricket::BaseChannel* ch) { |
1080 if (!ch || !bundle.HasContentName(ch->content_name())) { | 1074 if (!ch || !bundle.HasContentName(ch->content_name())) { |
1081 return true; | 1075 return true; |
1082 } | 1076 } |
1083 | 1077 |
1084 if (ch->transport_name() == transport_name) { | 1078 std::string old_transport_name = ch->transport_name(); |
1079 if (old_transport_name == transport_name) { | |
1085 LOG(LS_INFO) << "BUNDLE already enabled for " << ch->content_name() | 1080 LOG(LS_INFO) << "BUNDLE already enabled for " << ch->content_name() |
1086 << " on " << transport_name << "."; | 1081 << " on " << transport_name << "."; |
1087 return true; | 1082 return true; |
1088 } | 1083 } |
1084 bool need_to_delete_rtcp = (ch->rtcp_transport() != nullptr); | |
1089 | 1085 |
1090 if (!ch->SetTransport(transport_name)) { | 1086 cricket::TransportChannel* rtp_transport = |
1087 transport_controller_->CreateTransportChannel( | |
1088 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
1089 cricket::TransportChannel* rtcp_transport = nullptr; | |
1090 if (ch->NeedsRtcpTransport()) { | |
1091 rtcp_transport = transport_controller_->CreateTransportChannel_n( | |
1092 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
1093 } | |
1094 | |
1095 if (!ch->SetTransport(rtp_transport, rtcp_transport)) { | |
1091 LOG(LS_WARNING) << "Failed to enable BUNDLE for " << ch->content_name(); | 1096 LOG(LS_WARNING) << "Failed to enable BUNDLE for " << ch->content_name(); |
1092 return false; | 1097 return false; |
1093 } | 1098 } |
1094 LOG(LS_INFO) << "Enabled BUNDLE for " << ch->content_name() << " on " | 1099 LOG(LS_INFO) << "Enabled BUNDLE for " << ch->content_name() << " on " |
1095 << transport_name << "."; | 1100 << transport_name << "."; |
1101 DestroyTransport(old_transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
1102 if (need_to_delete_rtcp) { | |
1103 DestroyTransport(old_transport_name, | |
1104 cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
1105 } | |
1096 return true; | 1106 return true; |
1097 }; | 1107 }; |
1098 | 1108 |
1099 if (!maybe_set_transport(voice_channel()) || | 1109 if (!maybe_set_transport(voice_channel()) || |
1100 !maybe_set_transport(video_channel()) || | 1110 !maybe_set_transport(video_channel()) || |
1101 !maybe_set_transport(rtp_data_channel())) { | 1111 !maybe_set_transport(rtp_data_channel())) { |
1102 return false; | 1112 return false; |
1103 } | 1113 } |
1104 // For SCTP, transport creation/deletion happens here instead of in the | 1114 // For SCTP, transport creation/deletion happens here instead of in the |
1105 // object itself. | 1115 // object itself. |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1673 } | 1683 } |
1674 return true; | 1684 return true; |
1675 } | 1685 } |
1676 | 1686 |
1677 void WebRtcSession::RemoveUnusedChannels(const SessionDescription* desc) { | 1687 void WebRtcSession::RemoveUnusedChannels(const SessionDescription* desc) { |
1678 // Destroy video_channel_ first since it may have a pointer to the | 1688 // Destroy video_channel_ first since it may have a pointer to the |
1679 // voice_channel_. | 1689 // voice_channel_. |
1680 const cricket::ContentInfo* video_info = | 1690 const cricket::ContentInfo* video_info = |
1681 cricket::GetFirstVideoContent(desc); | 1691 cricket::GetFirstVideoContent(desc); |
1682 if ((!video_info || video_info->rejected) && video_channel_) { | 1692 if ((!video_info || video_info->rejected) && video_channel_) { |
1683 SignalVideoChannelDestroyed(); | 1693 DestroyVideoChannel(); |
1684 channel_manager_->DestroyVideoChannel(video_channel_.release()); | |
1685 } | 1694 } |
1686 | 1695 |
1687 const cricket::ContentInfo* voice_info = | 1696 const cricket::ContentInfo* voice_info = |
1688 cricket::GetFirstAudioContent(desc); | 1697 cricket::GetFirstAudioContent(desc); |
1689 if ((!voice_info || voice_info->rejected) && voice_channel_) { | 1698 if ((!voice_info || voice_info->rejected) && voice_channel_) { |
1690 SignalVoiceChannelDestroyed(); | 1699 DestroyVoiceChannel(); |
1691 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); | |
1692 } | 1700 } |
1693 | 1701 |
1694 const cricket::ContentInfo* data_info = | 1702 const cricket::ContentInfo* data_info = |
1695 cricket::GetFirstDataContent(desc); | 1703 cricket::GetFirstDataContent(desc); |
1696 if (!data_info || data_info->rejected) { | 1704 if (!data_info || data_info->rejected) { |
1697 if (rtp_data_channel_) { | 1705 if (rtp_data_channel_) { |
1698 SignalDataChannelDestroyed(); | 1706 DestroyDataChannel(); |
1699 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); | |
1700 } | 1707 } |
1701 if (sctp_transport_) { | 1708 if (sctp_transport_) { |
1702 SignalDataChannelDestroyed(); | 1709 SignalDataChannelDestroyed(); |
1703 network_thread_->Invoke<void>( | 1710 network_thread_->Invoke<void>( |
1704 RTC_FROM_HERE, | 1711 RTC_FROM_HERE, |
1705 rtc::Bind(&WebRtcSession::DestroySctpTransport_n, this)); | 1712 rtc::Bind(&WebRtcSession::DestroySctpTransport_n, this)); |
1706 } | 1713 } |
1707 #ifdef HAVE_QUIC | 1714 #ifdef HAVE_QUIC |
1708 // Clean up the existing QuicDataTransport and its QuicTransportChannels. | 1715 // Clean up the existing QuicDataTransport and its QuicTransportChannels. |
1709 if (quic_data_transport_) { | 1716 if (quic_data_transport_) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1772 } | 1779 } |
1773 | 1780 |
1774 return true; | 1781 return true; |
1775 } | 1782 } |
1776 | 1783 |
1777 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, | 1784 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, |
1778 const std::string* bundle_transport) { | 1785 const std::string* bundle_transport) { |
1779 bool require_rtcp_mux = | 1786 bool require_rtcp_mux = |
1780 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1787 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
1781 bool create_rtcp_transport_channel = !require_rtcp_mux; | 1788 bool create_rtcp_transport_channel = !require_rtcp_mux; |
1789 | |
1790 std::string transport_name = | |
1791 bundle_transport ? *bundle_transport : content->name; | |
1792 | |
1793 cricket::TransportChannel* rtp_transport = | |
1794 transport_controller_->CreateTransportChannel( | |
1795 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
1796 cricket::TransportChannel* rtcp_transport = nullptr; | |
1797 if (create_rtcp_transport_channel) { | |
1798 rtcp_transport = transport_controller_->CreateTransportChannel( | |
1799 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
1800 } | |
1801 | |
1782 voice_channel_.reset(channel_manager_->CreateVoiceChannel( | 1802 voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
1783 media_controller_, transport_controller_.get(), content->name, | 1803 media_controller_, rtp_transport, rtcp_transport, |
1804 transport_controller_->signaling_thread(), content->name, | |
1784 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), | 1805 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), |
1785 audio_options_)); | 1806 audio_options_)); |
1786 if (!voice_channel_) { | 1807 if (!voice_channel_) { |
1787 return false; | 1808 return false; |
1788 } | 1809 } |
1810 | |
1811 voice_channel_->SignalDestroyRtcpTransport.connect( | |
1812 this, &WebRtcSession::OnDestroyRtcpTransport_n); | |
1789 if (require_rtcp_mux) { | 1813 if (require_rtcp_mux) { |
1790 voice_channel_->ActivateRtcpMux(); | 1814 voice_channel_->ActivateRtcpMux(); |
1791 } | 1815 } |
1792 | 1816 |
1793 voice_channel_->SignalDtlsSrtpSetupFailure.connect( | 1817 voice_channel_->SignalDtlsSrtpSetupFailure.connect( |
1794 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1818 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
1795 | 1819 |
1796 SignalVoiceChannelCreated(); | 1820 SignalVoiceChannelCreated(); |
1797 voice_channel_->SignalSentPacket.connect(this, | 1821 voice_channel_->SignalSentPacket.connect(this, |
1798 &WebRtcSession::OnSentPacket_w); | 1822 &WebRtcSession::OnSentPacket_w); |
1799 return true; | 1823 return true; |
1800 } | 1824 } |
1801 | 1825 |
1802 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, | 1826 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, |
1803 const std::string* bundle_transport) { | 1827 const std::string* bundle_transport) { |
1804 bool require_rtcp_mux = | 1828 bool require_rtcp_mux = |
1805 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1829 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
1806 bool create_rtcp_transport_channel = !require_rtcp_mux; | 1830 bool create_rtcp_transport_channel = !require_rtcp_mux; |
1831 | |
1832 std::string transport_name = | |
1833 bundle_transport ? *bundle_transport : content->name; | |
1834 | |
1835 cricket::TransportChannel* rtp_transport = | |
1836 transport_controller_->CreateTransportChannel( | |
1837 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
1838 cricket::TransportChannel* rtcp_transport = nullptr; | |
1839 if (create_rtcp_transport_channel) { | |
1840 rtcp_transport = transport_controller_->CreateTransportChannel( | |
1841 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
1842 } | |
1843 | |
1807 video_channel_.reset(channel_manager_->CreateVideoChannel( | 1844 video_channel_.reset(channel_manager_->CreateVideoChannel( |
1808 media_controller_, transport_controller_.get(), content->name, | 1845 media_controller_, rtp_transport, rtcp_transport, |
1846 transport_controller_->signaling_thread(), content->name, | |
1809 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), | 1847 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), |
1810 video_options_)); | 1848 video_options_)); |
1849 | |
1811 if (!video_channel_) { | 1850 if (!video_channel_) { |
1812 return false; | 1851 return false; |
1813 } | 1852 } |
1853 | |
1854 video_channel_->SignalDestroyRtcpTransport.connect( | |
1855 this, &WebRtcSession::OnDestroyRtcpTransport_n); | |
1814 if (require_rtcp_mux) { | 1856 if (require_rtcp_mux) { |
1815 video_channel_->ActivateRtcpMux(); | 1857 video_channel_->ActivateRtcpMux(); |
1816 } | 1858 } |
1817 video_channel_->SignalDtlsSrtpSetupFailure.connect( | 1859 video_channel_->SignalDtlsSrtpSetupFailure.connect( |
1818 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1860 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
1819 | 1861 |
1820 SignalVideoChannelCreated(); | 1862 SignalVideoChannelCreated(); |
1821 video_channel_->SignalSentPacket.connect(this, | 1863 video_channel_->SignalSentPacket.connect(this, |
1822 &WebRtcSession::OnSentPacket_w); | 1864 &WebRtcSession::OnSentPacket_w); |
1823 return true; | 1865 return true; |
(...skipping 20 matching lines...) Expand all Loading... | |
1844 } | 1886 } |
1845 if (!network_thread_->Invoke<bool>( | 1887 if (!network_thread_->Invoke<bool>( |
1846 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, | 1888 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, |
1847 this, content->name, transport_name))) { | 1889 this, content->name, transport_name))) { |
1848 return false; | 1890 return false; |
1849 }; | 1891 }; |
1850 } else { | 1892 } else { |
1851 bool require_rtcp_mux = | 1893 bool require_rtcp_mux = |
1852 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1894 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
1853 bool create_rtcp_transport_channel = !sctp && !require_rtcp_mux; | 1895 bool create_rtcp_transport_channel = !sctp && !require_rtcp_mux; |
1896 | |
1897 std::string transport_name = | |
1898 bundle_transport ? *bundle_transport : content->name; | |
1899 cricket::TransportChannel* rtp_transport = | |
1900 transport_controller_->CreateTransportChannel( | |
1901 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
1902 cricket::TransportChannel* rtcp_transport = nullptr; | |
1903 if (create_rtcp_transport_channel) { | |
1904 rtcp_transport = transport_controller_->CreateTransportChannel( | |
1905 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
1906 } | |
1907 | |
1854 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( | 1908 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( |
1855 media_controller_, transport_controller_.get(), content->name, | 1909 media_controller_, rtp_transport, rtcp_transport, |
1910 transport_controller_->signaling_thread(), content->name, | |
1856 bundle_transport, create_rtcp_transport_channel, SrtpRequired())); | 1911 bundle_transport, create_rtcp_transport_channel, SrtpRequired())); |
1912 | |
1857 if (!rtp_data_channel_) { | 1913 if (!rtp_data_channel_) { |
1858 return false; | 1914 return false; |
1859 } | 1915 } |
1916 | |
1917 rtp_data_channel_->SignalDestroyRtcpTransport.connect( | |
1918 this, &WebRtcSession::OnDestroyRtcpTransport_n); | |
1919 | |
1860 if (require_rtcp_mux) { | 1920 if (require_rtcp_mux) { |
1861 rtp_data_channel_->ActivateRtcpMux(); | 1921 rtp_data_channel_->ActivateRtcpMux(); |
1862 } | 1922 } |
1863 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( | 1923 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( |
1864 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1924 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
1865 rtp_data_channel_->SignalSentPacket.connect(this, | 1925 rtp_data_channel_->SignalSentPacket.connect(this, |
1866 &WebRtcSession::OnSentPacket_w); | 1926 &WebRtcSession::OnSentPacket_w); |
1867 } | 1927 } |
1868 | 1928 |
1869 SignalDataChannelCreated(); | 1929 SignalDataChannelCreated(); |
1930 | |
1870 return true; | 1931 return true; |
1871 } | 1932 } |
1872 | 1933 |
1873 std::unique_ptr<SessionStats> WebRtcSession::GetStats_n( | 1934 std::unique_ptr<SessionStats> WebRtcSession::GetStats_n( |
1874 const ChannelNamePairs& channel_name_pairs) { | 1935 const ChannelNamePairs& channel_name_pairs) { |
1875 ASSERT(network_thread()->IsCurrent()); | 1936 ASSERT(network_thread()->IsCurrent()); |
1876 std::unique_ptr<SessionStats> session_stats(new SessionStats()); | 1937 std::unique_ptr<SessionStats> session_stats(new SessionStats()); |
1877 for (const auto channel_name_pair : { &channel_name_pairs.voice, | 1938 for (const auto channel_name_pair : { &channel_name_pairs.voice, |
1878 &channel_name_pairs.video, | 1939 &channel_name_pairs.video, |
1879 &channel_name_pairs.data }) { | 1940 &channel_name_pairs.data }) { |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2311 if (content_name == *sctp_content_name_) { | 2372 if (content_name == *sctp_content_name_) { |
2312 return *sctp_transport_name_; | 2373 return *sctp_transport_name_; |
2313 } | 2374 } |
2314 } | 2375 } |
2315 // Return an empty string if failed to retrieve the transport name. | 2376 // Return an empty string if failed to retrieve the transport name. |
2316 return ""; | 2377 return ""; |
2317 } | 2378 } |
2318 return channel->transport_name(); | 2379 return channel->transport_name(); |
2319 } | 2380 } |
2320 | 2381 |
2382 void WebRtcSession::DestroyTransport(const std::string& transport_name, | |
2383 int component) { | |
2384 network_thread_->Invoke<void>( | |
2385 RTC_FROM_HERE, | |
2386 rtc::Bind(&cricket::TransportController::DestroyTransportChannel_n, | |
2387 transport_controller_.get(), transport_name, component)); | |
2388 } | |
2389 | |
2390 void WebRtcSession::OnDestroyRtcpTransport_n( | |
2391 const std::string& transport_name) { | |
2392 ASSERT(network_thread()->IsCurrent()); | |
2393 transport_controller_->DestroyTransportChannel_n( | |
2394 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
2395 } | |
2396 | |
2397 void WebRtcSession::DestroyVideoChannel() { | |
2398 SignalVideoChannelDestroyed(); | |
2399 RTC_DCHECK(video_channel_->rtp_transport()); | |
2400 std::string transport_name; | |
2401 transport_name = video_channel_->rtp_transport()->transport_name(); | |
2402 channel_manager_->DestroyVideoChannel(video_channel_.release()); | |
2403 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
2404 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
Taylor Brandstetter
2017/01/12 22:39:02
Do you need to do the "need_to_delete_rtcp" thing
Zhi Huang
2017/01/13 00:12:47
Yes. This is needed.
| |
2405 } | |
2406 | |
2407 void WebRtcSession::DestroyVoiceChannel() { | |
2408 SignalVoiceChannelDestroyed(); | |
2409 RTC_DCHECK(voice_channel_->rtp_transport()); | |
2410 std::string transport_name; | |
2411 transport_name = voice_channel_->rtp_transport()->transport_name(); | |
2412 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); | |
2413 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
2414 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
2415 } | |
2416 | |
2417 void WebRtcSession::DestroyDataChannel() { | |
2418 SignalDataChannelDestroyed(); | |
2419 RTC_DCHECK(rtp_data_channel_->rtp_transport()); | |
2420 std::string transport_name; | |
2421 transport_name = rtp_data_channel_->rtp_transport()->transport_name(); | |
2422 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); | |
2423 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
2424 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
2425 } | |
2321 } // namespace webrtc | 2426 } // namespace webrtc |
OLD | NEW |