mirror of
https://github.com/livekit/livekit.git
synced 2026-05-25 20:45:13 +00:00
Added Xiaomi 2201117TI to devices that does not support H.264 (#1728)
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package clientconfiguration
|
||||
|
||||
// configurations for livekit-client, add more configuration to StaticConfigurations as need
|
||||
import (
|
||||
"github.com/livekit/protocol/livekit"
|
||||
)
|
||||
|
||||
// StaticConfigurations list specific device-side limitations that should be disabled at a global level
|
||||
var StaticConfigurations = []ConfigurationItem{
|
||||
// {
|
||||
// Match: &ScriptMatch{Expr: `c.protocol <= 5 || c.browser == "firefox"`},
|
||||
@@ -14,4 +18,13 @@ var StaticConfigurations = []ConfigurationItem{
|
||||
// }}},
|
||||
// Merge: false,
|
||||
// },
|
||||
{
|
||||
Match: &ScriptMatch{Expr: `c.device_model == "Xiaomi 2201117TI" && c.os == "android"`},
|
||||
Configuration: &livekit.ClientConfiguration{
|
||||
DisabledCodecs: &livekit.DisabledCodecs{
|
||||
Publish: []*livekit.Codec{{Mime: "video/h264"}},
|
||||
},
|
||||
},
|
||||
Merge: false,
|
||||
},
|
||||
}
|
||||
|
||||
+24
-10
@@ -95,18 +95,32 @@ func NewTransportManager(params TransportManagerParams) (*TransportManager, erro
|
||||
}
|
||||
t.mediaLossProxy.OnMediaLossUpdate(t.onMediaLossUpdate)
|
||||
|
||||
enabledCodecs := make([]*livekit.Codec, 0, len(params.EnabledCodecs))
|
||||
for _, c := range params.EnabledCodecs {
|
||||
var disabled bool
|
||||
for _, disableCodec := range params.ClientConf.GetDisabledCodecs().GetCodecs() {
|
||||
subscribeCodecs := make([]*livekit.Codec, 0, len(params.EnabledCodecs))
|
||||
publishCodecs := make([]*livekit.Codec, 0, len(params.EnabledCodecs))
|
||||
shouldDisable := func(c *livekit.Codec, disabledCodecs []*livekit.Codec) bool {
|
||||
for _, disableCodec := range disabledCodecs {
|
||||
// disable codec's fmtp is empty means disable this codec entirely
|
||||
if strings.EqualFold(c.Mime, disableCodec.Mime) && (disableCodec.FmtpLine == "" || disableCodec.FmtpLine == c.FmtpLine) {
|
||||
disabled = true
|
||||
break
|
||||
return true
|
||||
}
|
||||
}
|
||||
if !disabled {
|
||||
enabledCodecs = append(enabledCodecs, c)
|
||||
return false
|
||||
}
|
||||
for _, c := range params.EnabledCodecs {
|
||||
var publishDisabled bool
|
||||
var subscribeDisabled bool
|
||||
if shouldDisable(c, params.ClientConf.GetDisabledCodecs().GetCodecs()) {
|
||||
publishDisabled = true
|
||||
subscribeDisabled = true
|
||||
}
|
||||
if shouldDisable(c, params.ClientConf.GetDisabledCodecs().GetPublish()) {
|
||||
publishDisabled = true
|
||||
}
|
||||
if !publishDisabled {
|
||||
publishCodecs = append(publishCodecs, c)
|
||||
}
|
||||
if !subscribeDisabled {
|
||||
subscribeCodecs = append(subscribeCodecs, c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +132,7 @@ func NewTransportManager(params TransportManagerParams) (*TransportManager, erro
|
||||
DirectionConfig: params.Config.Publisher,
|
||||
CongestionControlConfig: params.CongestionControlConfig,
|
||||
Telemetry: params.Telemetry,
|
||||
EnabledCodecs: enabledCodecs,
|
||||
EnabledCodecs: publishCodecs,
|
||||
Logger: LoggerWithPCTarget(params.Logger, livekit.SignalTarget_PUBLISHER),
|
||||
SimTracks: params.SimTracks,
|
||||
ClientInfo: params.ClientInfo,
|
||||
@@ -150,7 +164,7 @@ func NewTransportManager(params TransportManagerParams) (*TransportManager, erro
|
||||
DirectionConfig: params.Config.Subscriber,
|
||||
CongestionControlConfig: params.CongestionControlConfig,
|
||||
Telemetry: params.Telemetry,
|
||||
EnabledCodecs: enabledCodecs,
|
||||
EnabledCodecs: subscribeCodecs,
|
||||
Logger: LoggerWithPCTarget(params.Logger, livekit.SignalTarget_SUBSCRIBER),
|
||||
ClientInfo: params.ClientInfo,
|
||||
IsOfferer: true,
|
||||
|
||||
Reference in New Issue
Block a user