devopvoid / webrtc-java

WebRTC for desktop platforms running Java
Apache License 2.0
248 stars 60 forks source link

Ignored codec preferences #57

Closed akislyak closed 1 year ago

akislyak commented 2 years ago

Describe the bug I need to restrict codec specification that used in SDP negotiation so I set a List containing only one 'opus' to an instance of 'RTCRtpTransceiver' but underlying library ignores this. I got SDP offer having all default codecs. I saw JNI class 'JNI_RTCRtpTransceiver.cpp' has commented lines 144-148 it might be a reason.

To Reproduce Steps to reproduce the behavior:

    val audioCodecs = listOf(factory.getRtpReceiverCapabilities(MediaType.AUDIO)
        .codecs
        .first { it.name.contains("opus") }!!)
.
.
.
    val audionTransceiver = peerConnection.addTransceiver(audioTrack, audioInit)
    audionTransceiver.codecPreferences = audioCodecs

Expected behavior SDP offer has only 'opus' as a preferred codec

Desktop (please complete the following information):

Remarks: Is it really need to comment those lines?

devopvoid commented 1 year ago

Closing it. Should work, if it doesn't please re-open this issue.