Interface updates (#194)

* update interfaces, a bit of cleaning

* regenerate

* return interface for RoomService

* export packetBufferSize

* update router interface

* move participant key into router

* change locks back

* read only room store

* fix server rm locks

* update SendJoinResponse

* clean up imports

* update room messaging

* regenerate
This commit is contained in:
David Colburn
2021-11-15 15:25:50 -06:00
committed by GitHub
parent ffb2c50a70
commit 95e29d3766
17 changed files with 340 additions and 333 deletions
+11 -11
View File
@@ -8,7 +8,6 @@ import (
"time"
"github.com/go-logr/logr"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
"github.com/livekit/protocol/logger"
livekit "github.com/livekit/protocol/proto"
"google.golang.org/protobuf/proto"
@@ -16,6 +15,7 @@ import (
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/routing"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
"github.com/livekit/livekit-server/pkg/telemetry"
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
)
@@ -27,10 +27,15 @@ const (
)
type Room struct {
lock sync.RWMutex
Room *livekit.Room
Logger logger.Logger
config WebRTCConfig
lock sync.RWMutex
config WebRTCConfig
audioConfig *config.AudioConfig
telemetry *telemetry.TelemetryService
// map of identity -> Participant
participants map[string]types.Participant
participantOpts map[string]*ParticipantOptions
@@ -43,11 +48,6 @@ type Room struct {
closed chan struct{}
closeOnce sync.Once
// for active speaker updates
audioConfig *config.AudioConfig
telemetry *telemetry.TelemetryService
onParticipantChanged func(p types.Participant)
onMetadataUpdate func(metadata string)
onClose func()
@@ -66,7 +66,7 @@ func NewRoom(room *livekit.Room, config WebRTCConfig, audioConfig *config.AudioC
telemetry: telemetry,
participants: make(map[string]types.Participant),
participantOpts: make(map[string]*ParticipantOptions),
bufferFactory: buffer.NewBufferFactory(config.Receiver.packetBufferSize, logr.Logger{}),
bufferFactory: buffer.NewBufferFactory(config.Receiver.PacketBufferSize, logr.Logger{}),
closed: make(chan struct{}),
}
if r.Room.EmptyTimeout == 0 {
@@ -199,10 +199,10 @@ func (r *Room) Join(participant types.Participant, opts *ParticipantOptions, ice
r.participantOpts[participant.Identity()] = opts
// gather other participants and send join response
otherParticipants := make([]types.Participant, 0, len(r.participants))
otherParticipants := make([]*livekit.ParticipantInfo, 0, len(r.participants))
for _, p := range r.participants {
if p.ID() != participant.ID() && !p.Hidden() {
otherParticipants = append(otherParticipants, p)
otherParticipants = append(otherParticipants, p.ToProto())
}
}