Return chosen codec for simulcast codecs (#1624)
* Return chosen codec for simulcast codecs * Increase timeout for subscription test
This commit is contained in:
@@ -16,7 +16,7 @@ func registerCodecs(me *webrtc.MediaEngine, codecs []*livekit.Codec, rtcpFeedbac
|
||||
opusCodec := opusCodecCapability
|
||||
opusCodec.RTCPFeedback = rtcpFeedback.Audio
|
||||
var opusPayload webrtc.PayloadType
|
||||
if isCodecEnabled(codecs, opusCodec) {
|
||||
if IsCodecEnabled(codecs, opusCodec) {
|
||||
opusPayload = 111
|
||||
if err := me.RegisterCodec(webrtc.RTPCodecParameters{
|
||||
RTPCodecCapability: opusCodec,
|
||||
@@ -25,7 +25,7 @@ func registerCodecs(me *webrtc.MediaEngine, codecs []*livekit.Codec, rtcpFeedbac
|
||||
return err
|
||||
}
|
||||
|
||||
if isCodecEnabled(codecs, redCodecCapability) {
|
||||
if IsCodecEnabled(codecs, redCodecCapability) {
|
||||
if err := me.RegisterCodec(webrtc.RTPCodecParameters{
|
||||
RTPCodecCapability: redCodecCapability,
|
||||
PayloadType: 63,
|
||||
@@ -65,7 +65,7 @@ func registerCodecs(me *webrtc.MediaEngine, codecs []*livekit.Codec, rtcpFeedbac
|
||||
PayloadType: 35,
|
||||
},
|
||||
} {
|
||||
if isCodecEnabled(codecs, codec.RTPCodecCapability) {
|
||||
if IsCodecEnabled(codecs, codec.RTPCodecCapability) {
|
||||
if err := me.RegisterCodec(codec, webrtc.RTPCodecTypeVideo); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -103,7 +103,7 @@ func createMediaEngine(codecs []*livekit.Codec, config DirectionConfig) (*webrtc
|
||||
return me, nil
|
||||
}
|
||||
|
||||
func isCodecEnabled(codecs []*livekit.Codec, cap webrtc.RTPCodecCapability) bool {
|
||||
func IsCodecEnabled(codecs []*livekit.Codec, cap webrtc.RTPCodecCapability) bool {
|
||||
for _, codec := range codecs {
|
||||
if !strings.EqualFold(codec.Mime, cap.MimeType) {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user