Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtcicecandidate: add relayProtocol #2763

Merged
merged 4 commits into from Sep 22, 2022
Merged

rtcicecandidate: add relayProtocol #2763

merged 4 commits into from Sep 22, 2022

Conversation

fippo
Copy link
Contributor

@fippo fippo commented Aug 16, 2022

which is already defined in webrtc-stats
https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatestats-relayprotocol
for local candidates


Preview | Diff

@fippo
Copy link
Contributor Author

fippo commented Aug 16, 2022

This is mostly a consistency issue between the candidate object and the candidate stats, see here for details.

I did consider (and actually implemented) .url as well but that is already defined to be part of the icecandidate event.
Also this is polyfillable (at least in some browsers, Firefox still uses the same priority for tcp and tls?)

fippo added a commit to webrtcHacks/adapter that referenced this pull request Aug 16, 2022
based on the hardcoded mapping of local type preference.
Polyfill for
  w3c/webrtc-pc#2763
webrtc.html Outdated Show resolved Hide resolved
@alvestrand
Copy link
Contributor

Editors meeting: Seems uncontroversial.
Might want to call attention to it somehow before merging (posting to ML, or adding to a meeting agenda).

fippo added a commit to fippo/webrtc-stats that referenced this pull request Aug 19, 2022
fippo added a commit to fippo/webrtc-stats that referenced this pull request Aug 19, 2022
webrtc.html Outdated
@@ -5976,6 +5976,7 @@ <h4>
readonly attribute DOMString? relatedAddress;
readonly attribute unsigned short? relatedPort;
readonly attribute DOMString? usernameFragment;
readonly attribute DOMString? relayProtocol;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a readonly attribute with predefined values it should probably be an enum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you define the possible values? https://www.rfc-editor.org/rfc/rfc5928#section-3 is the closest one I could find (Table 1) but that is hardly normative

Copy link
Member

@jan-ivar jan-ivar Sep 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now the PR defines the possible values in prose: "Valid values are "udp", "tcp", or "tls". " which seems equivalent to:

enum RTCIceTransportPolicy {
  "udp",
  "tcp",
  "tls",
};

interface RTCIceCandidate {
  ...
  readonly attribute RTCIceTransportPolicy? relayProtocol;
};

If those are the only valid values then we generally prefer expressing things in WebIDL when possible.

If those are not the only values then we should rephrase.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If those are the only valid values then we generally prefer expressing things in WebIDL when possible.

Or at least that's been my impression. These are only ever used as output, not input so I guess it doesn't matter a whole lot (do we get any free idlharness wpt tests)? I see the stats spec is just using DOMString, and I couldn't find any design principles on this. The WebIDL spec showed no examples of a readonly attribute using enum... YMMV

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but for the other enums we have normative references from which we can draw the values (e.g. https://w3c.github.io/webrtc-pc/#rtciceprotocol-enum but note that while two of the values are the same the semantics is very different)

For stats this is actually a TODO hidden here: https://github.com/w3c/webrtc-stats/blob/main/webrtc-stats.html#L2964

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RTCIceTcpCandidateType is sort of similar here.
Having WebIDL enum is a small UA developer improvement as it can automate some binding generated code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RTCIceServerTransportProtocol won against RTCIceTurnRelayProtocol and variants thereof.

@fippo fippo requested a review from jan-ivar September 20, 2022 15:48
webrtc.html Outdated Show resolved Hide resolved
@aboba
Copy link
Contributor

aboba commented Sep 22, 2022

Reference should be to RFC 8656 Section 3.1 (which also defines DTLS transport); RFC 5766 is obsolete.

webrtc.html Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Test Needs a WPT test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants