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

Issue 2614263002: Remove BaseChannel's dependency on TransportController. (Closed)

Created:
3 years, 11 months ago by Zhi Huang
Modified:
3 years, 11 months ago
CC:
webrtc-reviews_webrtc.org, the sun, tterriberry_mozilla.com
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Remove BaseChannel's dependency on TransportController. The BaseChannel can set the transport directly without depending on TransportController. When initializing the network of the BaseChannel, the ChannelManager will create TransportChannels with the TransportController. When enabling bundling, WebRtcSession will get or create TransportChannels with the TransportController. When a TransportChannel of the BaseChannel needs to be destroyed, it will fire a signal to notify the WebRtcSession. BUG=none. Review-Url: https://codereview.webrtc.org/2614263002 Cr-Commit-Position: refs/heads/master@{#16043} Committed: https://chromium.googlesource.com/external/webrtc/+/f5b251b816ca9ad7579321a4d94535c623618dbb

Patch Set 1 : Merge. #

Patch Set 2 : Fix the channel_unittests #

Total comments: 15

Patch Set 3 : Fix the tests #

Total comments: 16

Patch Set 4 : cr comments #

Total comments: 16
Unified diffs Side-by-side diffs Delta from patch set Stats (+494 lines, -283 lines) Patch
M webrtc/api/rtcstatscollector_unittest.cc View 6 chunks +24 lines, -20 lines 2 comments Download
M webrtc/api/rtpsenderreceiver_unittest.cc View 1 2 1 chunk +9 lines, -4 lines 0 comments Download
M webrtc/api/statscollector_unittest.cc View 16 chunks +16 lines, -16 lines 0 comments Download
M webrtc/api/webrtcsession.h View 1 2 1 chunk +6 lines, -0 lines 0 comments Download
M webrtc/api/webrtcsession.cc View 1 2 3 9 chunks +136 lines, -20 lines 11 comments Download
M webrtc/api/webrtcsession_unittest.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/p2p/base/faketransportcontroller.h View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M webrtc/p2p/base/transportcontroller.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M webrtc/p2p/base/transportcontroller.cc View 1 2 3 3 chunks +8 lines, -2 lines 0 comments Download
M webrtc/pc/channel.h View 1 2 3 10 chunks +35 lines, -30 lines 1 comment Download
M webrtc/pc/channel.cc View 1 2 3 30 chunks +107 lines, -121 lines 2 comments Download
M webrtc/pc/channel_unittest.cc View 1 2 3 10 chunks +60 lines, -25 lines 0 comments Download
M webrtc/pc/channelmanager.h View 1 2 6 chunks +18 lines, -6 lines 0 comments Download
M webrtc/pc/channelmanager.cc View 1 2 3 6 chunks +42 lines, -25 lines 0 comments Download
M webrtc/pc/channelmanager_unittest.cc View 1 2 2 chunks +24 lines, -12 lines 0 comments Download

Messages

Total messages: 41 (29 generated)
Taylor Brandstetter
Looks good so far. I'm just wondering if we could go a couple steps further, ...
3 years, 11 months ago (2017-01-09 22:50:43 UTC) #12
Zhi Huang
Please take another look. Thanks. https://codereview.webrtc.org/2614263002/diff/40001/webrtc/api/webrtcsession.cc File webrtc/api/webrtcsession.cc (right): https://codereview.webrtc.org/2614263002/diff/40001/webrtc/api/webrtcsession.cc#newcode1681 webrtc/api/webrtcsession.cc:1681: this, &WebRtcSession::OnDestroyTransport); On 2017/01/09 ...
3 years, 11 months ago (2017-01-12 03:47:47 UTC) #20
Taylor Brandstetter
https://codereview.webrtc.org/2614263002/diff/200001/webrtc/api/webrtcsession.cc File webrtc/api/webrtcsession.cc (right): https://codereview.webrtc.org/2614263002/diff/200001/webrtc/api/webrtcsession.cc#newcode2404 webrtc/api/webrtcsession.cc:2404: DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); Do you need to do the "need_to_delete_rtcp" ...
3 years, 11 months ago (2017-01-12 22:39:02 UTC) #21
Zhi Huang
Please take anther look. Thanks. https://codereview.webrtc.org/2614263002/diff/200001/webrtc/api/webrtcsession.cc File webrtc/api/webrtcsession.cc (right): https://codereview.webrtc.org/2614263002/diff/200001/webrtc/api/webrtcsession.cc#newcode2404 webrtc/api/webrtcsession.cc:2404: DestroyTransport(transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP); On 2017/01/12 ...
3 years, 11 months ago (2017-01-13 00:12:47 UTC) #22
Taylor Brandstetter
lgtm. I also modified the CL description a bit. https://codereview.webrtc.org/2614263002/diff/200001/webrtc/pc/channel.cc File webrtc/pc/channel.cc (right): https://codereview.webrtc.org/2614263002/diff/200001/webrtc/pc/channel.cc#newcode170 webrtc/pc/channel.cc:170: ...
3 years, 11 months ago (2017-01-13 01:39:49 UTC) #26
Taylor Brandstetter
One last small thing I noticed https://codereview.webrtc.org/2614263002/diff/220001/webrtc/pc/channel.h File webrtc/pc/channel.h (right): https://codereview.webrtc.org/2614263002/diff/220001/webrtc/pc/channel.h#newcode165 webrtc/pc/channel.h:165: // destroyed. Would ...
3 years, 11 months ago (2017-01-13 01:41:21 UTC) #27
Taylor Brandstetter
I'm going to go ahead and try to land this, since I have a CL ...
3 years, 11 months ago (2017-01-13 03:34:56 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2614263002/220001
3 years, 11 months ago (2017-01-13 03:35:10 UTC) #34
commit-bot: I haz the power
Committed patchset #4 (id:220001) as https://chromium.googlesource.com/external/webrtc/+/f5b251b816ca9ad7579321a4d94535c623618dbb
3 years, 11 months ago (2017-01-13 03:37:54 UTC) #37
Zhi Huang
On 2017/01/13 03:34:56, Taylor Brandstetter wrote: > I'm going to go ahead and try to ...
3 years, 11 months ago (2017-01-13 03:45:06 UTC) #38
pthatcher1
Sorry for being late to the review, but I think we could have made this ...
3 years, 11 months ago (2017-01-13 21:51:07 UTC) #40
Taylor Brandstetter
3 years, 11 months ago (2017-01-13 23:46:48 UTC) #41
Message was sent while issue was closed.
Addressed your concerns in https://codereview.webrtc.org/2637503003

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/api/rtcstatscolle...
File webrtc/api/rtcstatscollector_unittest.cc (right):

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/api/rtcstatscolle...
webrtc/api/rtcstatscollector_unittest.cc:599: test_->worker_thread(),
test_->network_thread(), nullptr,
On 2017/01/13 21:51:07, pthatcher1 wrote:
> I'd prefer we define a signaling thread for all of these rather than making it
> null.  We don't use the signaling thread right now in these tests, but it's
> risky to assume that passing nullptr here is safe, when generally it isn't.   
> Same for all the tests.

Fixed in new CL

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/api/webrtcsession.cc
File webrtc/api/webrtcsession.cc (right):

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/api/webrtcsession...
webrtc/api/webrtcsession.cc:1097: return false;
On 2017/01/13 21:51:07, pthatcher1 wrote:
> If it failed, do you need to destroy the new transports?  

It won't ever fail unless invalid arguments are supplied. I'll change it from a
method that returns false to one that just DCHECKs.

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/api/webrtcsession...
webrtc/api/webrtcsession.cc:1810: return false;
On 2017/01/13 21:51:07, pthatcher1 wrote:
> If the constructor failed, do we have to destroy the transports?

Done in follow up CL.

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/api/webrtcsession...
webrtc/api/webrtcsession.cc:1814: this,
&WebRtcSession::OnDestroyRtcpTransport_n);
On 2017/01/13 21:51:07, pthatcher1 wrote:
> This is funky.  I think it would be better to pass the BaseChannel something
it
> can call rather than have a callback like this.  See my
> RtpTransportPairInterface idea below.

I think a signal is the right approach here for minimizing interdependencies.
But I changed the signal name to "SignalRtcpMuxFullyActive", which makes this
code make more sense.

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/api/webrtcsession...
webrtc/api/webrtcsession.cc:1844: }
On 2017/01/13 21:51:07, pthatcher1 wrote:
> To make it easier to construct and destroy and pass around, would it make
sense
> to do something like this?
> 
> class RtpTransportPairInterface {
>   virtual ~RtpTransportPairInterface();
>   virtual TransportChannel* rtp_transport() = 0;
>   virtual TransportChannel* rtcp_transport() = 0;
>   virtual void DestroyRtcpTransport();
> }
> 
> class WebRtcSession::RtpTransportPair : RtpTransportPairInterface {
>   RtpTransportPair(TransportController* troller, const std::string&
> transport_name, create_rtcp) : transport_controller_(troller),
> transport_name_(transport_name) {
>     rtp_transport_ =
> transport_controller_->CreateTransportChannel(transport_name_,
> cricket::ICE_CANDIDATE_COMPONENT_RTP);
>     if(create_rtcp) {
>       rtcp_transport_ =
> transport_controller_->CreateTransportChannel(transport_name_,
> cricket::ICE_CANDIDATE_COMPONENT_RTCP);
>     }    
>   }
> 
>   ~RtpTransportPair() { 
>     transport_controller_->DestroyTransportChannel(transport_name_,
> cricket::ICE_CANDIDATE_COMPONENT_RTP);
>     if(rtcp_transport_) {
>       transport_controller_->DestroyTransportChannel(transport_name_,
> cricket::ICE_CANDIDATE_COMPONENT_RTCP);
>     }
>   }
> 
>   TransportChannel* rtp_transport() override {
>     return rtp_transport_;
>   }
>   TransportChannel* rtcp_transport() override {
>     return rtcp_transport_;
>   }
> 
>   void DestroyRtcpTransport() override {
>   }
> 
>   TransportController* transport_controller_ = nullptr;
>   std::string transport_name_;
>   TransportChannel* rtp_transport_ = nullptr;
>   TransportChannel* rtcp_transport_ = nullptr;
> }
> 
> std::unique_ptr<RtpTransportPairInterface> transports(new
> WebRtcSession::RtpTransportPair(transport_controller_, transport_name));
> video_channel_.reset(channel_manager->CreateVideoChannel(media_controller_,
> std::move(transport)));
> 
> 
> Now:
> 1.  You only have to pass in one thing, not two.
> 2.  That thing is clearly owned by BaseChannel, and once deleted cleans up the
> transports.
> 3.  If video_channel_ fails to be created, the transports are automatically
> deleted.
> 4.  There's no code duplication.
> 5.  You don't have this weird "SignalDestroyRtcpTransport".  The BaseChannel
can
> just call that on the RtpTransportPairInterface that it owns.

This is something that would be handled elegantly when BaseChannel is refactored
into RtpTransceiver/RtpTransport, but for now I thought we just wanted to do the
minimum changes that will let us implement the shim objects.

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/api/webrtcsession...
webrtc/api/webrtcsession.cc:2389: transport_controller_.get(), transport_name,
component));
On 2017/01/13 21:51:07, pthatcher1 wrote:
> You added code to TransportController to do this thread hop.  You might as
well
> add DestroyTransportChannel as well.  Then they are both in the same place. 
Or
> remove both and pass the network_thread_ into the RtpTransportPair and let it
do
> the thread hop. 

I think this was an artifact of changing things back and forth, I'll make it
consistent with CreateTransportChannel.

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/pc/channel.cc
File webrtc/pc/channel.cc (right):

https://codereview.webrtc.org/2614263002/diff/220001/webrtc/pc/channel.cc#new...
webrtc/pc/channel.cc:257: TransportChannel* rtcp_transport) {
On 2017/01/13 21:51:07, pthatcher1 wrote:
> Shouldn't this be called SetTransports?

Sure, done in follow-up CL.

Powered by Google App Engine
This is Rietveld 408576698