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

Let createOffer and createAnswer resolve with RTCSessionDescription instead of RTCSessionDescriptionInit #922

Closed
foolip opened this issue Nov 8, 2016 · 10 comments

Comments

@foolip
Copy link
Member

foolip commented Nov 8, 2016

@fippo
Copy link
Contributor

fippo commented Nov 8, 2016

Wouldn't this imply that .type is readonly which would disallow changing the type of answer to pranswer?
See createAnswer, in particular
An answer can be marked as provisional, as described in [JSEP] (section 4.1.7.1.), by setting the type to pranswer.

@jan-ivar
Copy link
Member

jan-ivar commented Nov 8, 2016

@foolip This would appear to make the problem you mention in #573 (comment) more common.

@foolip
Copy link
Member Author

foolip commented Nov 8, 2016

OK, so there's a use case for modifying the return value. (I know little about the semantics and am just noticing differences between spec and implementations, so pardon if this was obvious.)

The way it's implemented in Blink is to create a new RTCSessionDescription instance, and because its attributes are mutable it would work. But to change RTCSessionDescription to be immutable without without also changing RTCSessionDescription to RTCSessionDescriptionInit in these contexts would be risky.

So, I conclude that if the RTCSessionDescription changes turn out not be web compatible and need to be reverted, then that would be the time to change this as well. Does that sound about right? If so, this can be closed for now, and be revisited if #573 doesn't work out.

@alvestrand
Copy link
Contributor

PR-Answer is being discussed in RTCWEB. That discussion may converge in Korea.

@alvestrand
Copy link
Contributor

Is this solved by #949?

@jan-ivar
Copy link
Member

jan-ivar commented Dec 9, 2016

This issue basically observes that implementations are behind the spec, which I'm about to fix.

@foolip said this could be closed, and I agree. #949 was about the legacy callbacks.

@alvestrand
Copy link
Contributor

OK, closing.

pull bot pushed a commit to FreddyZeng/chromium that referenced this issue Mar 17, 2021
…criptionInit

see
  https://w3c.github.io/webrtc-pc/#interface-definition
and related discussion in
  w3c/webrtc-pc#922

BUG=chromium:662898

Change-Id: Ife82799e468db582cf28273a9293ddd6c70fbb6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2747379
Reviewed-by: Henrik Boström <hbos@chromium.org>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#863460}
@fippo
Copy link
Contributor

fippo commented May 2, 2024

I have a question related to this which was introduced in #574 after Chrome was just updated to "follow the spec" which broke because toJSON can no longer be called.

I'll note that returning RTCSessionDescription has not been a problem for anyone for the last eight years despite Firefox and Safari not doing so. Most web developers who have been around for a while stopped trusting toJSON after this issue

@jan-ivar
Copy link
Member

jan-ivar commented May 2, 2024

  • How is toJSON supposed to be used now?

No need. It was a workaround. You now have the object toJSON() would have returned #2969.

toJSON is a detail function in service of JSON.stringify(), not normally meant to be called directly.

It is consistent with apps' desire to mutate the offer or answer returned while pc.localDescription.sdp and sender.transport.iceTransport.getSelectedCandidatePair().remote.candidate remain immutable. #573

I'll note that returning RTCSessionDescription has not been a problem for anyone for the last eight years despite Firefox and Safari not doing so. Most web developers who have been around for a while stopped trusting toJSON after this issue

What are they doing then?

@fippo
Copy link
Contributor

fippo commented May 2, 2024

Thank you, this is starting to make sense!
I assume the wrong notion of "toJSON is something developers should call" comes from this MDN article which also does 😡 callback APIs

We still should have better tests than "createAnswer works", i'll take that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants