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

Issue 1844803002: Modify PeerConnection for end-to-end QuicDataChannel usage (Closed)

Created:
4 years, 8 months ago by mikescarlett
Modified:
4 years, 5 months ago
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, qiang.lu, niklas.enbom, yujie_mao (webrtc), peah-webrtc
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Modify PeerConnection for end-to-end QuicDataChannel usage To allow end-to-end QuicDataChannel usage with a PeerConnection, RTCConfiguration has been modified to include a boolean for whether to do QUIC, since negotiation of QUIC is not implemented. If one peer does QUIC, then it will be assumed that the other peer must do QUIC or the connection will fail. PeerConnection has been modified to create data channels of type QuicDataChannel when the peer wants to do QUIC. WebRtcSession has ben modified to use a QuicTransportChannel instead of a DtlsTransportChannelWrapper/DataChannel when QUIC should be used.

Patch Set 1 #

Patch Set 2 : #

Total comments: 160

Patch Set 3 : Apply changes to p2p directory and QuicDataChannel/QuicDataTransport #

Patch Set 4 : Remove transport.h from this CL #

Patch Set 5 : Still in progress but works end to end now #

Patch Set 6 : Created a QuicDataChannel::MessageHelper class and improved end-to-end testing #

Patch Set 7 : Remove webrtcsdp.cc from this CL #

Total comments: 38

Patch Set 8 : Update QuicDataChannel and QuicDataTransport #

Patch Set 9 : Sync with other CLs (will be much smaller once other CLs are landed) #

Patch Set 10 : Sync to upstream after landing QUIC data channel and QUIC transport CLs #

Unified diffs Side-by-side diffs Delta from patch set Stats (+315 lines, -45 lines) Patch
M webrtc/api/peerconnection.h View 1 2 3 4 5 6 7 8 9 3 chunks +10 lines, -0 lines 0 comments Download
M webrtc/api/peerconnection.cc View 1 2 3 4 5 6 7 8 9 7 chunks +43 lines, -6 lines 0 comments Download
M webrtc/api/peerconnection_unittest.cc View 1 2 3 4 5 6 7 8 9 13 chunks +101 lines, -19 lines 0 comments Download
M webrtc/api/peerconnectionendtoend_unittest.cc View 1 2 3 4 5 6 7 8 9 4 chunks +68 lines, -2 lines 0 comments Download
M webrtc/api/peerconnectioninterface.h View 1 2 3 4 5 6 7 8 9 2 chunks +3 lines, -1 line 0 comments Download
M webrtc/api/test/peerconnectiontestwrapper.h View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -1 line 0 comments Download
M webrtc/api/test/peerconnectiontestwrapper.cc View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -6 lines 0 comments Download
M webrtc/api/webrtcsession.h View 1 2 3 4 5 6 7 8 9 3 chunks +12 lines, -0 lines 0 comments Download
M webrtc/api/webrtcsession.cc View 1 2 3 4 5 6 7 8 9 7 chunks +48 lines, -5 lines 0 comments Download
M webrtc/api/webrtcsession_unittest.cc View 1 2 3 4 5 6 7 8 9 3 chunks +24 lines, -0 lines 0 comments Download
M webrtc/media/base/mediaengine.h View 1 2 1 chunk +1 line, -5 lines 0 comments Download

Messages

