From 0bc932e57ea33a0e5971443c4386f057108ed438 Mon Sep 17 00:00:00 2001 From: Paul Wells Date: Sun, 22 Oct 2023 23:43:03 -0700 Subject: [PATCH] fix config typo (#2172) * fix config typo * tidy * add sample config * cleanup --- config-sample.yaml | 17 ++++++++++++++++- pkg/config/config.go | 10 +++++----- pkg/service/roomservice.go | 14 +++++++------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/config-sample.yaml b/config-sample.yaml index 6025a3a9..95fc9f7f 100644 --- a/config-sample.yaml +++ b/config-sample.yaml @@ -162,7 +162,7 @@ keys: # enabled: true # min: 100 # max: 2000 -# # improves A/V sync when playout_delay set to a value larger than 200ms. It will disables transceiver re-use +# # improves A/V sync when playout_delay set to a value larger than 200ms. It will disables transceiver re-use # # so not recommended for rooms with frequent subscription changes # sync_streams: true @@ -193,6 +193,21 @@ keys: # # number of messages to buffer before dropping # stream_buffer_size: 1000 +# PSRPC +# since v1.5.1, a more reliable, psrpc based signal relay is available +# this gives us the ability to reliably proxy messages between a signal server and RTC node +# psrpc: +# # enable the internal psrpc api client for roomservice api calls +# enabled: true +# # maximum number of rpc attempts +# max_attempts: 3 +# # initial time to wait for calls to complete +# timeout: 500ms +# # amount of time added to the timeout after each failure +# backoff: 500ms +# # number of messages to buffer before dropping +# buffer_size: 1000 + # customize audio level sensitivity # audio: # # minimum level to be considered active, 0-127, where 0 is loudest diff --git a/pkg/config/config.go b/pkg/config/config.go index 06af44c3..048096c7 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -271,11 +271,11 @@ type SignalRelayConfig struct { } type PSRPCConfig struct { - Enable bool `yaml:"enable,omitempty"` - MaxAttempts int `yaml:"retry_attempts,omitempty"` - Timeout time.Duration `yaml:"retry_timeout,omitempty"` - Backoff time.Duration `yaml:"retry_backoff,omitempty"` - BufferSize int `yaml:"stream_buffer_size,omitempty"` + Enabled bool `yaml:"enabled,omitempty"` + MaxAttempts int `yaml:"max_attempts,omitempty"` + Timeout time.Duration `yaml:"timeout,omitempty"` + Backoff time.Duration `yaml:"backoff,omitempty"` + BufferSize int `yaml:"buffer_size,omitempty"` } // RegionConfig lists available regions and their latitude/longitude, so the selector would prefer diff --git a/pkg/service/roomservice.go b/pkg/service/roomservice.go index fe49550f..2f75ac00 100644 --- a/pkg/service/roomservice.go +++ b/pkg/service/roomservice.go @@ -151,7 +151,7 @@ func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomReq return nil, twirpAuthError(err) } - if s.psrpcConf.Enable { + if s.psrpcConf.Enabled { return s.roomClient.DeleteRoom(ctx, s.topicFormatter.RoomTopic(ctx, livekit.RoomName(req.Room)), req) } @@ -228,7 +228,7 @@ func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomPa return nil, twirp.NotFoundError("participant not found") } - if s.psrpcConf.Enable { + if s.psrpcConf.Enabled { return s.roomClient.RemoveParticipant(ctx, s.topicFormatter.ParticipantTopic(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity)), req) } @@ -264,7 +264,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR return nil, twirpAuthError(err) } - if s.psrpcConf.Enable { + if s.psrpcConf.Enabled { return s.roomClient.MutePublishedTrack(ctx, s.topicFormatter.ParticipantTopic(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity)), req) } @@ -318,7 +318,7 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update return nil, twirpAuthError(err) } - if s.psrpcConf.Enable { + if s.psrpcConf.Enabled { return s.roomClient.UpdateParticipant(ctx, s.topicFormatter.ParticipantTopic(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity)), req) } @@ -367,7 +367,7 @@ func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.Upda return nil, twirpAuthError(err) } - if s.psrpcConf.Enable { + if s.psrpcConf.Enabled { return s.roomClient.UpdateSubscriptions(ctx, s.topicFormatter.ParticipantTopic(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity)), req) } @@ -390,7 +390,7 @@ func (s *RoomService) SendData(ctx context.Context, req *livekit.SendDataRequest return nil, twirpAuthError(err) } - if s.psrpcConf.Enable { + if s.psrpcConf.Enabled { return s.roomClient.SendData(ctx, s.topicFormatter.RoomTopic(ctx, livekit.RoomName(req.Room)), req) } @@ -432,7 +432,7 @@ func (s *RoomService) UpdateRoomMetadata(ctx context.Context, req *livekit.Updat return nil, err } - if s.psrpcConf.Enable { + if s.psrpcConf.Enabled { _, err := s.roomClient.UpdateRoomMetadata(ctx, s.topicFormatter.RoomTopic(ctx, livekit.RoomName(req.Room)), req) if err != nil { return nil, err