Add PlayoutDelay to CreateRoomRequest (#1930)

* Add PlayoutDelay to CreateRoomRequest

* Remove max delay from palyoutdelay
This commit is contained in:
cnderrauber
2023-08-03 16:32:59 +08:00
committed by GitHub
parent 03ab242fb8
commit eadc910bff
7 changed files with 12 additions and 8 deletions
-1
View File
@@ -156,7 +156,6 @@ keys:
# playout_delay:
# enabled: true
# min: 100
# max: 300
# Webhooks
# when configured, LiveKit notifies your URL handler with room events
+1 -1
View File
@@ -18,7 +18,7 @@ require (
github.com/jxskiss/base62 v1.1.0
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a
github.com/livekit/protocol v1.5.11-0.20230803070907-caf65ebc47a0
github.com/livekit/protocol v1.5.11-0.20230803081122-d791f31b6e0f
github.com/livekit/psrpc v0.3.2
github.com/mackerelio/go-osstat v0.2.4
github.com/magefile/mage v1.15.0
+2 -2
View File
@@ -124,8 +124,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a h1:JWpPHcMFuw0fP4swE89CfMgeUXiSN5IKvCJL/5HLI3A=
github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a/go.mod h1:xirUXW8xnLGmfCwUeAv/nj1VGo1OO1BmgxrYP7jK/14=
github.com/livekit/protocol v1.5.11-0.20230803070907-caf65ebc47a0 h1:zoHo3GmUmfZrfZBKF8l+P07ntNitqkEZ0NBjwNdHbhk=
github.com/livekit/protocol v1.5.11-0.20230803070907-caf65ebc47a0/go.mod h1:SUS9foM1xBzw/AFrgTJuFX/oSuwlnIbHmpdiPdCvwEM=
github.com/livekit/protocol v1.5.11-0.20230803081122-d791f31b6e0f h1:nhkzJVWnRePDo6imcFnuIljwU8MTBjcRdzfdLaVdWXw=
github.com/livekit/protocol v1.5.11-0.20230803081122-d791f31b6e0f/go.mod h1:SUS9foM1xBzw/AFrgTJuFX/oSuwlnIbHmpdiPdCvwEM=
github.com/livekit/psrpc v0.3.2 h1:eAaJhASme33gtoBhCRLH9jsnWcdm1tHWf0WzaDk56ew=
github.com/livekit/psrpc v0.3.2/go.mod h1:n6JntEg+zT6Ji8InoyTpV7wusPNwGqqtxmHlkNhDN0U=
github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs=
-1
View File
@@ -200,7 +200,6 @@ type StreamTrackersConfig struct {
type PlayoutDelayConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
Min int `yaml:"min,omitempty"`
Max int `yaml:"max,omitempty"`
}
type VideoConfig struct {
+6 -1
View File
@@ -85,6 +85,12 @@ func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.Cre
if req.Egress != nil && req.Egress.Tracks != nil {
internal = &livekit.RoomInternal{TrackEgress: req.Egress.Tracks}
}
if req.MinPlayoutDelay > 0 {
rm.PlayoutDelay = &livekit.PlayoutDelay{
Enabled: true,
Min: req.MinPlayoutDelay,
}
}
if err = r.roomStore.StoreRoom(ctx, rm, internal); err != nil {
return nil, err
@@ -154,6 +160,5 @@ func applyDefaultRoomConfig(room *livekit.Room, conf *config.RoomConfig) {
room.PlayoutDelay = &livekit.PlayoutDelay{
Enabled: conf.PlayoutDelay.Enabled,
Min: uint32(conf.PlayoutDelay.Min),
Max: uint32(conf.PlayoutDelay.Max),
}
}
+1 -1
View File
@@ -330,7 +330,7 @@ func NewDownTrack(params DowntrackParams) (*DownTrack, error) {
if d.params.PlayoutDelayLimit.GetEnabled() && d.params.PlayoutDelayLimit.GetMin() > 0 {
delay := rtpextension.PlayoutDelayFromValue(
uint16(d.params.PlayoutDelayLimit.GetMin()),
uint16(d.params.PlayoutDelayLimit.GetMax()),
rtpextension.PlayoutDelayDefaultMax,
)
b, err := delay.Marshal()
if err == nil {
+2 -1
View File
@@ -6,7 +6,8 @@ import (
)
const (
PlayoutDelayURI = "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"
PlayoutDelayURI = "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"
PlayoutDelayDefaultMax = 4000 // 4s
playoutDelayExtensionSize = 3
)