-
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
set codec preferences #1646
Comments
I am all for implementing this! Pion right now stores codecs globally. The API however was designed to support per-transceiver codecs. We can update the API to copy codecs on creation, then allow users to disable them per transceiver. There are some things that are ambiguous that we need to check first.
|
I'd use it. I'm currently working around its lack: https://github.com/jech/galene/blob/master/group/group.go#L198
It seems to me that the SDP we generate should be restricted by the preferences set, so that any codecs negotiated would fit the constraints.
What does the WebRTC spec say? |
The code cited above is the root cause of #1656. We really need a way to change the set of allowable codecs at renegotiation time. |
I am going to start work on this. If others are interested I would appreciate the help!
|
How are they supposed to do that? As far as I am aware, you can either use AddTrack (which reuses a transceiver if available, creates a new one otherwise) or AddTransceiverFromTrack (which unconditionally creates a transceiver). What am I missing? |
@jech Yea unfortunately you will have to do We can look into making this better for |
Going through the list of transceivers in order to find out whether to call ATFT or RT is racy — the transceiver might no longer be available by the time you call RT, so you need to do your own locking around the call. Possibly not what you envision. |
Oof yea it won't be atomic. I don't have any ideas on how to do his better unfortunately. I am happy to let this sit if we want to think about it! For me the |
Instead of e.g. And then of course |
For me the MediaEngine bug is pretty big. @OrlandoCo @jech would you be ok with
a DoNotCopyMediaEngine flag for now?
No, please don't introduce any new API. Just copy the MediaEngine, and
let us work around the breakage.
Orlando, agreed?
|
@OrlandoCo You ok with me fixing #1662 in master? I just helped a user who this was actively breaking them. If you are ok I am going to fix and tag today. |
@Sean-Der is going to be possible to add codecs on the fly? |
@OrlandoCo no :( I could add a SettingEngine to not copy (to keep your use case). Then later we can provide per transceiver controls! |
How about calling it |
Implemented with f524fea |
Yay! |
Summary
Add the ability to set codec preferences on a specific track/transceiver.
Motivation
My real world use case for this is I have a security camera that has 2 way audio. It sends a variety of codecs but only accepts PCMA. Therefore I must either change the camera settings, or I can modify the SDP to use PCMA just for the one track.
JavaScript has RTCRtpTransceiver.setCodecPreferences which can be used pretty easily like so:
Describe alternatives you've considered
Currently the only ways to restrict which codec is used on a track is to:
For (1) this is less desirable or perhaps even unworkable for some people because it would effect every track on the peer instead of just the target track. In my case I can change the camera settings so this is what I am doing for now.
For (2) this is annoying, difficult, and error prone.
The text was updated successfully, but these errors were encountered: