Re: [webrtc-pc] setCodecPreferences vs unidirectional codecs (#2888)

Dumping what I originally had in the slides which are now a bit more condensed:
* We (apart from Harald) did not read [JSEP](https://www.rfc-editor.org/rfc/rfc8829.html#name-setcodecpreferences) carefully enough
  * “setCodecPreferences does not directly affect which codec the implementation decides to send. It only affects which codecs the implementation indicates that it prefers to receive”
  * sCP is not something you use to pick the send codec.
  * This works just because send codec is dictated by receive preference in SDP semantics
  * sCP should not take send codecs into account which webrtc-pc does
* Answer may include codecs not offered
  * no browsers do that, but [behave as intended](https://jsfiddle.net/fippo/gqasr6d1/1/) (or can be tricked?)
* Typically done in ontrack, see updated [samples PR](https://github.com/webrtc/samples/pull/1640)
  * e.transceiver.setCodecPreferences instead of addTransceiver+setCodecPreferences
* Somewhat web-compatible change
  * Woes with unidirectional codecs were not discovered for years
  * It will still be surprising for developers
* Fix webrtc-pc by removing mentions of send codecs in setCodecPreferences
  * [preview](https://github.com/w3c/webrtc-pc/compare/main...fippo:webrtc-pc:setcodecpreferences-recvonly?expand=1)
* Clarify “[codecs match](https://w3c.github.io/webrtc-pc/#dfn-codec-match)” algorithm
  * “If either (but not both) of first.sdpFmtpLine and second.sdpFmtpLine are missing, or if they both exist and first.sdpFmtpLine is different from second.sdpFmtpLine, return false.”
  * H264 [profile level-asymmetry-allowed](https://www.rfc-editor.org/rfc/rfc6184#section-8.1) needs to be taken into account
  * Inference of default values might need to be handled as well
* Drive-by: fix missing consideration for Comfort Noise
  * Oddball, not a media codec, not a resiliency mechanism
* Open question: what does setCodecPreferences do for a sendonly m-line?
  * Current behavior: only negotiate receive codecs for symmetry. Ok?

@stefhak you may find the samples PR useful. It seemed awkward at first but is actually easier to work with since you have one ontrack handler but many ways to add a transceiver

-- 
GitHub Notification of comment by fippo
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2888#issuecomment-1884362725 using your GitHub account


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

Received on Wednesday, 10 January 2024 08:05:11 UTC