Disable h264 for android firefox (#2190)
* Disable H.264 for android firefox * Fix syntax error for rule * lower case * Remove disabled codec from AddTrackRequest * Consistent handling of enabled codecs Mainly cleaning up where we are doing codec filtering. There's also behavior change of how we handle codec compatibility. If a client doesn't support the client's desired codec, we'll pick a backup automatically instead of rejecting the client's request. Requires an update on multi-codec simulcast handling. * fix alternative codec selection --------- Co-authored-by: David Zhao <dz@livekit.io>
This commit is contained in:
co-authored by
David Zhao
parent
1f0ba21854
commit
3633dfe39e
@@ -18,6 +18,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/sfu"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
@@ -132,3 +133,22 @@ func IsCodecEnabled(codecs []*livekit.Codec, cap webrtc.RTPCodecCapability) bool
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func selectAlternativeCodec(enabledCodecs []*livekit.Codec) string {
|
||||
// sort these by compatibility, since we are looking for backups
|
||||
if slices.ContainsFunc(enabledCodecs, func(c *livekit.Codec) bool {
|
||||
return strings.EqualFold(c.Mime, webrtc.MimeTypeVP8)
|
||||
}) {
|
||||
return webrtc.MimeTypeVP8
|
||||
}
|
||||
if slices.ContainsFunc(enabledCodecs, func(c *livekit.Codec) bool {
|
||||
return strings.EqualFold(c.Mime, webrtc.MimeTypeH264)
|
||||
}) {
|
||||
return webrtc.MimeTypeH264
|
||||
}
|
||||
if len(enabledCodecs) > 0 {
|
||||
return enabledCodecs[0].Mime
|
||||
}
|
||||
// uh oh. this should not happen
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user