Total messages: 16 (7 generated)
mikescarlett
I'm mailing this so you can at least see what I've done. It's not ready ...
4 years, 8 months ago (2016-03-30 18:06:26 UTC) #3
pthatcher1
Even though it needs some changes, in general this looks very good. https://codereview.webrtc.org/1844803002/diff/20001/webrtc/api/peerconnection.cc File webrtc/api/peerconnection.cc ...
4 years, 8 months ago (2016-03-30 20:34:50 UTC) #5
pthatcher
https://codereview.webrtc.org/1844803002/diff/20001/webrtc/api/peerconnection.cc File webrtc/api/peerconnection.cc (right): https://codereview.webrtc.org/1844803002/diff/20001/webrtc/api/peerconnection.cc#newcode1052 webrtc/api/peerconnection.cc:1052: } An alternative to the TransportChannel storing a transport ...
4 years, 8 months ago (2016-03-30 22:59:48 UTC) #7
Taylor Brandstetter
https://codereview.webrtc.org/1844803002/diff/20001/webrtc/api/peerconnection.cc File webrtc/api/peerconnection.cc (right): https://codereview.webrtc.org/1844803002/diff/20001/webrtc/api/peerconnection.cc#newcode838 webrtc/api/peerconnection.cc:838: // before QUIC is specified in the session description. ...
4 years, 8 months ago (2016-04-01 23:23:42 UTC) #8
mikescarlett
I split the p2p directory changes into 3 CLs: https://codereview.webrtc.org/1844333006/ https://codereview.webrtc.org/1856513002/ https://codereview.webrtc.org/1856943002/ so please look ...
4 years, 8 months ago (2016-04-05 19:58:53 UTC) #9
mikescarlett
Meant to say that https://codereview.webrtc.org/1844333006/ is the bytebuffer CL and other two CLs are for ...
4 years, 8 months ago (2016-04-05 20:10:40 UTC) #10
Taylor Brandstetter
https://codereview.webrtc.org/1844803002/diff/20001/webrtc/api/quicdatachannel.cc File webrtc/api/quicdatachannel.cc (right): https://codereview.webrtc.org/1844803002/diff/20001/webrtc/api/quicdatachannel.cc#newcode26 webrtc/api/quicdatachannel.cc:26: const DataChannelInit* config) On 2016/04/05 19:58:50, mikescarlett wrote: > ...
4 years, 8 months ago (2016-04-05 22:31:18 UTC) #11
pthatcher1
Working through this again (the parts not covered in the 3 breakout CLs) https://codereview.webrtc.org/1844803002/diff/120001/webrtc/api/peerconnection.cc File ...
4 years, 8 months ago (2016-04-12 00:58:39 UTC) #12
mikescarlett
4 years, 8 months ago (2016-04-13 16:53:38 UTC) #15
I split the QuicDataChannel and QuicDataTransport to a new CL:
https://codereview.chromium.org/1886623002/

so that we can use this CL for discussing the PeerConnection and WebRtcSession
changes.

https://codereview.chromium.org/1844803002/diff/20001/webrtc/api/quicdatachan...
File webrtc/api/quicdatachannel.h (right):

https://codereview.chromium.org/1844803002/diff/20001/webrtc/api/quicdatachan...
webrtc/api/quicdatachannel.h:90: rtc::ByteBuffer* remaining_bytes);
On 2016/04/05 22:31:17, Taylor Brandstetter wrote:
> On 2016/04/05 19:58:50, mikescarlett wrote:
> > On 2016/04/01 23:23:41, Taylor Brandstetter wrote:
> > > Maybe make this private and declare "friend QuicTransport"
> (QuicDataTransport
> > if
> > > it gets renamed). Also in the comment above the class, explain the
> interaction
> > > between QuicDataChannel and QuicTransport/QuicDataTransport
> > 
> > Is this to prevent the method from being exposed directly to PeerConnection?
> > What if I use Peter's suggestion of having QuicDataTransport create/destroy
> > channels, then have QuicDataTransport return channels of type
> > DataChannelInterface?
> > 
> > I also changed the method signature to not used ByteBuffer if that was a
> > concern.
> 
> Peter's suggestion sounds good. But even then, making this method private
makes
> it clear that the method is an implementation detail, in case anything besides
> PeerConnection tries to use it at some point.

I made this method private. For testing I have a fake QuicDataTransport that
writes/reads everything as a string, so instead of making QuicDataTransport be a
friend directly, I thought there should be a QuicMEssageDispatcher base class
that handles both message encoding and decoding/dispatching, so that
QuicDataTransport and the testing class can subclass it.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/peerconnect...
File webrtc/api/peerconnection.cc (right):

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/peerconnect...
webrtc/api/peerconnection.cc:1529: session_options->data_channel_type =
cricket::DCT_QUIC;
On 2016/04/12 00:58:38, pthatcher1 wrote:
> Why not just do session_options->data_channel_type  =
> session_->data_channel_type()?

Sure I'll do that. I didn't know if RTP data channels were intentionally being
excluded.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/peerconnect...
webrtc/api/peerconnection.cc:1561: }
On 2016/04/12 00:58:38, pthatcher1 wrote:
> Same here.

Done.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
File webrtc/api/quicdatachannel.cc (right):

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:57: if (state_ != kOpen) {
On 2016/04/12 00:58:38, pthatcher1 wrote:
> Since state_ is set on the signaling thread, I think we need to check it on
the
> signaling thread, and not on the worker thread (in Send, not Send_w)

Ok done.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:66: }
On 2016/04/12 00:58:38, pthatcher1 wrote:
> Why?  If we prepend the message with the data channel ID and message ID, won't
> that still create a non-empty message?

I wanted to be consistent with the SCTP data channel behavior. I don't think the
data channel API specifies what should happen in that case, but there's nothing
preventing the message from being sent.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:69: message_helper_.Encode(buffer, id_,
++num_sent_messages_, &payload);
On 2016/04/12 00:58:38, pthatcher1 wrote:
> Instead of copying the whole message (which may be large), can we instead call
> stream->Write twice, once for the header and once for the payload?

Yes that's fine.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:70: return WriteData_w(payload.data<char>(),
payload.size());
On 2016/04/12 00:58:39, pthatcher1 wrote:
> Rather than having WriteData_w be a separate method, can you just combine the
> two methods?

I'll combine them.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:76: // block bytes exceeding this limit.
On 2016/04/12 00:58:38, pthatcher1 wrote:
> So we can't send data messages larger than 16KB?  That's going to be a
problem.
> 
> Another option is to buffer in this layer of the code and then send out more
as
> SignalQueuedBytesWritten goes down to a low number (perhaps not wait until 0).

> Can you put a TODO to support higher than 16KB by buffering here if we can't
> change the QUIC maximum size message?
> 

I meant to say that the session buffers messages larger than 16KB, not that they
get blocked totally. But now I'm observing that increasing the limit is not
required to send large messages because every time the 16KB limit is reached,
the remote peer automatically sends "window update frame" packets that tell the
QUIC stream to send the next 16KB.

QUIC allows adjusting the QUIC flow control window size, but 16KB is the default
for streams and sessions.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:110: return false;
On 2016/04/12 00:58:39, pthatcher1 wrote:
> We should probably log what the result was, since it was unexpected.

Done.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:116:
observer_->OnBufferedAmountChange(buffered_amount_);
On 2016/04/12 00:58:39, pthatcher1 wrote:
> What thread is this called on?  Because I'm pretty sure the observer_ needs to
> be called on the signaling thread, and buffered_amount_ needs to be changed on
> the signaling thread.

OnQueuedBytesWritten is on the worker thread. I fixed it so
OnBufferedAmountChange occurs on the signaling thread.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:123: RTC_DCHECK(channel != nullptr);
On 2016/04/12 00:58:38, pthatcher1 wrote:
> RTC_DCHECK(channel) is sufficient.

Done.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:129: this, &QuicDataChannel::OnConnectionClosed);
On 2016/04/12 00:58:39, pthatcher1 wrote:
> We also need to disconnect from the previous quic_transport_channel_ if it's
not
> null.

This function should only be called once. I added
RTC_DCHECK(!quic_transport_channel_) and updated the comments.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:173: stream->Close();
On 2016/04/12 00:58:39, pthatcher1 wrote:
> I think flipping this around to
> 
> if (stream->fin_received()) {
>    ...
> }
> ...
> 
> Would be slightly nicer, since the fin_received case is shorter.

Done.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.cc:216: SetState(kOpen);
On 2016/04/12 00:58:38, pthatcher1 wrote:
> Actually, you need to check channel->writable().  This event fires every time
it
> changes, and it might change to unwritable.
> 
> However, you *don't* want to go back from the kOpen state once you're there.

Done.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
File webrtc/api/quicdatachannel.h (right):

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.h:30: typedef uint32_t QuicStreamId;
On 2016/04/12 00:58:39, pthatcher1 wrote:
> Put a TODO to make this uint64_t.  The QUIC guys said they'll make it 64-bit.

Done.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.h:72: class MessageHelper {
On 2016/04/12 00:58:39, pthatcher1 wrote:
> Why is this public?

I made it public so that my unit test and QuicDataTransport can subclass it for
calling OnIncomingStream.

Hopefully this class isn't confusing otherwise I'll redo it (and I moved it
outside of QuicDataChannel with a new name to clarify it is a standalone class
that QuicDataChannel depends on), but my intention is to allow this class to be
a friend of QuicDataChannel so that OnIncomingStream can be kept private, and
have subclasses of this external to the QuicDataChannel responsible for
encoding/decoding the message headers.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.h:92: }
On 2016/04/12 00:58:39, pthatcher1 wrote:
> Why is this protected?

I made this protected so that only subclasses can call
QuicDataChannel::OnIncomingStream.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.h:128: void OnMessage_s(const DataBuffer&
received_data);
On 2016/04/12 00:58:39, pthatcher1 wrote:
> Can you provide some comments on these?  Why are the protected instead of
> private?

I added comments. They should be private since QuicDataChannel isn't designed to
be subclassed.

https://codereview.chromium.org/1844803002/diff/120001/webrtc/api/quicdatacha...
webrtc/api/quicdatachannel.h:170: const MessageHelper& message_helper_;
On 2016/04/12 00:58:39, pthatcher1 wrote:
> Hold a const ref???

I didn't see the need for QuicDataChannel to modify MessageHelper, if
QuicDataChannel uses this for encoding the header. It is also a ref because
MessageHelper exists outside this class and is a constructor parameter.

Powered by Google App Engine
This is Rietveld 408576698