-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix missing RTX codec when using SetCodecPreferences #3051
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3051 +/- ##
==========================================
+ Coverage 78.38% 78.60% +0.22%
==========================================
Files 91 91
Lines 11300 11313 +13
==========================================
+ Hits 8857 8893 +36
+ Misses 1950 1932 -18
+ Partials 493 488 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b13aa2e
to
8233d7e
Compare
broken test cases.... I am looking into that |
5768cbd
to
f7cc6af
Compare
b4dfd98
to
9322dc1
Compare
rtpcodec.go
Outdated
// Given a RTPCodecParameters check if it exists in a list of other RTPCodecParameters. | ||
func doesCodecExistInList(codec RTPCodecParameters, codecList []RTPCodecParameters) bool { | ||
for _, c := range codecList { | ||
if codec.SDPFmtpLine == c.SDPFmtpLine && codec.MimeType == c.MimeType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We match codecs with different rate or channels now, I know RTX is never used for audio, but can we use the fmtp helpers that Alessandro's made in his PR instead, for the sake of behavioral consistency (Like we use strings.EqualFold there to match the MimeType), so one behavior and less code to test?
Line 169 in e4ff415
func (g *genericFMTP) Match(b FMTP) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, let me see what I can do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that I reviewed the code, I wonder if I should just use codecParametersFuzzySearch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah if you can use codecParametersFuzzySearch
that would be better!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
f269ded
to
1385481
Compare
1385481
to
2d892b5
Compare
Hi, Please correct me if my understanding of the issue is wrong. This PR fixes the scenario where someone sets CodecPreferences with one codec, and it disables the RTX for that codec. Right? According to MDN, the parameter for |
@itzmanish that is a great question and I thought about that as well while making this PR If we want the RTX codec when using
I guess you could say this is a pion specific feature, that will handle this for you..... Maybe I should ask the author of the issue why they cannot just pass in the RTX codec 🤔 |
@jech what is your thoughts on @itzmanish comment? |
Sure, no problem. However, since that would be a divergence from the JavaScript API, it would need to be clearly documented. If you choose to do that, please add a test to make sure that a codec with an associated RTX track can be specified, since I'm afraid that's code that might rot and since things will still sort of work if the RTX track is incorrect, we might not notice that it's broken. |
What do you think? Should we stay aligned with the javascript api or do our own thing?? I am thinking we stay aligned |
The JavaScript API is fairly high level. Pion is useful for low-level software, such as SFUs, so it might make sense to give more control to the programmer. But perhaps it's not worth the extra complexity in this particular case. In other words, I have no clue. |
This ^ In my view, the reward for introducing extra complexity and logic is unfulfilling. The more pion/webrtc operates behind the scene logic, the more unpredictable the API will be, and it will be more challenging for users using the library. |
I too think we should stay aligned! |
It's a little bit more complicated than that. When using SetCodecPreferences in Pion, we set the ptype, and in particular we can set a ptype that is not defined in the mediaengine. If we do that, there is no way for Pion to choose the right ptype for the RTX track. This is not the case in the JavaScript case, where we do not set the ptype. See here: https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver/setCodecPreferences So the API is already not aligned with the JavaScript case, and not being explicit will cause the API to fail for mysterious reasons. |
@Sean-Der Do you have any suggestions? |
Description
When you specify the codecs that you want to use, we need to add the RTX codec related to the specified codecs
Reference issue
Fixes #2996