Chromium Code Reviews| Index: webrtc/api/webrtcsession.cc |
| diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc |
| index 5d414baac2f89c60df48bfd9d451132eeb7d7b8b..ed408ade88f95d68fb7f1bafe86a49b2811a20e7 100644 |
| --- a/webrtc/api/webrtcsession.cc |
| +++ b/webrtc/api/webrtcsession.cc |
| @@ -1039,7 +1039,6 @@ bool WebRtcSession::EnableBundle(const cricket::ContentGroup& bundle) { |
| return false; |
| } |
| const std::string& transport_name = *first_content_name; |
| - cricket::BaseChannel* first_channel = GetChannel(transport_name); |
| #ifdef HAVE_QUIC |
| if (quic_data_transport_ && |
| @@ -1050,8 +1049,8 @@ bool WebRtcSession::EnableBundle(const cricket::ContentGroup& bundle) { |
| } |
| #endif |
| - auto maybe_set_transport = [this, bundle, transport_name, |
| - first_channel](cricket::BaseChannel* ch) { |
| + auto maybe_set_transport = [this, bundle, |
| + transport_name](cricket::BaseChannel* ch) { |
| if (!ch || !bundle.HasContentName(ch->content_name())) { |
| return true; |
| } |
| @@ -1062,7 +1061,15 @@ bool WebRtcSession::EnableBundle(const cricket::ContentGroup& bundle) { |
| return true; |
| } |
| - if (!ch->SetTransport(transport_name)) { |
| + cricket::TransportChannel* rtp_transport = |
| + transport_controller_->CreateTransportChannel( |
| + transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| + cricket::TransportChannel* rtcp_transport = nullptr; |
| + if (ch->ShouldCreateRtcpTransport()) { |
| + rtcp_transport = transport_controller_->CreateTransportChannel( |
| + transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| + } |
| + if (!ch->SetTransport(rtp_transport, rtcp_transport)) { |
|
Taylor Brandstetter
2017/01/09 22:50:42
I think there's an opportunity here to reduce some
|
| LOG(LS_WARNING) << "Failed to enable BUNDLE for " << ch->content_name(); |
| return false; |
| } |
| @@ -1670,6 +1677,8 @@ bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, |
| SignalVoiceChannelCreated(); |
| voice_channel_->SignalSentPacket.connect(this, |
| &WebRtcSession::OnSentPacket_w); |
| + voice_channel_->SignalDestroyTransport.connect( |
| + this, &WebRtcSession::OnDestroyTransport); |
|
Taylor Brandstetter
2017/01/09 22:50:42
It would be nice if the creation *and* destruction
Zhi Huang
2017/01/12 03:47:46
Done.
|
| return true; |
| } |
| @@ -1694,6 +1703,8 @@ bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, |
| SignalVideoChannelCreated(); |
| video_channel_->SignalSentPacket.connect(this, |
| &WebRtcSession::OnSentPacket_w); |
| + video_channel_->SignalDestroyTransport.connect( |
| + this, &WebRtcSession::OnDestroyTransport); |
| return true; |
| } |
| @@ -1733,6 +1744,8 @@ bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, |
| SignalDataChannelCreated(); |
| data_channel_->SignalSentPacket.connect(this, &WebRtcSession::OnSentPacket_w); |
| + data_channel_->SignalDestroyTransport.connect( |
| + this, &WebRtcSession::OnDestroyTransport); |
| return true; |
| } |
| @@ -2107,4 +2120,9 @@ void WebRtcSession::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { |
| static_cast<int>(rtc::SSLHandshakeError::MAX_VALUE)); |
| } |
| } |
| + |
| +void WebRtcSession::OnDestroyTransport(const std::string& transport_name, |
| + int component) { |
| + transport_controller_->DestroyTransportChannel(transport_name, component); |
| +} |
| } // namespace webrtc |