[webrtc-pc] Implementations only update getParameters().codecs when negotiation has finished (#2967)

jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc:

== Implementations only update getParameters().codecs when negotiation has finished ==
(I'll refer to the https://www.w3.org/TR/webrtc version of the spec here to avoid the #2956 regression of github tip.)

When I test Chrome, Edge, and Safari with https://jsfiddle.net/jib1/9kz2bf85/ by selecting "VP9" and clicking `Negotiate`, I see
(because it uses setCodecPreferences with a truncated array for brevity): 
```js
Switching codec to video/VP9
In "have-local-offer", tc1.sender.getParameters().codecs = []
In "have-local-offer", tc1.receiver.getParameters().codecs = []
In "have-remote-offer", tc2.sender.getParameters().codecs = []
In "have-remote-offer", tc2.receiver.getParameters().codecs = []
In "stable", tc1.sender.getParameters().codecs = [
  {
    "clockRate": 90000,
    "mimeType": "video/VP9",
    "sdpFmtpLine": "profile-id=0",
    "payloadType": 98
  }
]
In "stable", tc1.receiver.getParameters().codecs = [
  {
    "clockRate": 90000,
    "mimeType": "video/VP9",
    "sdpFmtpLine": "profile-id=0",
    "payloadType": 98
  }
]
pc1 is sending video/VP9
pc2 is sending video/VP9
```
All browsers return an empty codec array until initial negotiation has finished (`"stable"`).

If I now select "H264" and hit `Negotiate` again, instead of empty codecs, I see "VP9" until renegotiation has finished and it's replaced with "H264".

This seems nice and simple: sender/receiver.getParameters().codecs reflects what's been (fully) negotiated.

We should probably align the spec to say this.

Fixing the spec means:
1. Stop updating [[ReceiveCodecs]] in [sLD](https://www.w3.org/TR/webrtc/#set-local-description).
2. Only update [[ReceiveCodecs]] in the answer (where [[SendCodecs]] is already updated).


Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2967 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 24 April 2024 20:15:30 UTC