-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add multi codec negotiation feature #3018
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3018 +/- ##
==========================================
- Coverage 78.71% 78.70% -0.01%
==========================================
Files 91 91
Lines 11347 11361 +14
==========================================
+ Hits 8932 8942 +10
- Misses 1928 1933 +5
+ Partials 487 486 -1
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:
|
717d618
to
fb8ff15
Compare
7c156d2
to
8fcf2a8
Compare
I'm thinking maybe the original continue specifically intended for data sections, making it safe to consider adding this without a flag? not sure, I'll have to check, but thanks again Manish! |
I updated the PR with a bugfix: since the MediaEngine gets copied for every new PeerConnection this new setting needs explicitly been taken care of in the
Even though this PR makes Pion more RFC compliant I would suggest to start with an optional setting, like in this PR. Followed by eventually switching the default of the setting. And hopefully if nobody opens any issues explaining why they depend on the old, non-RFC compliant behavior, we can remove the setting. |
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.
Thanks You guys, would have been cooler if we could add this setting to SettingEngine
instead, but i don't think that there is a clean way to do that :(
@JoeTurki here is an alternative proposal:
What I'm not clear on is if we should do this only if |
The latest commit has my alternative proposal. Let me know which version everyone likes better. |
Thank you so much @nils-ohlmeier this makes so much sense, @itzmanish what do you think? i think we should make the |
What would it break if we turned this on by default? if a remote didn’t actually enable a codec in a media section things wouldn’t work? |
I’m curious what people think is best for users. If it’s not on by default people won’t benefit/have to debug and then will turn it on |
My only concern here is that this changes how Pion so far handled things. Maybe there are services/implementations out there which for some reason rely on the fact that Pion does answer with the same codec for all media sections. Personally I would find that pretty strange, but you never know. I guess the more likely scenario is that folks learned to work around the current behavior some way. For example I'm not sure if renegotiating one media section after another, each going through a full SDP offer/answer round, would allow you to choose different codecs. But if people have developed such workarounds I guess it is pretty unlikely that these would break. So maybe you are right and we could make this the new default and only leave the new setting in as a way to get back to the old behavior if someone needs it. |
That's a great analysis :) My gut says it is better for users to have this on by default. I would even leave the setting out! Until someone complains then we add it back. Otherwise it turns into one of those things that is in the code base forever that never gets cleaned up. Maybe I should be more conservative. I feel bad we are shipping something today that is subpar, I just want users to |
yeah, because not everyone uses custom MediaEngine struct and pass on the API to create PeerConnection and it would be nice to have this as a config in setting engines so everyone can use it easily. |
A different issue I have noticed, though I am not sure how this works with the spec guideline. The Now even if we don't consider multi codec enabled scenario, the default case will be hit for all subsequent codecs in offer even the audio/video is negotiated. In that case if the offer have different Questions -
|
Alright. I see your point for making this the new default behavior. Makes sense. I would suggest to have the setting in there for folks to easily disable if needed. I can put a reminder in my calendar to remove it, or maybe we could put it on the todo list for the next release after the next? But if you @Sean-Der prefer to config option I'll remove it. Just let me know. |
Yes you are right that this is a complicated and related topic. TL;DR: within the same bundle group the extension IDs need to the same across all the media sections, which belong to the same bundle group. I'm not entirely sure that even all browsers handle all of the edge cases for this properly. I would suggest we open a new ticket to tackle that topic. |
yeah, let's discuss that seperately #3087 to avoid getting out of track from the scope of this PR. |
@nils-ohlmeier go for it! Sounds like a great plan to me. I really appreciate everyone being a conservative. A breaking release causes a lot of trouble. It’s just so tempting to get improvements out as fast as possible |
@JoeTurki @itzmanish could you take another look at the PR to double check that I didn't screw up something with my last commits? |
@@ -156,6 +156,7 @@ func (api *API) NewPeerConnection(configuration Configuration) (*PeerConnection, | |||
pc.api.mediaEngine = api.mediaEngine | |||
} else { | |||
pc.api.mediaEngine = api.mediaEngine.copy() | |||
pc.api.mediaEngine.setMultiCodecNegotiation(!api.settingEngine.disableMediaEngineMultipleCodecs) |
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.
Just a small question, why is setMultiCodecNegotiation
called only when disableMediaEngineCopy
is false?
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.
Good question if you look at nils comment:
What I'm not clear on is if we should do this only if disabledMediaEngineCopy is false, or if we should do that regardless of the value of disableMediaEngineCopy.
I think we should set it regardless, We're currently waiting on @itzmanish review for the changes!
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.
Indeed I'm unsure on how to handle that one.
One argument is that if copying is disable no settings from the initial MediaEngine should be transferred over.
I think the other view is: this is now a global setting and thus should get applied to all MediaEngine instances.
I'm okay doing it either way.
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.
Since this is a global setting now, I think we should always respect that when copying the mediaengine. However api have setting engine inside it and it won't get changed once the api is made, I don't think we need to explicitly set the multiCodecNegotiation flag from setting engine because it would be same.
Also currently It's not possible to set mediaengine's multicodec flag directly because they are now private field which means if you want to disable multicodec in the middle (which is weird case where you want multicodec for some instances of peerconnection but not for other), you have to change the settingengine directly.
@JoeTurki The changes are fine from my side and let's merge this. |
0404fbc
to
712cbd3
Compare
712cbd3
to
36f4d04
Compare
Description
This extends PR #2632 and Adds the capability to have multi-codec negotiation just by setting a flag in the media engine.
Reference issue
Fixes #...