Add config for active red encoding (#1476)

This commit is contained in:
cnderrauber
2023-02-28 10:44:47 +08:00
committed by GitHub
parent 8c43b7b48f
commit c367c36d8f
4 changed files with 8 additions and 1 deletions
+2
View File
@@ -176,6 +176,8 @@ keys:
# update_interval: 500
# # to prevent speaker updates from too jumpy, smooth out values over N samples
# smooth_intervals: 4
# # enable red encoding downtrack for opus only audio up track
# active_red_encoding: true
# turn server
# turn:
+2
View File
@@ -150,6 +150,8 @@ type AudioConfig struct {
// smoothing for audioLevel values sent to the client.
// audioLevel will be an average of `smooth_intervals`, 0 to disable
SmoothIntervals uint32 `yaml:"smooth_intervals"`
// enable red encoding downtrack for opus only audio up track
ActiveREDEncoding bool `yaml:"active_red_encoding"`
}
type StreamTrackerPacketConfig struct {
+1
View File
@@ -70,6 +70,7 @@ func NewMediaTrack(params MediaTrackParams) *MediaTrack {
ParticipantVersion: params.ParticipantVersion,
ReceiverConfig: params.ReceiverConfig,
SubscriberConfig: params.SubscriberConfig,
AudioConfig: params.AudioConfig,
Telemetry: params.Telemetry,
Logger: params.Logger,
})
+3 -1
View File
@@ -15,6 +15,7 @@ import (
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
@@ -74,6 +75,7 @@ type MediaTrackReceiverParams struct {
ParticipantVersion uint32
ReceiverConfig ReceiverConfig
SubscriberConfig DirectionConfig
AudioConfig config.AudioConfig
Telemetry telemetry.TelemetryService
Logger logger.Logger
}
@@ -474,7 +476,7 @@ func (t *MediaTrackReceiver) AddSubscriber(sub types.LocalParticipant) (types.Su
StreamId: streamId,
UpstreamCodecs: potentialCodecs,
Logger: tLogger,
DisableRed: t.trackInfo.GetDisableRed(),
DisableRed: t.trackInfo.GetDisableRed() || !t.params.AudioConfig.ActiveREDEncoding,
})
return t.MediaTrackSubscriptions.AddSubscriber(sub, wr)
}