-
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
Confusion over duplicates in setCodecPreferences? Why allow them? #2955
Comments
I think it is trying to say that duplicates are removed from the end of the list, not the beginning. So removing duplicates from Removing the duplicates seems preferable to throwing. I'd prefer not to link "duplicate" to the codec match algorithm because the match algorithm has issues:
|
Agree we only need to remove "the index of the first occurrence of a codec within the list is the same before and after this step."
Why? Where would duplicates come from? |
If we don't link to it then what does "duplicate" mean (these are dictionaries after all)? We need to fix those issues in the match algorithm then I think (or disallow duplicates). In my mind, the starting point for this API seems to be: const {codecs} = RTCRtpReceiver.getCapabilities("video");
// sort codecs by e.g. mimeTypes like "video/H264", "video/VP9"
videoTransceiver.setCodecPreferences(codecs); And in this model, any duplicate would appear to be a programming error. When would it not be? |
@jan-ivar Does "duplicate" imply a match on codec, level-id/profile and |
In my mind, the following needs to hold regardless of domain details:
videoTransceiver.setCodecPreferences(RTCRtpReceiver.getCapabilities("video"));
audioTransceiver.setCodecPreferences(RTCRtpReceiver.getCapabilities("audio")); Those seem to be the APIs the match algorithm are in service of. A quick dump of getCapabilities() reveal: {
"clockRate": 90000,
"mimeType": "video/H264",
"sdpFmtpLine": "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"
},
{
"clockRate": 90000,
"mimeType": "video/H264",
"sdpFmtpLine": "level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f"
}, This suggests they are distinct codecs to me. Does that match your understanding? |
Oh I see, I appear to have left out another possible input source for setCodecPreferences: transceiver.setCodecPreferences(receiver.getParameters().codecs); Is that right? If so, please see my questions in #2956. |
Since there are multiple input sources then I also see where duplicates may come from, so I concede that point. |
I agree that {
"clockRate": 90000,
"mimeType": "video/H264",
"sdpFmtpLine": "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"
},
{
"clockRate": 90000,
"mimeType": "video/H264",
"sdpFmtpLine": "level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f"
}, Are distinct codecs, because {
"clockRate": 90000,
"mimeType": "video/H264",
"sdpFmtpLine": "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"
},
{
"clockRate": 90000,
"mimeType": "video/H264",
"sdpFmtpLine": "level-asymmetry-allowed=0;packetization-mode=1;profile-level-id=42001f"
}, |
This seems like a naming problem, since algorithms need to be excplicitly invoked and aren't universal. Let's just call it the "codec dictionary match" algorithm for now. The codec dictionary match algorithm was added in #2847 because codecs aren't exposed as platform objects, and thus
The spec says the two dictionaries are distinct codec inputs to I don't read anything in the spec that says the "codec dictionary match" algorithm affects negotiation, as it does not appear to be called from there AFAICT. If there is implicit language somewhere that suggests it, we should identify and clarify it. |
Happy to discuss this at next meeting but since I've conceded that we probably need to tolerate duplicates given the two possible input sources, I'll also try to put up a PR to see if clarify things is all we need. |
I spotted a dubious claim in the setCodecPreferences algorithm:
The claim about indexes remaining the same seems wrong. E.g. with codecs
[A, A₁, B]
removingA₁
results in[A, B]
necessarily altering the index B.*We should also link "duplicate" to the codec match algorithm.
But why allow duplicates in the first place? This seems to only invite trouble.
*) This is implementation language, e.g. c++, operating on infra or WebIDL types, so JS concepts like sparse arrays shouldn't apply.
The text was updated successfully, but these errors were encountered: