diff --git a/amendments.json b/amendments.json index 8aa3098a3..72b6fb300 100644 --- a/amendments.json +++ b/amendments.json @@ -1022,19 +1022,19 @@ "id": 40 } ], - "setcodecpreferences-receive": [ + "setcodecpreferences-send-and-receive": [ { - "description": "setCodecPreferences only takes into account receive codecs", - "pr": 2926, - "type": "correction", + "description": "setCodecPreferences supports both send and receive codecs (filtered by direction)", + "pr": 3018, + "type": "addition", "status": "candidate", "tests": [ - "webrtc/RTCRtpTransceiver-setCodecPreferences.html" + "webrtc/protocol/h264-unidirectional-codec-offer.https.html" ], "testUpdates": [ - "web-platform-tests/wpt#44318" + "web-platform-tests/wpt#49421" ], - "id": 42 + "id": 51 } ], "internalslot-jitterbuffertarget": [ diff --git a/base-rec.html b/base-rec.html index 4c06e7f62..39ff43116 100644 --- a/base-rec.html +++ b/base-rec.html @@ -11036,7 +11036,7 @@
setCodecPreferences
The
method overrides the default
codec preferences used by the user agent. When
diff --git a/webrtc.html b/webrtc.html
index bf901ce08..afe7c7ea6 100644
--- a/webrtc.html
+++ b/webrtc.html
@@ -3727,14 +3727,11 @@ setCodecPreferences
- The codec preferences of a [= media - description =]'s [= associated =] transceiver, - transceiver, is said to be the value of - transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}} - with the following filtering applied (or said not - to be set if - transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}} - is empty): + Let filteredCodecs be the result of + applying the following filter on + transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}}. + The filtering MUST NOT change the order of the codec + preferences:
- The filtering MUST NOT change the order of the - codec preferences. + The codec preferences of a [= media + description =]'s [= associated =] transceiver, + transceiver, is said to be the value of + filteredCodecs if non-empty and said to + be unset otherwise.
- The codec preferences of an m= section's - [= associated =] transceiver, - transceiver, is said to be the value of - transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}} - with the following filtering applied (or said not - to be set if - transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}} - is empty): + Let filteredCodecs be the result of + applying the following filter on + transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}}. + The filtering MUST NOT change the order of the + codec preferences:
- The filtering MUST NOT change the order of the - codec preferences. + The codec preferences of a [= media + description =]'s [= associated =] transceiver, + transceiver, is said to be the value of + filteredCodecs if non-empty and said to + be unset otherwise.
If choosableCodecs is an empty list, set choosableCodecs - to transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}}.
+ to transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}} + and exclude any codecs not included in the + [=RTCRtpSender/list of implemented send codecs=].If choosableCodecs is still an empty list, set choosableCodecs @@ -11323,22 +11325,41 @@
The {{setCodecPreferences}} method overrides the default - receive codec preferences used by the user agent. When - generating a session description using either - {{RTCPeerConnection/createOffer}} or - {{RTCPeerConnection/createAnswer}}, the user agent - MUST use the indicated codecs, in the order specified in the - codecs argument, for the media section - corresponding to this {{RTCRtpTransceiver}}. + codec preferences used by the user agent as input to + negotiation. When generating a session description using + either {{RTCPeerConnection/createOffer}} or + {{RTCPeerConnection/createAnswer}}, the user agent MUST + filter the preferred codecs on {{RTCRtpTransceiver/direction}} + and, if this results in a non-empty list, it MUST use the + specified codecs in the order of the codecs + argument, for the media section corresponding to this + {{RTCRtpTransceiver}}.
This method allows applications to disable the negotiation of - specific codecs (including RTX/RED/FEC). It also allows an - application to cause a remote peer to prefer the codec that - appears first in the list for sending. + specific codecs (including RTX/RED/FEC) by listing all codecs + except for the ones to disable. +
++ If the m= section is used for receiving, the order of the + codecs in the SDP (both the offer and the answer) tells the + remote endpoint which codec the local endpoint prefers to + receive. Even if the m= section is not used for receiving, an + answerer that does not have any codec preferences of their own + defaults to using the same order for its SDP answer. +
++ An {{RTCRtpSender}} defaults to sending what the remote + endpoint indicated that it prefers to receive, but the + application can change which codec to send amongst negotiated + {{RTCRtpParameters/codecs}} by calling + {{RTCRtpSender/setParameters}} and specifying which + {{RTCRtpEncodingParameters/codec}} to send. An + {{RTCRtpReceiver}} is prepared to receive any negotiated + codec.
@@ -11346,8 +11367,9 @@
Codecs have their payload types listed under each m= section @@ -11362,8 +11384,11 @@
- {{setCodecPreferences}} will reject attempts to set codecs - [= codec dictionary match | not matching =] codecs found in + {{setCodecPreferences}} will reject attempts to set + codecs [= codec dictionary match | not matching =] + codecs found in either + {{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind) + or {{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind), where kind is the kind of the {{RTCRtpTransceiver}} on which the method is called. @@ -11405,7 +11430,9 @@
- Let codecCapabilities be + Let codecCapabilities be the union of + {{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind).{{RTCRtpParameters/codecs}} + and {{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind).{{RTCRtpParameters/codecs}}.