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

Calling SRD twice isn't web compatible #2512

Closed
jan-ivar opened this issue Apr 14, 2020 · 6 comments · Fixed by #2514
Closed

Calling SRD twice isn't web compatible #2512

jan-ivar opened this issue Apr 14, 2020 · 6 comments · Fixed by #2514
Assignees

Comments

@jan-ivar
Copy link
Member

Calling SRD twice (ditto SLD) may be well-defined in webrtc-pc, but it's not in JSEP.

state diagram

Firefox does something akin to a silent mini-rollback in-between, whereas Chrome does not, instead failing all offers different¹ from the first:

InvalidAccessError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection':
Failed to set remote offer sdp: The order of m-lines in subsequent offer doesn't match
order from previous offer/answer.

In Firefox these succeed² instead. But its aggressive mini-rollbacks produce different transceiver objects even with identical offers, which doesn't seem great either.

Who's right? Who won? You decide!

1) Turns out Chrome allows m-lines to grow, but not shrink. Also media kinds cannot change.
2) We're fixing some disappearing transceivers in Firefox atm, but that shouldn't distract from the different interpretations.

@jan-ivar
Copy link
Member Author

Last I heard of a real-world use case for offer trumping was the "pushy SFU" use case.

@jan-ivar
Copy link
Member Author

It was mentioned to me that a simple workaround for the pushy SFU case is as described in that slide: queue requests, basically visit "stable" in-between. So failure here may not matter much. OTOH it might inform how it should work.

@fippo
Copy link
Contributor

fippo commented Apr 15, 2020

yeah, i've typically done a "if there is a cycle pending, put the operation into a queue, take stuff from the queue on next signalingstatechange to stable".
What this avoids is the following flow:

  • SRD (1)
  • SRD (2)
  • createAnswer (1)
  • createAnswer (2)
  • SLD (1)
  • SLD (2, 💥 can't call SLD twice)

@jan-ivar
Copy link
Member Author

Good point that SLD will throw InvalidModificationError if called with anything other than [[LastCreatedAnswer]] or [[LastCreatedOffer]]. The diagram is only for InvalidStateError.

I think this suggests Chrome's behavior is sufficient.

@jan-ivar
Copy link
Member Author

jan-ivar commented Apr 15, 2020

I think the remaining question then is whether Chrome's behavior is worth specifying. Or simpler:

  1. undefined behavior
  2. throw InvalidAccessError if SRD called twice
  3. throw InvalidAccessError if called with something not identical to the last description
  4. throw InvalidAccessError if called with fewer m-lines or different kind
  5. throw InvalidAccessError like Chrome does, which may be the same as 4 or not?

@alvestrand
Copy link
Contributor

Chrome's behavior is probably "Run the check for subsequent offers, and if those checks pass, accept it". That might be relatively easy to specify.

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

Successfully merging a pull request may close this issue.

3 participants