Chromium Code Reviews| 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 RTC_DCHECK(signaling_thread()->IsCurrent()); | 505 RTC_DCHECK(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 RTC_DCHECK(signaling_thread()->IsCurrent()); | 750 RTC_DCHECK(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 } |
| 1089 | 1084 |
| 1090 if (!ch->SetTransport(transport_name)) { | 1085 cricket::TransportChannel* rtp_transport = |
| 1086 transport_controller_->CreateTransportChannel( | |
| 1087 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 1088 bool need_rtcp = (ch->rtcp_transport() != nullptr); | |
| 1089 cricket::TransportChannel* rtcp_transport = nullptr; | |
| 1090 if (need_rtcp) { | |
| 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; |
|
pthatcher1
2017/01/13 21:51:07
If it failed, do you need to destroy the new trans
Taylor Brandstetter
2017/01/13 23:46:48
It won't ever fail unless invalid arguments are su
| |
| 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 the channel needs rtcp, it means that the channel used to have a | |
| 1103 // rtcp transport which needs to be deleted now. | |
| 1104 if (need_rtcp) { | |
| 1105 DestroyTransport(old_transport_name, | |
| 1106 cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 1107 } | |
| 1096 return true; | 1108 return true; |
| 1097 }; | 1109 }; |
| 1098 | 1110 |
| 1099 if (!maybe_set_transport(voice_channel()) || | 1111 if (!maybe_set_transport(voice_channel()) || |
| 1100 !maybe_set_transport(video_channel()) || | 1112 !maybe_set_transport(video_channel()) || |
| 1101 !maybe_set_transport(rtp_data_channel())) { | 1113 !maybe_set_transport(rtp_data_channel())) { |
| 1102 return false; | 1114 return false; |
| 1103 } | 1115 } |
| 1104 // For SCTP, transport creation/deletion happens here instead of in the | 1116 // For SCTP, transport creation/deletion happens here instead of in the |
| 1105 // object itself. | 1117 // object itself. |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1673 } | 1685 } |
| 1674 return true; | 1686 return true; |
| 1675 } | 1687 } |
| 1676 | 1688 |
| 1677 void WebRtcSession::RemoveUnusedChannels(const SessionDescription* desc) { | 1689 void WebRtcSession::RemoveUnusedChannels(const SessionDescription* desc) { |
| 1678 // Destroy video_channel_ first since it may have a pointer to the | 1690 // Destroy video_channel_ first since it may have a pointer to the |
| 1679 // voice_channel_. | 1691 // voice_channel_. |
| 1680 const cricket::ContentInfo* video_info = | 1692 const cricket::ContentInfo* video_info = |
| 1681 cricket::GetFirstVideoContent(desc); | 1693 cricket::GetFirstVideoContent(desc); |
| 1682 if ((!video_info || video_info->rejected) && video_channel_) { | 1694 if ((!video_info || video_info->rejected) && video_channel_) { |
| 1683 SignalVideoChannelDestroyed(); | 1695 DestroyVideoChannel(); |
| 1684 channel_manager_->DestroyVideoChannel(video_channel_.release()); | |
| 1685 } | 1696 } |
| 1686 | 1697 |
| 1687 const cricket::ContentInfo* voice_info = | 1698 const cricket::ContentInfo* voice_info = |
| 1688 cricket::GetFirstAudioContent(desc); | 1699 cricket::GetFirstAudioContent(desc); |
| 1689 if ((!voice_info || voice_info->rejected) && voice_channel_) { | 1700 if ((!voice_info || voice_info->rejected) && voice_channel_) { |
| 1690 SignalVoiceChannelDestroyed(); | 1701 DestroyVoiceChannel(); |
| 1691 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); | |
| 1692 } | 1702 } |
| 1693 | 1703 |
| 1694 const cricket::ContentInfo* data_info = | 1704 const cricket::ContentInfo* data_info = |
| 1695 cricket::GetFirstDataContent(desc); | 1705 cricket::GetFirstDataContent(desc); |
| 1696 if (!data_info || data_info->rejected) { | 1706 if (!data_info || data_info->rejected) { |
| 1697 if (rtp_data_channel_) { | 1707 if (rtp_data_channel_) { |
| 1698 SignalDataChannelDestroyed(); | 1708 DestroyDataChannel(); |
| 1699 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); | |
| 1700 } | 1709 } |
| 1701 if (sctp_transport_) { | 1710 if (sctp_transport_) { |
| 1702 SignalDataChannelDestroyed(); | 1711 SignalDataChannelDestroyed(); |
| 1703 network_thread_->Invoke<void>( | 1712 network_thread_->Invoke<void>( |
| 1704 RTC_FROM_HERE, | 1713 RTC_FROM_HERE, |
| 1705 rtc::Bind(&WebRtcSession::DestroySctpTransport_n, this)); | 1714 rtc::Bind(&WebRtcSession::DestroySctpTransport_n, this)); |
| 1706 } | 1715 } |
| 1707 #ifdef HAVE_QUIC | 1716 #ifdef HAVE_QUIC |
| 1708 // Clean up the existing QuicDataTransport and its QuicTransportChannels. | 1717 // Clean up the existing QuicDataTransport and its QuicTransportChannels. |
| 1709 if (quic_data_transport_) { | 1718 if (quic_data_transport_) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1772 } | 1781 } |
| 1773 | 1782 |
| 1774 return true; | 1783 return true; |
| 1775 } | 1784 } |
| 1776 | 1785 |
| 1777 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, | 1786 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, |
| 1778 const std::string* bundle_transport) { | 1787 const std::string* bundle_transport) { |
| 1779 bool require_rtcp_mux = | 1788 bool require_rtcp_mux = |
| 1780 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1789 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1781 bool create_rtcp_transport_channel = !require_rtcp_mux; | 1790 bool create_rtcp_transport_channel = !require_rtcp_mux; |
| 1791 | |
| 1792 std::string transport_name = | |
| 1793 bundle_transport ? *bundle_transport : content->name; | |
| 1794 | |
| 1795 cricket::TransportChannel* rtp_transport = | |
| 1796 transport_controller_->CreateTransportChannel( | |
| 1797 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 1798 cricket::TransportChannel* rtcp_transport = nullptr; | |
| 1799 if (create_rtcp_transport_channel) { | |
| 1800 rtcp_transport = transport_controller_->CreateTransportChannel( | |
| 1801 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 1802 } | |
| 1803 | |
| 1782 voice_channel_.reset(channel_manager_->CreateVoiceChannel( | 1804 voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
| 1783 media_controller_, transport_controller_.get(), content->name, | 1805 media_controller_, rtp_transport, rtcp_transport, |
| 1806 transport_controller_->signaling_thread(), content->name, | |
| 1784 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), | 1807 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), |
| 1785 audio_options_)); | 1808 audio_options_)); |
| 1786 if (!voice_channel_) { | 1809 if (!voice_channel_) { |
| 1787 return false; | 1810 return false; |
|
pthatcher1
2017/01/13 21:51:07
If the constructor failed, do we have to destroy t
Taylor Brandstetter
2017/01/13 23:46:48
Done in follow up CL.
| |
| 1788 } | 1811 } |
| 1812 | |
| 1813 voice_channel_->SignalDestroyRtcpTransport.connect( | |
| 1814 this, &WebRtcSession::OnDestroyRtcpTransport_n); | |
|
pthatcher1
2017/01/13 21:51:07
This is funky. I think it would be better to pass
Taylor Brandstetter
2017/01/13 23:46:48
I think a signal is the right approach here for mi
| |
| 1789 if (require_rtcp_mux) { | 1815 if (require_rtcp_mux) { |
| 1790 voice_channel_->ActivateRtcpMux(); | 1816 voice_channel_->ActivateRtcpMux(); |
| 1791 } | 1817 } |
| 1792 | 1818 |
| 1793 voice_channel_->SignalDtlsSrtpSetupFailure.connect( | 1819 voice_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1794 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1820 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1795 | 1821 |
| 1796 SignalVoiceChannelCreated(); | 1822 SignalVoiceChannelCreated(); |
| 1797 voice_channel_->SignalSentPacket.connect(this, | 1823 voice_channel_->SignalSentPacket.connect(this, |
| 1798 &WebRtcSession::OnSentPacket_w); | 1824 &WebRtcSession::OnSentPacket_w); |
| 1799 return true; | 1825 return true; |
| 1800 } | 1826 } |
| 1801 | 1827 |
| 1802 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, | 1828 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, |
| 1803 const std::string* bundle_transport) { | 1829 const std::string* bundle_transport) { |
| 1804 bool require_rtcp_mux = | 1830 bool require_rtcp_mux = |
| 1805 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1831 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1806 bool create_rtcp_transport_channel = !require_rtcp_mux; | 1832 bool create_rtcp_transport_channel = !require_rtcp_mux; |
| 1833 | |
| 1834 std::string transport_name = | |
| 1835 bundle_transport ? *bundle_transport : content->name; | |
| 1836 | |
| 1837 cricket::TransportChannel* rtp_transport = | |
| 1838 transport_controller_->CreateTransportChannel( | |
| 1839 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 1840 cricket::TransportChannel* rtcp_transport = nullptr; | |
| 1841 if (create_rtcp_transport_channel) { | |
| 1842 rtcp_transport = transport_controller_->CreateTransportChannel( | |
| 1843 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 1844 } | |
|
pthatcher1
2017/01/13 21:51:07
To make it easier to construct and destroy and pas
Taylor Brandstetter
2017/01/13 23:46:47
This is something that would be handled elegantly
| |
| 1845 | |
| 1807 video_channel_.reset(channel_manager_->CreateVideoChannel( | 1846 video_channel_.reset(channel_manager_->CreateVideoChannel( |
| 1808 media_controller_, transport_controller_.get(), content->name, | 1847 media_controller_, rtp_transport, rtcp_transport, |
| 1848 transport_controller_->signaling_thread(), content->name, | |
| 1809 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), | 1849 bundle_transport, create_rtcp_transport_channel, SrtpRequired(), |
| 1810 video_options_)); | 1850 video_options_)); |
| 1851 | |
| 1811 if (!video_channel_) { | 1852 if (!video_channel_) { |
| 1812 return false; | 1853 return false; |
| 1813 } | 1854 } |
| 1855 | |
| 1856 video_channel_->SignalDestroyRtcpTransport.connect( | |
| 1857 this, &WebRtcSession::OnDestroyRtcpTransport_n); | |
| 1814 if (require_rtcp_mux) { | 1858 if (require_rtcp_mux) { |
| 1815 video_channel_->ActivateRtcpMux(); | 1859 video_channel_->ActivateRtcpMux(); |
| 1816 } | 1860 } |
| 1817 video_channel_->SignalDtlsSrtpSetupFailure.connect( | 1861 video_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1818 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1862 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1819 | 1863 |
| 1820 SignalVideoChannelCreated(); | 1864 SignalVideoChannelCreated(); |
| 1821 video_channel_->SignalSentPacket.connect(this, | 1865 video_channel_->SignalSentPacket.connect(this, |
| 1822 &WebRtcSession::OnSentPacket_w); | 1866 &WebRtcSession::OnSentPacket_w); |
| 1823 return true; | 1867 return true; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1844 } | 1888 } |
| 1845 if (!network_thread_->Invoke<bool>( | 1889 if (!network_thread_->Invoke<bool>( |
| 1846 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, | 1890 RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n, |
| 1847 this, content->name, transport_name))) { | 1891 this, content->name, transport_name))) { |
| 1848 return false; | 1892 return false; |
| 1849 }; | 1893 }; |
| 1850 } else { | 1894 } else { |
| 1851 bool require_rtcp_mux = | 1895 bool require_rtcp_mux = |
| 1852 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; | 1896 rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire; |
| 1853 bool create_rtcp_transport_channel = !sctp && !require_rtcp_mux; | 1897 bool create_rtcp_transport_channel = !sctp && !require_rtcp_mux; |
| 1898 | |
| 1899 std::string transport_name = | |
| 1900 bundle_transport ? *bundle_transport : content->name; | |
| 1901 cricket::TransportChannel* rtp_transport = | |
| 1902 transport_controller_->CreateTransportChannel( | |
| 1903 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 1904 cricket::TransportChannel* rtcp_transport = nullptr; | |
| 1905 if (create_rtcp_transport_channel) { | |
| 1906 rtcp_transport = transport_controller_->CreateTransportChannel( | |
| 1907 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 1908 } | |
| 1909 | |
| 1854 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( | 1910 rtp_data_channel_.reset(channel_manager_->CreateRtpDataChannel( |
| 1855 media_controller_, transport_controller_.get(), content->name, | 1911 media_controller_, rtp_transport, rtcp_transport, |
| 1912 transport_controller_->signaling_thread(), content->name, | |
| 1856 bundle_transport, create_rtcp_transport_channel, SrtpRequired())); | 1913 bundle_transport, create_rtcp_transport_channel, SrtpRequired())); |
| 1914 | |
| 1857 if (!rtp_data_channel_) { | 1915 if (!rtp_data_channel_) { |
| 1858 return false; | 1916 return false; |
| 1859 } | 1917 } |
| 1918 | |
| 1919 rtp_data_channel_->SignalDestroyRtcpTransport.connect( | |
| 1920 this, &WebRtcSession::OnDestroyRtcpTransport_n); | |
| 1921 | |
| 1860 if (require_rtcp_mux) { | 1922 if (require_rtcp_mux) { |
| 1861 rtp_data_channel_->ActivateRtcpMux(); | 1923 rtp_data_channel_->ActivateRtcpMux(); |
| 1862 } | 1924 } |
| 1863 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( | 1925 rtp_data_channel_->SignalDtlsSrtpSetupFailure.connect( |
| 1864 this, &WebRtcSession::OnDtlsSrtpSetupFailure); | 1926 this, &WebRtcSession::OnDtlsSrtpSetupFailure); |
| 1865 rtp_data_channel_->SignalSentPacket.connect(this, | 1927 rtp_data_channel_->SignalSentPacket.connect(this, |
| 1866 &WebRtcSession::OnSentPacket_w); | 1928 &WebRtcSession::OnSentPacket_w); |
| 1867 } | 1929 } |
| 1868 | 1930 |
| 1869 SignalDataChannelCreated(); | 1931 SignalDataChannelCreated(); |
| 1932 | |
| 1870 return true; | 1933 return true; |
| 1871 } | 1934 } |
| 1872 | 1935 |
| 1873 std::unique_ptr<SessionStats> WebRtcSession::GetStats_n( | 1936 std::unique_ptr<SessionStats> WebRtcSession::GetStats_n( |
| 1874 const ChannelNamePairs& channel_name_pairs) { | 1937 const ChannelNamePairs& channel_name_pairs) { |
| 1875 RTC_DCHECK(network_thread()->IsCurrent()); | 1938 RTC_DCHECK(network_thread()->IsCurrent()); |
| 1876 std::unique_ptr<SessionStats> session_stats(new SessionStats()); | 1939 std::unique_ptr<SessionStats> session_stats(new SessionStats()); |
| 1877 for (const auto channel_name_pair : { &channel_name_pairs.voice, | 1940 for (const auto channel_name_pair : { &channel_name_pairs.voice, |
| 1878 &channel_name_pairs.video, | 1941 &channel_name_pairs.video, |
| 1879 &channel_name_pairs.data }) { | 1942 &channel_name_pairs.data }) { |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2311 if (content_name == *sctp_content_name_) { | 2374 if (content_name == *sctp_content_name_) { |
| 2312 return *sctp_transport_name_; | 2375 return *sctp_transport_name_; |
| 2313 } | 2376 } |
| 2314 } | 2377 } |
| 2315 // Return an empty string if failed to retrieve the transport name. | 2378 // Return an empty string if failed to retrieve the transport name. |
| 2316 return ""; | 2379 return ""; |
| 2317 } | 2380 } |
| 2318 return channel->transport_name(); | 2381 return channel->transport_name(); |
| 2319 } | 2382 } |
| 2320 | 2383 |
| 2384 void WebRtcSession::DestroyTransport(const std::string& transport_name, | |
| 2385 int component) { | |
| 2386 network_thread_->Invoke<void>( | |
| 2387 RTC_FROM_HERE, | |
| 2388 rtc::Bind(&cricket::TransportController::DestroyTransportChannel_n, | |
| 2389 transport_controller_.get(), transport_name, component)); | |
|
pthatcher1
2017/01/13 21:51:07
You added code to TransportController to do this t
Taylor Brandstetter
2017/01/13 23:46:48
I think this was an artifact of changing things ba
| |
| 2390 } | |
| 2391 | |
| 2392 void WebRtcSession::OnDestroyRtcpTransport_n( | |
| 2393 const std::string& transport_name) { | |
| 2394 ASSERT(network_thread()->IsCurrent()); | |
| 2395 transport_controller_->DestroyTransportChannel_n( | |
| 2396 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 2397 } | |
| 2398 | |
| 2399 void WebRtcSession::DestroyVideoChannel() { | |
| 2400 SignalVideoChannelDestroyed(); | |
| 2401 RTC_DCHECK(video_channel_->rtp_transport()); | |
| 2402 std::string transport_name; | |
| 2403 transport_name = video_channel_->rtp_transport()->transport_name(); | |
| 2404 bool need_to_delete_rtcp = (video_channel_->rtcp_transport() != nullptr); | |
| 2405 channel_manager_->DestroyVideoChannel(video_channel_.release()); | |
| 2406 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 2407 if (need_to_delete_rtcp) { | |
| 2408 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 2409 } | |
| 2410 } | |
| 2411 | |
| 2412 void WebRtcSession::DestroyVoiceChannel() { | |
| 2413 SignalVoiceChannelDestroyed(); | |
| 2414 RTC_DCHECK(voice_channel_->rtp_transport()); | |
| 2415 std::string transport_name; | |
| 2416 transport_name = voice_channel_->rtp_transport()->transport_name(); | |
| 2417 bool need_to_delete_rtcp = (voice_channel_->rtcp_transport() != nullptr); | |
| 2418 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); | |
| 2419 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 2420 if (need_to_delete_rtcp) { | |
| 2421 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 2422 } | |
| 2423 } | |
| 2424 | |
| 2425 void WebRtcSession::DestroyDataChannel() { | |
| 2426 SignalDataChannelDestroyed(); | |
| 2427 RTC_DCHECK(rtp_data_channel_->rtp_transport()); | |
| 2428 std::string transport_name; | |
| 2429 transport_name = rtp_data_channel_->rtp_transport()->transport_name(); | |
| 2430 bool need_to_delete_rtcp = (rtp_data_channel_->rtcp_transport() != nullptr); | |
| 2431 channel_manager_->DestroyRtpDataChannel(rtp_data_channel_.release()); | |
| 2432 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 2433 if (need_to_delete_rtcp) { | |
| 2434 DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 2435 } | |
|
pthatcher1
2017/01/13 21:51:07
I think most of this goes away if the BaseChannel
| |
| 2436 } | |
| 2321 } // namespace webrtc | 2437 } // namespace webrtc |
| OLD | NEW |