-
Notifications
You must be signed in to change notification settings - Fork 115
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
PC.local_description and friends - snapshot views or dynamic views? #2977
Comments
It seems worth writing some tests and checking results for all browsers. I think the spec mentions when new objects should be created and when the objects should be updated. |
A quick test https://jsfiddle.net/jib1/gawh7eno/20/ shows the following in all browsers:
This seems reasonable to me. In contrast the spec says: "add candidate to connection.[[PendingLocalDescription]].sdp." I vote we change the spec to match implementations. |
So this would replace all the places with "add candidate to connection.[[PendingLocalDescription]].sdp" and similar with This works for me; x = pc.localDescription; x === pc.localDescription; await addCandidate(); x !== pc.LocalDescription |
This issue had an associated resolution in WebRTC June 18 2024 meeting – 18 June 2024 (WebRTC: PC.local_description and friends - snapshot views or dynamic views?):
|
In the current specification, current_local_description is described as an attribute that returns the content of the [[CurrentLocalDescription]] slot.
Returning an object in Javascript is basically passing a reference, not cloning the value.
So - in the current model, if we have:
x = pc.current_local_description
... time passes
a new candidate is added
... time passes
what is the value of x.sdp? does it include the new candidate or not?
This came up while hunting for a thread access issue inside WebRTC; it made it clear to me that life would be much simpler if those accessors returned a copy of the current state of [[LocalDescription]], and did not change after returning. But that is not the way attributes usually work.
What should we intend here?
(all the attributes of an RTCSessionDescription are readonly, so the Javascript side can't change it. The question is whether the platform can change it.)
The text was updated successfully, but these errors were encountered: