-
Notifications
You must be signed in to change notification settings - Fork 114
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
Missing url in RTCIceCandidateInit #2795
Comments
that is intentional? This property should not be constructable from JS. toJSON isn't affected since https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-tojson only selects a subset of the attributes |
It might not be super useful to construct it but why should it not be constructible from JS? |
if an object is constructible at all, it is nice to be able to construct it with a full set of attributes (unless those attributes are emergent properties of the operation of the object). |
Most of the properties are not settable from JS but are parsed from the candidate string. For testing you can still assign a value candidate.url if you want. |
From editors meeting discussion: The question is why we want the URL in the candidate in the first place.
|
No.
Yes. This might leak your location which is undesirable.
You may want to act differently depending on whether you use your own "primary" TURN server or a fallback one (i've just seen such a case again). This may be done either as a result of a getStats call (which already has the URL) or in the selectedcandidatepairchange event. Have you folks looked at https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ which actually displays the url? |
Referring to the (sub) issue that folks are using candidate.toJSON() already and that filtering out the URL would break their expectations - as discussed at today's interim. Can we leverage the semantic difference between JSON.stringify() and toJSON() ? |
OK, I'll bite - what is the semantic difference between JSON.stringify() and toJSON()? |
What's your source for this, and why would this group be larger than folks using JSON.stringify(candidate)? I don't think there's a semantic difference, and if there is one, I wouldn't exploit it. Since Web compat here is that for:
I claim there's no web compat problem here. The only concern might be people expecting relayProtocol and url to start showing up in 2, but nothing in the spec supports such an assumption. |
Agree. Further I am not sure that the assumption that folks actually use toJSON or rely on it in production apps is true.
This is not what the spec says and we seem to lack a test. |
The spec clearly supports this assumption as it states that all attributes are derived from
Maybe we should have introduced a RTCIceLocalCandidate that could be partially exported to a RTCIceCandidateInit, representing a remote candidate. This model seems cleaner to me. The current spec state is not great given the merged PRs have been missing some areas where the spec would need to be updated.
|
You're correct it says "Other than candidate, sdpMid, sdpMLineIndex, and usernameFragment, the remaining attributes are derived from parsing the candidate member in candidateInitDict, if it is well formed.", which #2763 broke. We at minimum need a PR to fix that sentence unless we revert both
What does "safe" mean? What's an example of a web compat pattern that would break?
It might be worth looking at why we have an interface at all:
Number 2 is likely the only reason we didn't deprecate the constructor like we did for RTCSessionDescription in #302, and I don't see how the lack of One benefit of keeping them where they are in the spec would be they'd appear in the result from getLocalCandidates(): const [{relayProtocol, url}] = sender.transport.iceTransport.getLocalCandidates(); They would obviously be |
"web developers" do not seem to care about usernameFragment in toJSON. I have not found a bug complaining about the lack of usernameFragment even and had to file one. If you look at major opensource projects, Jitsi and MediaSoup don't even bother with the concept of using JSON strings for signaling. Janus has a healthy distrust for JSON.stringify (and toJSON) as evidenced here because of past issues. Browser improved? However, as shown by the lack of WPT the lack of trust is very much justified. |
so that only attributes defined in RFC 5245 syntax are described as parsed from the candidate init field. Fixes w3c#2795
reading the minutes and watching the recording... Further note that the url of the server a candidate was gathered from is not relevant to the other side (i.e. addIceCandidate). If it was, it would be transported in the candidate string or mentioned in RFC 5245 or its successor. |
Thanks for this discovery (it revealed another bug in firefox in this area as well). I think we should fix the sentence in #2795 (comment), maybe add a note about IOW Libraries that wish to shim can do so using Object.defineProperty. Ready for PR? |
A shim cannot modify the internal slot. IIRC, the following points have been expressed during the call:
|
Shimming could work for the use case of testing Javascript code without having to involve WebRTC, which was the use case I was thinking of when wanting to be able to construct candidates with URL. |
and in WPT we lack the infrastructure to test STUN/TURN which is why several stats are marked as "not testable" already |
relayProtocol calls out that these are "only present for local relay candidates". Ditto url. I don't see any specs referencing these internal slots. Is any spec planning to? |
I might be mistaken here, but isn't the the sole purpose of the RTCICeCandidate constructor to create a candidate that will then be fed to RTCPeerConnectionIceEvent?
It is not specs. It is JS that can retrieve the value in different ways and the values will defer when shiming is used. |
Exposing the constructor in JS is, like RTCSessionDescription an artifact from the time when you had to write code like this:
From this commit I'd say this was before 2016. |
Attributes do not like dictionaries. |
This issue had an associated resolution in WebRTC January 2023 meeting – 17 January 2023 (Issue #2795 Missing URL in RTCIceCandidateInit 🎞︎):
|
#2773 did not specify an URL parameter to RTCIceCandidateInit, which makes a difficulty for creating RTCIceCandidates from scratch (such as when doing emulations).
This will also affect the ToJson algorithm.
The text was updated successfully, but these errors were encountered: