-
Notifications
You must be signed in to change notification settings - Fork 115
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
setCodecPreferences, sendonly codecs and dummy codecs #2937
Comments
Still looking for a sendonly codec example. Note that H264 is typically covered by level-asymetry-allowed
This would reject in step 8 of https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-setcodecpreferences ? |
Oh but then we've unshipped default preferences for a sender. What, if any, are the benefits of this? |
Example WPT that needs to change: https://chromium-review.googlesource.com/c/chromium/src/+/5287360 |
We haven't unshipped default . The answerer will try to match the order unless it uses sCP to override it |
I am on Windows so the send codecs are as follows (14), with clockRate removed for brevity:
while receive codecs are as follows (21):
Prior to making sCP only look at recv codecs we would not have been able to set a few of those codecs (e.g. VP9 profile 1) using sCP. Nobody tried either ;-) I am still looking for a sendonly codec (and thought I had one but ... nope). But if you look at the differences you'll notice that so far we are just extending profiles (in their different spellings) of already supported codec families, some of which define rules for dealing with this kind of stuff. |
I mean we only support "offer send codecs" if the send codecs are sendrecv codeces, we're making this not work for the sendonly codec use case.
We might want to be future proof. Besides, custom codecs might become a thing? Should they have to be sendrecv?
So we're only changing things for certain profiles. I'm having trouble understanding what this means in practice? |
We finally found a sendonly codec (or is that only called |
Imagine a server supports decoding 5.2. What's the harm with allowing a sendonly transceiver to offer 5.2? It's very unintuitive to me that we say that the sendonly transceiver must offer something it knows how to decode to avoid empty offer and then signal, outside the SDP, to "please ask me to send 5.2", and then that the server does |
from some discussion in other places: And you are arguing that it should be ok if we pass a codec in send codecs to sCP, so the new condition would be that |
I think a codec being required to be sendrecv was wrong, so I definitely like the direction of being able to set recvonly codecs in SCP! But I think it makes sense to also allow sendonly codecs for the sendonly use case, considering what you offer are the default preferences used unless the receiver has their own preferences. So I'm not trying to revert the progress, I'm trying to go one step further.
Correct. A codec is "send OR recv", not "send AND recv".
Or rather the SCP codec filtered by the transceiver direction must not be empty. Either that or saying "any codec is fine, but at least one of them has to be sendrecv" as means to avoid |
I don't expect everyone to follow along with my ramblings, so I turned this last comment into a concrete proposal: #2939. |
to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592
to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592
to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592
to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592
to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5293562 Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/main@{#1262367}
to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5293562 Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/main@{#1262367}
to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5293562 Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/main@{#1262367}
This issue was mentioned in WEBRTCWG-2024-02-20 (Page 18) |
to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5293562 Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/main@{#1262367}
… filtering of codecs, a=testonly Automatic update from web-platform-tests webrtc wpt: add test for direction-based filtering of codecs to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5293562 Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/main@{#1262367} -- wpt-commits: 8d72cdeb97859e01b8bdad99a7b627c13455ac72 wpt-pr: 44604
… filtering of codecs, a=testonly Automatic update from web-platform-tests webrtc wpt: add test for direction-based filtering of codecs to supplement the discussion in w3c/webrtc-pc#2937 BUG=324930413 Change-Id: Iebf02aade64030e11590af211fa7bc90f976c592 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5293562 Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/main@{#1262367} -- wpt-commits: 8d72cdeb97859e01b8bdad99a7b627c13455ac72 wpt-pr: 44604
Looking at receive codecs for sendrecv or recvonly m-lines makes some sense, even though it violates a SHOULD in RFC 3264 Section 5.1:
It's ok because including a codec in an Offer on a In an Offer on a |
Including a receive-only codec in the sendrecv line is not ok. You need to, somehow, tell the answerer that the receive-only codec should not be removed from the answer and that another codec should present with a higher preference. If the answerer includes only this codec in the answer, that will force the offerer to send it, which it cannot do. If the answerer does not include the receive-only codec in the answer, then this codec cannot be used in the session since, according to RFC 3264, it should be released by the offerer. So, this is not a negotiation. It is going through signaling motions that only work if we already know the remote capabilities. |
@rshpount As we've discussed on the RTCWEB mailing list, JSEPbis (now RFC 9429) Section 4.2.6 says: "Note that 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, via the offer or answer." This is being interpreted to imply that on recvonly and sendrecv m-lines, sCP should only require support for receiving but not sending codecs. That is what allows a receive-only codec to be provided in an Offer on a sendrecv m-line. As you point out, that is not consistent with the SHOULDs in RFC 3264 Section 5.1. So the question is:
|
@aboba RFC 9429 is not an error. An additional context might help, but it would not be normative. RFC 3264 will still be a normative document that controls how the offer/answer works. RFC 9429 Section 4.2.6 is being misinterpreted since it is considered independent from RFC 3264. All it says is that setCodecPreferences will control the order of codecs for the m= line associated with the transceiver for the next offer or answer. It will specify in which order the codecs will be offered and in which order they will be considered when generating the answer (overwriting the offer). It does not define how certain things are implemented, such as how to return two codecs in the answer, which would be required for asymmetric codecs used for a sendrecv line. It does not control which codecs are actually used; it just adjusts the preferences for the negotiation. We might add context to this section, but I don't know if errata is the proper process. It might be enough to fix the webrtc-pc document. |
@rshpount what you are basically saying IIUC is that between RFC 3264 and RFC 9429 it is not possible to have asymmetric codecs for sendrecv m-lines. In other words, to have different codecs for send and receive you would have to resort to using two transceivers, one for sending and one for receiving. This does not seem ideal to me. |
@stefhak I am saying that the procedure for asymmetric codecs in sendrecv line is not defined in RFC 9429. Implementing asymmetric codecs on a sendrecv line using RFC 3264 is possible. To do this, the offerer will send codecs "A B" in the offer, and the answerer will send codecs "B A" in the answer. This will imply that the offerer prefers to receive A, but B is also supported, and that the answerer prefers to receive B, but A is also supported. This might need an additional nudge outside of the offer/answer to force using different codecs in both directions and to signal that the offerer cannot receive B or that the answerer cannot receive A. Based on the above, what is missing is an API that specifies that two codecs should be left in the answer. sCP can be used to control their order and signal which codec the answerer prefers to receive, but the mechanism that specifies that the codecs should be present in the answer is missing. Furthermore, per RFC 3264, it is possible to have codecs in the answer, which were not present in the offer. I am not sure of the API to add codecs in the answer which were not present in the offer (apart from SDP manipulation). |
Thanks for elaborating @rshpount. One thing that is not clear to me is: your inputs indicate that the answer should only list one codec usually. I think current implementations have a quite extensive list of codecs both in offer and answer (unless sCP is used to trim), and that this is as it should be. In other words. the O/A exchange establishes a set of codecs (rather than a codec) that (with preference order) might be used for actual media. Is this wrong? |
The best practice is only to include the codecs that will be used. Not including a codec in the answer guarantees both parties that this codec will never be used and allows the associated resources to be freed. For instance, if the offerer allocates hardware resources for a specific video codec, these hardware resources can be freed if the codec is not present in the answer. See RFC 3264 Section 7. |
@rshpount to me it seems better to have several options for the sender - the encoding is more complex, so if one of the codecs that are acceptable for the receiving endpoint is HW accelerated at the sender, it might be better to use that one. The way current implementations seem to behave enables this IIUC. Anyway, we still miss a way for the offerer to indicate (via SDP O/A) codecs it can only send (but not receive). |
At TPAC we decided to avoid footguns and keep things simple (Proposal A), see #3006. Closing this issue |
As of recent changes, we force you to have at least one codec capable of receiving, regardless of direction, or else
setCodecPreferences
throws.But we also allow codecs of any direction to be in the SDP as well as filter what we do end up preferring based on direction.
This means that we still allow the JSEP use case of setting default preferences on the sender side in case the receiver has no preferences on their own, in this case the answer should be the same preference list as was in the offer.
This illustrates controlling sender codec from the offerer assuming answerer justs acks it:
So it works! But it also shows something silly: we had to include
RecvOnlyCodec
in order to offerSendOnlyCodec
. But it's not actually preferred in the SDP, this is just a "dummy codec". So why do we force the app to add it?Dummy codecs might be fine to protect against footguns when the direction changes in the future, but in that case we should still throw since we have no
sendrecv
codec, so if the direction ever changes tosendrecv
then the codec filtering will result in having no codecs in the SDP and the m= section will reject itself. Foot gun!What should we do?
The text was updated successfully, but these errors were encountered: