Bug 177812 - rtc::PacketOptions should have its own IPC encoding/decoding routines
Summary: rtc::PacketOptions should have its own IPC encoding/decoding routines
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-03 06:44 PDT by youenn fablet
Modified: 2017-10-04 20:55 PDT (History)
6 users (show)

See Also:


Attachments
Patch (20.32 KB, patch)
2017-10-03 07:08 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews115 for mac-elcapitan (3.27 MB, application/zip)
2017-10-03 14:26 PDT, Build Bot
no flags Details
Patch (20.26 KB, patch)
2017-10-04 02:37 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2017-10-03 06:44:47 PDT
rtc::PacketOptions should have its own IPC encoding/decoding routines
Comment 1 youenn fablet 2017-10-03 07:08:02 PDT
Created attachment 322515 [details]
Patch
Comment 2 Build Bot 2017-10-03 14:26:23 PDT
Comment on attachment 322515 [details]
Patch

Attachment 322515 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4744831

New failing tests:
workers/wasm-hashset.html
Comment 3 Build Bot 2017-10-03 14:26:25 PDT
Created attachment 322582 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 4 youenn fablet 2017-10-03 15:10:01 PDT
Comment on attachment 322515 [details]
Patch

Error is unrelated
Comment 5 Alex Christensen 2017-10-03 19:57:09 PDT
Comment on attachment 322515 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322515&action=review

> Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.messages.in:26
> +void SendTo(IPC::DataReference data, WebKit::RTCNetwork::SocketAddress address, struct WebKit::RTCPacketOptions options)

keep the indentation.

> Source/WebKit/Shared/RTCPacketOptions.cpp:58
> +    if (!decoder.decodeEnum(dscp))

We should add an enum traits for this somewhere so we don't have to use decodeEnum.

> Source/WebKit/Shared/RTCPacketOptions.cpp:74
> +        if (!decoder.decode(srtpAuthKey))

This looks like it might be wrong.  The encoder encodes a DataReference, and this is decoding a std::optional<DataReference>.  That doesn't match.

> Source/WebKit/Shared/RTCPacketOptions.h:2
> + * Copyright (C) 2016 Apple Inc. All rights reserved.

2017
Comment 6 youenn fablet 2017-10-04 02:18:06 PDT
Thanks for the review.

(In reply to Alex Christensen from comment #5)
> Comment on attachment 322515 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=322515&action=review
> 
> > Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.messages.in:26
> > +void SendTo(IPC::DataReference data, WebKit::RTCNetwork::SocketAddress address, struct WebKit::RTCPacketOptions options)
> 
> keep the indentation.

OK

> > Source/WebKit/Shared/RTCPacketOptions.cpp:58
> > +    if (!decoder.decodeEnum(dscp))
> 
> We should add an enum traits for this somewhere so we don't have to use
> decodeEnum.

I am not sure.
The enumeration is not in WebCore code, it might be easy to miss a change in the enumeration and not update the type trait.
Since it is not an enum class, I am also not sure there is a way to catch this issue through compilation error.

> > Source/WebKit/Shared/RTCPacketOptions.cpp:74
> > +        if (!decoder.decode(srtpAuthKey))
> 
> This looks like it might be wrong.  The encoder encodes a DataReference, and
> this is decoding a std::optional<DataReference>.  That doesn't match.

Ah, right!
Seems like an easy trap when mixing the legacy/new decoders.
Comment 7 youenn fablet 2017-10-04 02:37:30 PDT
Created attachment 322644 [details]
Patch
Comment 8 WebKit Commit Bot 2017-10-04 20:54:42 PDT
Comment on attachment 322644 [details]
Patch

Clearing flags on attachment: 322644

Committed r222894: <http://trac.webkit.org/changeset/222894>
Comment 9 WebKit Commit Bot 2017-10-04 20:54:44 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2017-10-04 20:55:39 PDT
<rdar://problem/34827331>