Re: [webrtc-pc] Fire events and update state correctly for rollback. (#2298)

```
await pc.setLocalDescription(await pc.createOffer());
...
await pc setRemoteDescription(answer);

// [[CurrentLocalDescription]] has feature set "ABC"
// [[CurrentRemoteDescription]] has feature set "AB", some subset of "ABC".

if (rollbackLocalOffer) {
  await pc.setLocalDescription(await pc.createOffer());
  await pc.set[Local/Remote]Description({type:'rollback'});
  // We've rolled back to an offer.
  // Our starting point is feature set "ABC", though we try to make sure
  // direction is [[CurrentDirection]], i.e. a property of feature set "AB".
} else if (rollbackRemoteOffer) {
  await pc.setRemoteDescription(offer);
  await pc.set[Local/Remote]Description({type:'rollback'});
  // We've rolled back to an answer.
  // Our starting point is feature set "AB".
}
```
Here, "feature set" is a generic term meant to apply to anything that SDP allows. We've addressed the direction problem, but that's just one example of a feature set. Other examples may or may not include (depending on how confused I am):
- Header extensions
- Codecs
- ICE ufrags
- Bundling or not?

In terms of getting the right events to fire, this PR might be correct, but in terms of trying to surface lower layer states to JS, I wonder what happens.

For example, if transports are created in at the "offer" stage, then it might be incorrect to try to roll back to an "offer", but if transports are not created until "answer", then rolling back to an "offer" is a NO-OP in terms of transport states, in which case it is safe. I think.

Instead of "does this fire the right events?" I want to rephrase the problem as "which state are we trying to get to?"

-- 
GitHub Notification of comment by henbos
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/pull/2298#issuecomment-541052301 using your GitHub account

Received on Friday, 11 October 2019 12:53:48 UTC