mirror of
https://github.com/livekit/livekit.git
synced 2026-08-29 07:39:09 +00:00
type definition of room name (#311)
* WIP commit * update protocol * Fixing a test and catching one place where casting was missed * Fix one more spot which need conversion from livekit.RoomName -> string * do not covert list
This commit is contained in:
@@ -14,12 +14,13 @@ require (
|
||||
github.com/google/wire v0.5.0
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/hashicorp/golang-lru v0.5.4
|
||||
github.com/livekit/protocol v0.11.8-0.20211230201519-cfba8f993398
|
||||
github.com/livekit/protocol v0.11.8-0.20220102040102-feaea540b8df
|
||||
github.com/magefile/mage v1.11.0
|
||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/pion/ice/v2 v2.1.14
|
||||
github.com/pion/interceptor v0.1.0
|
||||
github.com/pion/logging v0.2.2
|
||||
github.com/pion/rtcp v1.2.9
|
||||
github.com/pion/rtp v1.7.4
|
||||
@@ -58,7 +59,6 @@ require (
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/pion/datachannel v1.5.2 // indirect
|
||||
github.com/pion/dtls/v2 v2.0.10 // indirect
|
||||
github.com/pion/interceptor v0.1.0 // indirect
|
||||
github.com/pion/mdns v0.0.5 // indirect
|
||||
github.com/pion/randutil v0.1.0 // indirect
|
||||
github.com/pion/sctp v1.8.0 // indirect
|
||||
|
||||
@@ -132,10 +132,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY/mKrcvA=
|
||||
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
|
||||
github.com/livekit/protocol v0.11.7 h1:Rfd+7GE63d2W2505QroxGGFUxWkcLWqYR0z9dfrf1zU=
|
||||
github.com/livekit/protocol v0.11.7/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
|
||||
github.com/livekit/protocol v0.11.8-0.20211230201519-cfba8f993398 h1:T1BINt9HgduT7DGi5Ax5niF1DtN2CPiF3BXK3amzXZo=
|
||||
github.com/livekit/protocol v0.11.8-0.20211230201519-cfba8f993398/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
|
||||
github.com/livekit/protocol v0.11.8-0.20220102040102-feaea540b8df h1:4cqTGvQXH0Tb104eX2oIM7kUvtbX1JB0rtP0Sjf8Ct8=
|
||||
github.com/livekit/protocol v0.11.8-0.20220102040102-feaea540b8df/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
|
||||
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls=
|
||||
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
|
||||
@@ -42,7 +42,7 @@ func (r *LocalRouter) GetNodeForRoom(_ context.Context, _ livekit.RoomName) (*li
|
||||
return node, nil
|
||||
}
|
||||
|
||||
func (r *LocalRouter) SetNodeForRoom(_ context.Context, _, _ livekit.RoomName) error {
|
||||
func (r *LocalRouter) SetNodeForRoom(_ context.Context, _ livekit.RoomName, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -75,8 +75,8 @@ func (r *RedisRouter) RemoveDeadNodes() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *RedisRouter) GetNodeForRoom(_ context.Context, roomName string) (*livekit.Node, error) {
|
||||
nodeID, err := r.rc.HGet(r.ctx, NodeRoomKey, roomName).Result()
|
||||
func (r *RedisRouter) GetNodeForRoom(_ context.Context, roomName livekit.RoomName) (*livekit.Node, error) {
|
||||
nodeID, err := r.rc.HGet(r.ctx, NodeRoomKey, string(roomName)).Result()
|
||||
if err == redis.Nil {
|
||||
return nil, ErrNotFound
|
||||
} else if err != nil {
|
||||
@@ -86,12 +86,12 @@ func (r *RedisRouter) GetNodeForRoom(_ context.Context, roomName string) (*livek
|
||||
return r.GetNode(nodeID)
|
||||
}
|
||||
|
||||
func (r *RedisRouter) SetNodeForRoom(_ context.Context, roomName, nodeID string) error {
|
||||
return r.rc.HSet(r.ctx, NodeRoomKey, roomName, nodeID).Err()
|
||||
func (r *RedisRouter) SetNodeForRoom(_ context.Context, roomName livekit.RoomName, nodeID string) error {
|
||||
return r.rc.HSet(r.ctx, NodeRoomKey, string(roomName), nodeID).Err()
|
||||
}
|
||||
|
||||
func (r *RedisRouter) ClearRoomState(_ context.Context, roomName string) error {
|
||||
if err := r.rc.HDel(r.ctx, NodeRoomKey, roomName).Err(); err != nil {
|
||||
func (r *RedisRouter) ClearRoomState(_ context.Context, roomName livekit.RoomName) error {
|
||||
if err := r.rc.HDel(r.ctx, NodeRoomKey, string(roomName)).Err(); err != nil {
|
||||
return errors.Wrap(err, "could not clear room state")
|
||||
}
|
||||
return nil
|
||||
@@ -128,7 +128,7 @@ func (r *RedisRouter) ListNodes() ([]*livekit.Node, error) {
|
||||
}
|
||||
|
||||
// StartParticipantSignal signal connection sets up paths to the RTC node, and starts to route messages to that message queue
|
||||
func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName string, pi ParticipantInit) (connectionID string, reqSink MessageSink, resSource MessageSource, err error) {
|
||||
func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName livekit.RoomName, pi ParticipantInit) (connectionID string, reqSink MessageSink, resSource MessageSource, err error) {
|
||||
// find the node where the room is hosted at
|
||||
rtcNode, err := r.GetNodeForRoom(ctx, roomName)
|
||||
if err != nil {
|
||||
@@ -148,7 +148,7 @@ func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName strin
|
||||
|
||||
// sends a message to start session
|
||||
err = sink.WriteMessage(&livekit.StartSession{
|
||||
RoomName: roomName,
|
||||
RoomName: string(roomName),
|
||||
Identity: pi.Identity,
|
||||
Metadata: pi.Metadata,
|
||||
Name: pi.Name,
|
||||
@@ -170,7 +170,7 @@ func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName strin
|
||||
return connectionID, sink, resChan, nil
|
||||
}
|
||||
|
||||
func (r *RedisRouter) WriteParticipantRTC(_ context.Context, roomName, identity string, msg *livekit.RTCNodeMessage) error {
|
||||
func (r *RedisRouter) WriteParticipantRTC(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity, msg *livekit.RTCNodeMessage) error {
|
||||
pkey := participantKey(roomName, identity)
|
||||
rtcNode, err := r.getParticipantRTCNode(pkey)
|
||||
if err != nil {
|
||||
@@ -182,7 +182,7 @@ func (r *RedisRouter) WriteParticipantRTC(_ context.Context, roomName, identity
|
||||
return r.writeRTCMessage(rtcSink, msg)
|
||||
}
|
||||
|
||||
func (r *RedisRouter) WriteRoomRTC(ctx context.Context, roomName, identity string, msg *livekit.RTCNodeMessage) error {
|
||||
func (r *RedisRouter) WriteRoomRTC(ctx context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity, msg *livekit.RTCNodeMessage) error {
|
||||
node, err := r.GetNodeForRoom(ctx, roomName)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -198,7 +198,7 @@ func (r *RedisRouter) WriteNodeRTC(_ context.Context, rtcNodeID string, msg *liv
|
||||
|
||||
func (r *RedisRouter) startParticipantRTC(ss *livekit.StartSession, participantKey string) error {
|
||||
// find the node where the room is hosted at
|
||||
rtcNode, err := r.GetNodeForRoom(r.ctx, ss.RoomName)
|
||||
rtcNode, err := r.GetNodeForRoom(r.ctx, livekit.RoomName(ss.RoomName))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -254,7 +254,7 @@ func (r *RedisRouter) startParticipantRTC(ss *livekit.StartSession, participantK
|
||||
resSink := NewSignalNodeSink(r.rc, signalNode, ss.ConnectionId)
|
||||
r.onNewParticipant(
|
||||
r.ctx,
|
||||
ss.RoomName,
|
||||
livekit.RoomName(ss.RoomName),
|
||||
pi,
|
||||
reqChan,
|
||||
resSink,
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
)
|
||||
|
||||
type FakeRouter struct {
|
||||
ClearRoomStateStub func(context.Context, string) error
|
||||
ClearRoomStateStub func(context.Context, livekit.RoomName) error
|
||||
clearRoomStateMutex sync.RWMutex
|
||||
clearRoomStateArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}
|
||||
clearRoomStateReturns struct {
|
||||
result1 error
|
||||
@@ -26,11 +26,11 @@ type FakeRouter struct {
|
||||
drainMutex sync.RWMutex
|
||||
drainArgsForCall []struct {
|
||||
}
|
||||
GetNodeForRoomStub func(context.Context, string) (*livekit.Node, error)
|
||||
GetNodeForRoomStub func(context.Context, livekit.RoomName) (*livekit.Node, error)
|
||||
getNodeForRoomMutex sync.RWMutex
|
||||
getNodeForRoomArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}
|
||||
getNodeForRoomReturns struct {
|
||||
result1 *livekit.Node
|
||||
@@ -82,11 +82,11 @@ type FakeRouter struct {
|
||||
removeDeadNodesReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
SetNodeForRoomStub func(context.Context, string, string) error
|
||||
SetNodeForRoomStub func(context.Context, livekit.RoomName, string) error
|
||||
setNodeForRoomMutex sync.RWMutex
|
||||
setNodeForRoomArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}
|
||||
setNodeForRoomReturns struct {
|
||||
@@ -105,11 +105,11 @@ type FakeRouter struct {
|
||||
startReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
StartParticipantSignalStub func(context.Context, string, routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error)
|
||||
StartParticipantSignalStub func(context.Context, livekit.RoomName, routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error)
|
||||
startParticipantSignalMutex sync.RWMutex
|
||||
startParticipantSignalArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 routing.ParticipantInit
|
||||
}
|
||||
startParticipantSignalReturns struct {
|
||||
@@ -138,11 +138,11 @@ type FakeRouter struct {
|
||||
unregisterNodeReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
WriteParticipantRTCStub func(context.Context, string, string, *livekit.RTCNodeMessage) error
|
||||
WriteParticipantRTCStub func(context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) error
|
||||
writeParticipantRTCMutex sync.RWMutex
|
||||
writeParticipantRTCArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
arg4 *livekit.RTCNodeMessage
|
||||
}
|
||||
@@ -152,11 +152,11 @@ type FakeRouter struct {
|
||||
writeParticipantRTCReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
WriteRoomRTCStub func(context.Context, string, string, *livekit.RTCNodeMessage) error
|
||||
WriteRoomRTCStub func(context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) error
|
||||
writeRoomRTCMutex sync.RWMutex
|
||||
writeRoomRTCArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
arg4 *livekit.RTCNodeMessage
|
||||
}
|
||||
@@ -170,12 +170,12 @@ type FakeRouter struct {
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) ClearRoomState(arg1 context.Context, arg2 string) error {
|
||||
func (fake *FakeRouter) ClearRoomState(arg1 context.Context, arg2 livekit.RoomName) error {
|
||||
fake.clearRoomStateMutex.Lock()
|
||||
ret, specificReturn := fake.clearRoomStateReturnsOnCall[len(fake.clearRoomStateArgsForCall)]
|
||||
fake.clearRoomStateArgsForCall = append(fake.clearRoomStateArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}{arg1, arg2})
|
||||
stub := fake.ClearRoomStateStub
|
||||
fakeReturns := fake.clearRoomStateReturns
|
||||
@@ -196,13 +196,13 @@ func (fake *FakeRouter) ClearRoomStateCallCount() int {
|
||||
return len(fake.clearRoomStateArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) ClearRoomStateCalls(stub func(context.Context, string) error) {
|
||||
func (fake *FakeRouter) ClearRoomStateCalls(stub func(context.Context, livekit.RoomName) error) {
|
||||
fake.clearRoomStateMutex.Lock()
|
||||
defer fake.clearRoomStateMutex.Unlock()
|
||||
fake.ClearRoomStateStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) ClearRoomStateArgsForCall(i int) (context.Context, string) {
|
||||
func (fake *FakeRouter) ClearRoomStateArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.clearRoomStateMutex.RLock()
|
||||
defer fake.clearRoomStateMutex.RUnlock()
|
||||
argsForCall := fake.clearRoomStateArgsForCall[i]
|
||||
@@ -256,12 +256,12 @@ func (fake *FakeRouter) DrainCalls(stub func()) {
|
||||
fake.DrainStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) GetNodeForRoom(arg1 context.Context, arg2 string) (*livekit.Node, error) {
|
||||
func (fake *FakeRouter) GetNodeForRoom(arg1 context.Context, arg2 livekit.RoomName) (*livekit.Node, error) {
|
||||
fake.getNodeForRoomMutex.Lock()
|
||||
ret, specificReturn := fake.getNodeForRoomReturnsOnCall[len(fake.getNodeForRoomArgsForCall)]
|
||||
fake.getNodeForRoomArgsForCall = append(fake.getNodeForRoomArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}{arg1, arg2})
|
||||
stub := fake.GetNodeForRoomStub
|
||||
fakeReturns := fake.getNodeForRoomReturns
|
||||
@@ -282,13 +282,13 @@ func (fake *FakeRouter) GetNodeForRoomCallCount() int {
|
||||
return len(fake.getNodeForRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) GetNodeForRoomCalls(stub func(context.Context, string) (*livekit.Node, error)) {
|
||||
func (fake *FakeRouter) GetNodeForRoomCalls(stub func(context.Context, livekit.RoomName) (*livekit.Node, error)) {
|
||||
fake.getNodeForRoomMutex.Lock()
|
||||
defer fake.getNodeForRoomMutex.Unlock()
|
||||
fake.GetNodeForRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) GetNodeForRoomArgsForCall(i int) (context.Context, string) {
|
||||
func (fake *FakeRouter) GetNodeForRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.getNodeForRoomMutex.RLock()
|
||||
defer fake.getNodeForRoomMutex.RUnlock()
|
||||
argsForCall := fake.getNodeForRoomArgsForCall[i]
|
||||
@@ -547,12 +547,12 @@ func (fake *FakeRouter) RemoveDeadNodesReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) SetNodeForRoom(arg1 context.Context, arg2 string, arg3 string) error {
|
||||
func (fake *FakeRouter) SetNodeForRoom(arg1 context.Context, arg2 livekit.RoomName, arg3 string) error {
|
||||
fake.setNodeForRoomMutex.Lock()
|
||||
ret, specificReturn := fake.setNodeForRoomReturnsOnCall[len(fake.setNodeForRoomArgsForCall)]
|
||||
fake.setNodeForRoomArgsForCall = append(fake.setNodeForRoomArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.SetNodeForRoomStub
|
||||
@@ -574,13 +574,13 @@ func (fake *FakeRouter) SetNodeForRoomCallCount() int {
|
||||
return len(fake.setNodeForRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) SetNodeForRoomCalls(stub func(context.Context, string, string) error) {
|
||||
func (fake *FakeRouter) SetNodeForRoomCalls(stub func(context.Context, livekit.RoomName, string) error) {
|
||||
fake.setNodeForRoomMutex.Lock()
|
||||
defer fake.setNodeForRoomMutex.Unlock()
|
||||
fake.SetNodeForRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) SetNodeForRoomArgsForCall(i int) (context.Context, string, string) {
|
||||
func (fake *FakeRouter) SetNodeForRoomArgsForCall(i int) (context.Context, livekit.RoomName, string) {
|
||||
fake.setNodeForRoomMutex.RLock()
|
||||
defer fake.setNodeForRoomMutex.RUnlock()
|
||||
argsForCall := fake.setNodeForRoomArgsForCall[i]
|
||||
@@ -663,12 +663,12 @@ func (fake *FakeRouter) StartReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) StartParticipantSignal(arg1 context.Context, arg2 string, arg3 routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error) {
|
||||
func (fake *FakeRouter) StartParticipantSignal(arg1 context.Context, arg2 livekit.RoomName, arg3 routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error) {
|
||||
fake.startParticipantSignalMutex.Lock()
|
||||
ret, specificReturn := fake.startParticipantSignalReturnsOnCall[len(fake.startParticipantSignalArgsForCall)]
|
||||
fake.startParticipantSignalArgsForCall = append(fake.startParticipantSignalArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 routing.ParticipantInit
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.StartParticipantSignalStub
|
||||
@@ -690,13 +690,13 @@ func (fake *FakeRouter) StartParticipantSignalCallCount() int {
|
||||
return len(fake.startParticipantSignalArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) StartParticipantSignalCalls(stub func(context.Context, string, routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error)) {
|
||||
func (fake *FakeRouter) StartParticipantSignalCalls(stub func(context.Context, livekit.RoomName, routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error)) {
|
||||
fake.startParticipantSignalMutex.Lock()
|
||||
defer fake.startParticipantSignalMutex.Unlock()
|
||||
fake.StartParticipantSignalStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) StartParticipantSignalArgsForCall(i int) (context.Context, string, routing.ParticipantInit) {
|
||||
func (fake *FakeRouter) StartParticipantSignalArgsForCall(i int) (context.Context, livekit.RoomName, routing.ParticipantInit) {
|
||||
fake.startParticipantSignalMutex.RLock()
|
||||
defer fake.startParticipantSignalMutex.RUnlock()
|
||||
argsForCall := fake.startParticipantSignalArgsForCall[i]
|
||||
@@ -812,12 +812,12 @@ func (fake *FakeRouter) UnregisterNodeReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) WriteParticipantRTC(arg1 context.Context, arg2 string, arg3 string, arg4 *livekit.RTCNodeMessage) error {
|
||||
func (fake *FakeRouter) WriteParticipantRTC(arg1 context.Context, arg2 livekit.RoomName, arg3 string, arg4 *livekit.RTCNodeMessage) error {
|
||||
fake.writeParticipantRTCMutex.Lock()
|
||||
ret, specificReturn := fake.writeParticipantRTCReturnsOnCall[len(fake.writeParticipantRTCArgsForCall)]
|
||||
fake.writeParticipantRTCArgsForCall = append(fake.writeParticipantRTCArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
arg4 *livekit.RTCNodeMessage
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
@@ -840,13 +840,13 @@ func (fake *FakeRouter) WriteParticipantRTCCallCount() int {
|
||||
return len(fake.writeParticipantRTCArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) WriteParticipantRTCCalls(stub func(context.Context, string, string, *livekit.RTCNodeMessage) error) {
|
||||
func (fake *FakeRouter) WriteParticipantRTCCalls(stub func(context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) error) {
|
||||
fake.writeParticipantRTCMutex.Lock()
|
||||
defer fake.writeParticipantRTCMutex.Unlock()
|
||||
fake.WriteParticipantRTCStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) WriteParticipantRTCArgsForCall(i int) (context.Context, string, string, *livekit.RTCNodeMessage) {
|
||||
func (fake *FakeRouter) WriteParticipantRTCArgsForCall(i int) (context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) {
|
||||
fake.writeParticipantRTCMutex.RLock()
|
||||
defer fake.writeParticipantRTCMutex.RUnlock()
|
||||
argsForCall := fake.writeParticipantRTCArgsForCall[i]
|
||||
@@ -876,12 +876,12 @@ func (fake *FakeRouter) WriteParticipantRTCReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) WriteRoomRTC(arg1 context.Context, arg2 string, arg3 string, arg4 *livekit.RTCNodeMessage) error {
|
||||
func (fake *FakeRouter) WriteRoomRTC(arg1 context.Context, arg2 livekit.RoomName, arg3 string, arg4 *livekit.RTCNodeMessage) error {
|
||||
fake.writeRoomRTCMutex.Lock()
|
||||
ret, specificReturn := fake.writeRoomRTCReturnsOnCall[len(fake.writeRoomRTCArgsForCall)]
|
||||
fake.writeRoomRTCArgsForCall = append(fake.writeRoomRTCArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
arg4 *livekit.RTCNodeMessage
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
@@ -904,13 +904,13 @@ func (fake *FakeRouter) WriteRoomRTCCallCount() int {
|
||||
return len(fake.writeRoomRTCArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) WriteRoomRTCCalls(stub func(context.Context, string, string, *livekit.RTCNodeMessage) error) {
|
||||
func (fake *FakeRouter) WriteRoomRTCCalls(stub func(context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) error) {
|
||||
fake.writeRoomRTCMutex.Lock()
|
||||
defer fake.writeRoomRTCMutex.Unlock()
|
||||
fake.WriteRoomRTCStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRouter) WriteRoomRTCArgsForCall(i int) (context.Context, string, string, *livekit.RTCNodeMessage) {
|
||||
func (fake *FakeRouter) WriteRoomRTCArgsForCall(i int) (context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) {
|
||||
fake.writeRoomRTCMutex.RLock()
|
||||
defer fake.writeRoomRTCMutex.RUnlock()
|
||||
argsForCall := fake.writeRoomRTCArgsForCall[i]
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func participantKey(roomName livekit.RoomName, identity livekit.ParticipantIdentity) string {
|
||||
return roomName + "|" + identity
|
||||
return string(roomName) + "|" + identity
|
||||
}
|
||||
|
||||
func parseParticipantKey(pkey string) (roomName livekit.RoomName, identity livekit.ParticipantIdentity, err error) {
|
||||
@@ -18,5 +18,5 @@ func parseParticipantKey(pkey string) (roomName livekit.RoomName, identity livek
|
||||
return
|
||||
}
|
||||
|
||||
return parts[0], parts[1], nil
|
||||
return livekit.RoomName(parts[0]), parts[1], nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ type ParticipantOptions struct {
|
||||
func NewRoom(room *livekit.Room, config WebRTCConfig, audioConfig *config.AudioConfig, telemetry telemetry.TelemetryService) *Room {
|
||||
r := &Room{
|
||||
Room: proto.Clone(room).(*livekit.Room),
|
||||
Logger: LoggerWithRoom(logger.Logger(logger.GetLogger()), room.Name),
|
||||
Logger: LoggerWithRoom(logger.Logger(logger.GetLogger()), livekit.RoomName(room.Name)),
|
||||
config: config,
|
||||
audioConfig: audioConfig,
|
||||
telemetry: telemetry,
|
||||
@@ -83,7 +83,7 @@ func NewRoom(room *livekit.Room, config WebRTCConfig, audioConfig *config.AudioC
|
||||
}
|
||||
|
||||
func (r *Room) Name() livekit.RoomName {
|
||||
return r.Room.Name
|
||||
return livekit.RoomName(r.Room.Name)
|
||||
}
|
||||
|
||||
func (r *Room) GetParticipant(identity livekit.ParticipantIdentity) types.Participant {
|
||||
|
||||
@@ -9,15 +9,15 @@ import (
|
||||
)
|
||||
|
||||
type FakeRoom struct {
|
||||
NameStub func() string
|
||||
NameStub func() livekit.RoomName
|
||||
nameMutex sync.RWMutex
|
||||
nameArgsForCall []struct {
|
||||
}
|
||||
nameReturns struct {
|
||||
result1 string
|
||||
result1 livekit.RoomName
|
||||
}
|
||||
nameReturnsOnCall map[int]struct {
|
||||
result1 string
|
||||
result1 livekit.RoomName
|
||||
}
|
||||
UpdateSubscriptionPermissionsStub func(types.Participant, *livekit.UpdateSubscriptionPermissions) error
|
||||
updateSubscriptionPermissionsMutex sync.RWMutex
|
||||
@@ -49,7 +49,7 @@ type FakeRoom struct {
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeRoom) Name() string {
|
||||
func (fake *FakeRoom) Name() livekit.RoomName {
|
||||
fake.nameMutex.Lock()
|
||||
ret, specificReturn := fake.nameReturnsOnCall[len(fake.nameArgsForCall)]
|
||||
fake.nameArgsForCall = append(fake.nameArgsForCall, struct {
|
||||
@@ -73,32 +73,32 @@ func (fake *FakeRoom) NameCallCount() int {
|
||||
return len(fake.nameArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoom) NameCalls(stub func() string) {
|
||||
func (fake *FakeRoom) NameCalls(stub func() livekit.RoomName) {
|
||||
fake.nameMutex.Lock()
|
||||
defer fake.nameMutex.Unlock()
|
||||
fake.NameStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoom) NameReturns(result1 string) {
|
||||
func (fake *FakeRoom) NameReturns(result1 livekit.RoomName) {
|
||||
fake.nameMutex.Lock()
|
||||
defer fake.nameMutex.Unlock()
|
||||
fake.NameStub = nil
|
||||
fake.nameReturns = struct {
|
||||
result1 string
|
||||
result1 livekit.RoomName
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoom) NameReturnsOnCall(i int, result1 string) {
|
||||
func (fake *FakeRoom) NameReturnsOnCall(i int, result1 livekit.RoomName) {
|
||||
fake.nameMutex.Lock()
|
||||
defer fake.nameMutex.Unlock()
|
||||
fake.NameStub = nil
|
||||
if fake.nameReturnsOnCall == nil {
|
||||
fake.nameReturnsOnCall = make(map[int]struct {
|
||||
result1 string
|
||||
result1 livekit.RoomName
|
||||
})
|
||||
}
|
||||
fake.nameReturnsOnCall[i] = struct {
|
||||
result1 string
|
||||
result1 livekit.RoomName
|
||||
}{result1}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -101,7 +101,7 @@ func EnsureJoinPermission(ctx context.Context) (name livekit.RoomName, err error
|
||||
}
|
||||
|
||||
if claims.Video.RoomJoin {
|
||||
name = claims.Video.Room
|
||||
name = livekit.RoomName(claims.Video.Room)
|
||||
} else {
|
||||
err = ErrPermissionDenied
|
||||
}
|
||||
@@ -114,7 +114,7 @@ func EnsureAdminPermission(ctx context.Context, room livekit.RoomName) error {
|
||||
return ErrPermissionDenied
|
||||
}
|
||||
|
||||
if !claims.Video.RoomAdmin || room != claims.Video.Room {
|
||||
if !claims.Video.RoomAdmin || room != livekit.RoomName(claims.Video.Room) {
|
||||
return ErrPermissionDenied
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ func (p *LocalRoomStore) StoreRoom(_ context.Context, room *livekit.Room) error
|
||||
room.CreationTime = time.Now().Unix()
|
||||
}
|
||||
p.lock.Lock()
|
||||
p.rooms[room.Name] = room
|
||||
p.rooms[livekit.RoomName(room.Name)] = room
|
||||
p.lock.Unlock()
|
||||
return nil
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func (p *LocalRoomStore) ListRooms(_ context.Context, names []livekit.RoomName)
|
||||
defer p.lock.RUnlock()
|
||||
rooms := make([]*livekit.Room, 0, len(p.rooms))
|
||||
for _, r := range p.rooms {
|
||||
if names == nil || funk.Contains(names, r.Name) {
|
||||
if names == nil || funk.Contains(names, livekit.RoomName(r.Name)) {
|
||||
rooms = append(rooms, r)
|
||||
}
|
||||
}
|
||||
@@ -71,8 +71,8 @@ func (p *LocalRoomStore) DeleteRoom(ctx context.Context, name livekit.RoomName)
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
delete(p.participants, room.Name)
|
||||
delete(p.rooms, room.Name)
|
||||
delete(p.participants, livekit.RoomName(room.Name))
|
||||
delete(p.rooms, livekit.RoomName(room.Name))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ func (p *LocalRoomStore) StoreParticipant(_ context.Context, roomName livekit.Ro
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) LoadParticipant(_ context.Context, roomName, identity livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
func (p *LocalRoomStore) LoadParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
|
||||
@@ -132,7 +132,7 @@ func (p *LocalRoomStore) ListParticipants(_ context.Context, roomName livekit.Ro
|
||||
return items, nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) DeleteParticipant(_ context.Context, roomName, identity livekit.ParticipantIdentity) error {
|
||||
func (p *LocalRoomStore) DeleteParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error {
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ func (p *RedisRoomStore) StoreRoom(_ context.Context, room *livekit.Room) error
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) LoadRoom(_ context.Context, name livekit.RoomName) (*livekit.Room, error) {
|
||||
data, err := p.rc.HGet(p.ctx, RoomsKey, name).Result()
|
||||
data, err := p.rc.HGet(p.ctx, RoomsKey, string(name)).Result()
|
||||
if err != nil {
|
||||
if err == redis.Nil {
|
||||
err = ErrRoomNotFound
|
||||
@@ -81,8 +81,9 @@ func (p *RedisRoomStore) ListRooms(_ context.Context, names []livekit.RoomName)
|
||||
return nil, errors.Wrap(err, "could not get rooms")
|
||||
}
|
||||
} else {
|
||||
roomNames := livekit.RoomNamesAsStrings(names)
|
||||
var results []interface{}
|
||||
results, err = p.rc.HMGet(p.ctx, RoomsKey, names...).Result()
|
||||
results, err = p.rc.HMGet(p.ctx, RoomsKey, roomNames...).Result()
|
||||
if err != nil && err != redis.Nil {
|
||||
return nil, errors.Wrap(err, "could not get rooms by names")
|
||||
}
|
||||
@@ -113,8 +114,8 @@ func (p *RedisRoomStore) DeleteRoom(ctx context.Context, name livekit.RoomName)
|
||||
}
|
||||
|
||||
pp := p.rc.Pipeline()
|
||||
pp.HDel(p.ctx, RoomsKey, name)
|
||||
pp.Del(p.ctx, RoomParticipantsPrefix+name)
|
||||
pp.HDel(p.ctx, RoomsKey, string(name))
|
||||
pp.Del(p.ctx, RoomParticipantsPrefix+string(name))
|
||||
|
||||
_, err = pp.Exec(p.ctx)
|
||||
return err
|
||||
@@ -122,7 +123,7 @@ func (p *RedisRoomStore) DeleteRoom(ctx context.Context, name livekit.RoomName)
|
||||
|
||||
func (p *RedisRoomStore) LockRoom(_ context.Context, name livekit.RoomName, duration time.Duration) (string, error) {
|
||||
token := utils.NewGuid("LOCK")
|
||||
key := RoomLockPrefix + name
|
||||
key := RoomLockPrefix + string(name)
|
||||
|
||||
startTime := time.Now()
|
||||
for {
|
||||
@@ -146,7 +147,7 @@ func (p *RedisRoomStore) LockRoom(_ context.Context, name livekit.RoomName, dura
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) UnlockRoom(_ context.Context, name livekit.RoomName, uid string) error {
|
||||
key := RoomLockPrefix + name
|
||||
key := RoomLockPrefix + string(name)
|
||||
|
||||
val, err := p.rc.Get(p.ctx, key).Result()
|
||||
if err == redis.Nil {
|
||||
@@ -163,7 +164,7 @@ func (p *RedisRoomStore) UnlockRoom(_ context.Context, name livekit.RoomName, ui
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) StoreParticipant(_ context.Context, roomName livekit.RoomName, participant *livekit.ParticipantInfo) error {
|
||||
key := RoomParticipantsPrefix + roomName
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
|
||||
data, err := proto.Marshal(participant)
|
||||
if err != nil {
|
||||
@@ -174,7 +175,7 @@ func (p *RedisRoomStore) StoreParticipant(_ context.Context, roomName livekit.Ro
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) LoadParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
key := RoomParticipantsPrefix + roomName
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
data, err := p.rc.HGet(p.ctx, key, identity).Result()
|
||||
if err == redis.Nil {
|
||||
return nil, ErrParticipantNotFound
|
||||
@@ -190,7 +191,7 @@ func (p *RedisRoomStore) LoadParticipant(_ context.Context, roomName livekit.Roo
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) ListParticipants(_ context.Context, roomName livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
key := RoomParticipantsPrefix + roomName
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
items, err := p.rc.HVals(p.ctx, key).Result()
|
||||
if err == redis.Nil {
|
||||
return nil, nil
|
||||
@@ -210,7 +211,7 @@ func (p *RedisRoomStore) ListParticipants(_ context.Context, roomName livekit.Ro
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) DeleteParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error {
|
||||
key := RoomParticipantsPrefix + roomName
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
|
||||
return p.rc.HDel(p.ctx, key, identity).Err()
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestParticipantPersistence(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
rs := service.NewRedisRoomStore(redisClient())
|
||||
|
||||
roomName := "room1"
|
||||
roomName := livekit.RoomName("room1")
|
||||
_ = rs.DeleteRoom(ctx, roomName)
|
||||
|
||||
p := &livekit.ParticipantInfo{
|
||||
@@ -64,7 +64,7 @@ func TestRoomLock(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
rs := service.NewRedisRoomStore(redisClient())
|
||||
lockInterval := 5 * time.Millisecond
|
||||
roomName := "myroom"
|
||||
roomName := livekit.RoomName("myroom")
|
||||
|
||||
t.Run("normal locking", func(t *testing.T) {
|
||||
token, err := rs.LockRoom(ctx, roomName, lockInterval)
|
||||
|
||||
@@ -37,16 +37,16 @@ func NewRoomAllocator(conf *config.Config, router routing.Router, rs RoomStore)
|
||||
// CreateRoom creates a new room from a request and allocates it to a node to handle
|
||||
// it'll also monitor its state, and cleans it up when appropriate
|
||||
func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.CreateRoomRequest) (*livekit.Room, error) {
|
||||
token, err := r.roomStore.LockRoom(ctx, req.Name, 5*time.Second)
|
||||
token, err := r.roomStore.LockRoom(ctx, livekit.RoomName(req.Name), 5*time.Second)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
_ = r.roomStore.UnlockRoom(ctx, req.Name, token)
|
||||
_ = r.roomStore.UnlockRoom(ctx, livekit.RoomName(req.Name), token)
|
||||
}()
|
||||
|
||||
// find existing room and update it
|
||||
rm, err := r.roomStore.LoadRoom(ctx, req.Name)
|
||||
rm, err := r.roomStore.LoadRoom(ctx, livekit.RoomName(req.Name))
|
||||
if err == ErrRoomNotFound {
|
||||
rm = &livekit.Room{
|
||||
Sid: utils.NewGuid(utils.RoomPrefix),
|
||||
@@ -70,7 +70,7 @@ func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.Cre
|
||||
}
|
||||
|
||||
// check if room already assigned
|
||||
existing, err := r.router.GetNodeForRoom(ctx, rm.Name)
|
||||
existing, err := r.router.GetNodeForRoom(ctx, livekit.RoomName(rm.Name))
|
||||
if err != routing.ErrNotFound && err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -102,7 +102,7 @@ func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.Cre
|
||||
}
|
||||
|
||||
logger.Debugw("selected node for room", "room", rm.Name, "roomID", rm.Sid, "nodeID", nodeID)
|
||||
err = r.router.SetNodeForRoom(ctx, rm.Name, nodeID)
|
||||
err = r.router.SetNodeForRoom(ctx, livekit.RoomName(rm.Name), nodeID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ func (r *RoomManager) CleanupRooms() error {
|
||||
now := time.Now().Unix()
|
||||
for _, room := range rooms {
|
||||
if (now - room.CreationTime) > roomPurgeSeconds {
|
||||
if err := r.DeleteRoom(ctx, room.Name); err != nil {
|
||||
if err := r.DeleteRoom(ctx, livekit.RoomName(room.Name)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -385,7 +385,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.Partici
|
||||
}
|
||||
|
||||
// handles RTC messages resulted from Room API calls
|
||||
func (r *RoomManager) handleRTCMessage(_ context.Context, roomName, identity livekit.ParticipantIdentity, msg *livekit.RTCNodeMessage) {
|
||||
func (r *RoomManager) handleRTCMessage(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity, msg *livekit.RTCNodeMessage) {
|
||||
r.lock.RLock()
|
||||
room := r.rooms[roomName]
|
||||
r.lock.RUnlock()
|
||||
|
||||
+17
-17
@@ -48,7 +48,7 @@ func (s *RoomService) ListRooms(ctx context.Context, req *livekit.ListRoomsReque
|
||||
|
||||
var names []livekit.RoomName
|
||||
if len(req.Names) > 0 {
|
||||
names = req.Names
|
||||
names = livekit.StringsAsRoomNames(req.Names)
|
||||
}
|
||||
rooms, err := s.roomStore.ListRooms(ctx, names)
|
||||
if err != nil {
|
||||
@@ -66,7 +66,7 @@ func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomReq
|
||||
if err := EnsureCreatePermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
err := s.router.WriteRoomRTC(ctx, req.Room, "", &livekit.RTCNodeMessage{
|
||||
err := s.router.WriteRoomRTC(ctx, livekit.RoomName(req.Room), "", &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_DeleteRoom{
|
||||
DeleteRoom: req,
|
||||
},
|
||||
@@ -79,11 +79,11 @@ func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomReq
|
||||
}
|
||||
|
||||
func (s *RoomService) ListParticipants(ctx context.Context, req *livekit.ListParticipantsRequest) (res *livekit.ListParticipantsResponse, err error) {
|
||||
if err = EnsureAdminPermission(ctx, req.Room); err != nil {
|
||||
if err = EnsureAdminPermission(ctx, livekit.RoomName(req.Room)); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participants, err := s.roomStore.ListParticipants(ctx, req.Room)
|
||||
participants, err := s.roomStore.ListParticipants(ctx, livekit.RoomName(req.Room))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -95,11 +95,11 @@ func (s *RoomService) ListParticipants(ctx context.Context, req *livekit.ListPar
|
||||
}
|
||||
|
||||
func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.ParticipantInfo, err error) {
|
||||
if err = EnsureAdminPermission(ctx, req.Room); err != nil {
|
||||
if err = EnsureAdminPermission(ctx, livekit.RoomName(req.Room)); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -109,7 +109,7 @@ func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParti
|
||||
}
|
||||
|
||||
func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.RemoveParticipantResponse, err error) {
|
||||
err = s.writeRoomMessage(ctx, req.Room, req.Identity, &livekit.RTCNodeMessage{
|
||||
err = s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_RemoveParticipant{
|
||||
RemoveParticipant: req,
|
||||
},
|
||||
@@ -123,11 +123,11 @@ func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomPa
|
||||
}
|
||||
|
||||
func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (res *livekit.MuteRoomTrackResponse, err error) {
|
||||
if err = EnsureAdminPermission(ctx, req.Room); err != nil {
|
||||
if err = EnsureAdminPermission(ctx, livekit.RoomName(req.Room)); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -139,7 +139,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
|
||||
return nil, twirp.NotFoundError(ErrTrackNotFound.Error())
|
||||
}
|
||||
|
||||
err = s.writeParticipantMessage(ctx, req.Room, req.Identity, &livekit.RTCNodeMessage{
|
||||
err = s.writeParticipantMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_MuteTrack{
|
||||
MuteTrack: req,
|
||||
},
|
||||
@@ -157,7 +157,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
|
||||
}
|
||||
|
||||
func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error) {
|
||||
err := s.writeRoomMessage(ctx, req.Room, req.Identity, &livekit.RTCNodeMessage{
|
||||
err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_UpdateParticipant{
|
||||
UpdateParticipant: req,
|
||||
},
|
||||
@@ -166,7 +166,7 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
|
||||
return nil, err
|
||||
}
|
||||
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -176,7 +176,7 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
|
||||
}
|
||||
|
||||
func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.UpdateSubscriptionsRequest) (*livekit.UpdateSubscriptionsResponse, error) {
|
||||
err := s.writeRoomMessage(ctx, req.Room, req.Identity, &livekit.RTCNodeMessage{
|
||||
err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_UpdateSubscriptions{
|
||||
UpdateSubscriptions: req,
|
||||
},
|
||||
@@ -189,7 +189,7 @@ func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.Upda
|
||||
}
|
||||
|
||||
func (s *RoomService) SendData(ctx context.Context, req *livekit.SendDataRequest) (*livekit.SendDataResponse, error) {
|
||||
err := s.writeRoomMessage(ctx, req.Room, "", &livekit.RTCNodeMessage{
|
||||
err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), "", &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_SendData{
|
||||
SendData: req,
|
||||
},
|
||||
@@ -202,18 +202,18 @@ func (s *RoomService) SendData(ctx context.Context, req *livekit.SendDataRequest
|
||||
}
|
||||
|
||||
func (s *RoomService) UpdateRoomMetadata(ctx context.Context, req *livekit.UpdateRoomMetadataRequest) (*livekit.Room, error) {
|
||||
if err := EnsureAdminPermission(ctx, req.Room); err != nil {
|
||||
if err := EnsureAdminPermission(ctx, livekit.RoomName(req.Room)); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
room, err := s.roomStore.LoadRoom(ctx, req.Room)
|
||||
room, err := s.roomStore.LoadRoom(ctx, livekit.RoomName(req.Room))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
room.Metadata = req.Metadata
|
||||
|
||||
err = s.writeRoomMessage(ctx, req.Room, "", &livekit.RTCNodeMessage{
|
||||
err = s.writeRoomMessage(ctx, livekit.RoomName(req.Room), "", &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_UpdateRoomMetadata{
|
||||
UpdateRoomMetadata: req,
|
||||
},
|
||||
|
||||
@@ -57,7 +57,7 @@ func (s *RTCService) Validate(w http.ResponseWriter, r *http.Request) {
|
||||
_, _ = w.Write([]byte("success"))
|
||||
}
|
||||
|
||||
func (s *RTCService) validate(r *http.Request) (string, routing.ParticipantInit, int, error) {
|
||||
func (s *RTCService) validate(r *http.Request) (livekit.RoomName, routing.ParticipantInit, int, error) {
|
||||
claims := GetGrants(r.Context())
|
||||
// require a claim
|
||||
if claims == nil || claims.Video == nil {
|
||||
@@ -69,7 +69,7 @@ func (s *RTCService) validate(r *http.Request) (string, routing.ParticipantInit,
|
||||
return "", routing.ParticipantInit{}, http.StatusUnauthorized, err
|
||||
}
|
||||
|
||||
roomName := r.FormValue("room")
|
||||
roomName := livekit.RoomName(r.FormValue("room"))
|
||||
reconnectParam := r.FormValue("reconnect")
|
||||
autoSubParam := r.FormValue("auto_subscribe")
|
||||
publishParam := r.FormValue("publish")
|
||||
@@ -130,7 +130,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// create room if it doesn't exist, also assigns an RTC node for the room
|
||||
rm, err := s.roomAllocator.CreateRoom(r.Context(), &livekit.CreateRoomRequest{Name: roomName})
|
||||
rm, err := s.roomAllocator.CreateRoom(r.Context(), &livekit.CreateRoomRequest{Name: string(roomName)})
|
||||
if err != nil {
|
||||
prometheus.ServiceOperationCounter.WithLabelValues("signal_ws", "error", "create_room").Add(1)
|
||||
handleError(w, http.StatusInternalServerError, err.Error())
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
)
|
||||
|
||||
type FakeRoomStore struct {
|
||||
DeleteParticipantStub func(context.Context, string, string) error
|
||||
DeleteParticipantStub func(context.Context, livekit.RoomName, string) error
|
||||
deleteParticipantMutex sync.RWMutex
|
||||
deleteParticipantArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}
|
||||
deleteParticipantReturns struct {
|
||||
@@ -24,11 +24,11 @@ type FakeRoomStore struct {
|
||||
deleteParticipantReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
DeleteRoomStub func(context.Context, string) error
|
||||
DeleteRoomStub func(context.Context, livekit.RoomName) error
|
||||
deleteRoomMutex sync.RWMutex
|
||||
deleteRoomArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}
|
||||
deleteRoomReturns struct {
|
||||
result1 error
|
||||
@@ -36,11 +36,11 @@ type FakeRoomStore struct {
|
||||
deleteRoomReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
ListParticipantsStub func(context.Context, string) ([]*livekit.ParticipantInfo, error)
|
||||
ListParticipantsStub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)
|
||||
listParticipantsMutex sync.RWMutex
|
||||
listParticipantsArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}
|
||||
listParticipantsReturns struct {
|
||||
result1 []*livekit.ParticipantInfo
|
||||
@@ -50,11 +50,11 @@ type FakeRoomStore struct {
|
||||
result1 []*livekit.ParticipantInfo
|
||||
result2 error
|
||||
}
|
||||
ListRoomsStub func(context.Context, []string) ([]*livekit.Room, error)
|
||||
ListRoomsStub func(context.Context, []livekit.RoomName) ([]*livekit.Room, error)
|
||||
listRoomsMutex sync.RWMutex
|
||||
listRoomsArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 []string
|
||||
arg2 []livekit.RoomName
|
||||
}
|
||||
listRoomsReturns struct {
|
||||
result1 []*livekit.Room
|
||||
@@ -64,11 +64,11 @@ type FakeRoomStore struct {
|
||||
result1 []*livekit.Room
|
||||
result2 error
|
||||
}
|
||||
LoadParticipantStub func(context.Context, string, string) (*livekit.ParticipantInfo, error)
|
||||
LoadParticipantStub func(context.Context, livekit.RoomName, string) (*livekit.ParticipantInfo, error)
|
||||
loadParticipantMutex sync.RWMutex
|
||||
loadParticipantArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}
|
||||
loadParticipantReturns struct {
|
||||
@@ -79,11 +79,11 @@ type FakeRoomStore struct {
|
||||
result1 *livekit.ParticipantInfo
|
||||
result2 error
|
||||
}
|
||||
LoadRoomStub func(context.Context, string) (*livekit.Room, error)
|
||||
LoadRoomStub func(context.Context, livekit.RoomName) (*livekit.Room, error)
|
||||
loadRoomMutex sync.RWMutex
|
||||
loadRoomArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}
|
||||
loadRoomReturns struct {
|
||||
result1 *livekit.Room
|
||||
@@ -93,11 +93,11 @@ type FakeRoomStore struct {
|
||||
result1 *livekit.Room
|
||||
result2 error
|
||||
}
|
||||
LockRoomStub func(context.Context, string, time.Duration) (string, error)
|
||||
LockRoomStub func(context.Context, livekit.RoomName, time.Duration) (string, error)
|
||||
lockRoomMutex sync.RWMutex
|
||||
lockRoomArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 time.Duration
|
||||
}
|
||||
lockRoomReturns struct {
|
||||
@@ -108,11 +108,11 @@ type FakeRoomStore struct {
|
||||
result1 string
|
||||
result2 error
|
||||
}
|
||||
StoreParticipantStub func(context.Context, string, *livekit.ParticipantInfo) error
|
||||
StoreParticipantStub func(context.Context, livekit.RoomName, *livekit.ParticipantInfo) error
|
||||
storeParticipantMutex sync.RWMutex
|
||||
storeParticipantArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 *livekit.ParticipantInfo
|
||||
}
|
||||
storeParticipantReturns struct {
|
||||
@@ -133,11 +133,11 @@ type FakeRoomStore struct {
|
||||
storeRoomReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
UnlockRoomStub func(context.Context, string, string) error
|
||||
UnlockRoomStub func(context.Context, livekit.RoomName, string) error
|
||||
unlockRoomMutex sync.RWMutex
|
||||
unlockRoomArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}
|
||||
unlockRoomReturns struct {
|
||||
@@ -150,12 +150,12 @@ type FakeRoomStore struct {
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipant(arg1 context.Context, arg2 string, arg3 string) error {
|
||||
func (fake *FakeRoomStore) DeleteParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 string) error {
|
||||
fake.deleteParticipantMutex.Lock()
|
||||
ret, specificReturn := fake.deleteParticipantReturnsOnCall[len(fake.deleteParticipantArgsForCall)]
|
||||
fake.deleteParticipantArgsForCall = append(fake.deleteParticipantArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.DeleteParticipantStub
|
||||
@@ -177,13 +177,13 @@ func (fake *FakeRoomStore) DeleteParticipantCallCount() int {
|
||||
return len(fake.deleteParticipantArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipantCalls(stub func(context.Context, string, string) error) {
|
||||
func (fake *FakeRoomStore) DeleteParticipantCalls(stub func(context.Context, livekit.RoomName, string) error) {
|
||||
fake.deleteParticipantMutex.Lock()
|
||||
defer fake.deleteParticipantMutex.Unlock()
|
||||
fake.DeleteParticipantStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipantArgsForCall(i int) (context.Context, string, string) {
|
||||
func (fake *FakeRoomStore) DeleteParticipantArgsForCall(i int) (context.Context, livekit.RoomName, string) {
|
||||
fake.deleteParticipantMutex.RLock()
|
||||
defer fake.deleteParticipantMutex.RUnlock()
|
||||
argsForCall := fake.deleteParticipantArgsForCall[i]
|
||||
@@ -213,12 +213,12 @@ func (fake *FakeRoomStore) DeleteParticipantReturnsOnCall(i int, result1 error)
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoom(arg1 context.Context, arg2 string) error {
|
||||
func (fake *FakeRoomStore) DeleteRoom(arg1 context.Context, arg2 livekit.RoomName) error {
|
||||
fake.deleteRoomMutex.Lock()
|
||||
ret, specificReturn := fake.deleteRoomReturnsOnCall[len(fake.deleteRoomArgsForCall)]
|
||||
fake.deleteRoomArgsForCall = append(fake.deleteRoomArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}{arg1, arg2})
|
||||
stub := fake.DeleteRoomStub
|
||||
fakeReturns := fake.deleteRoomReturns
|
||||
@@ -239,13 +239,13 @@ func (fake *FakeRoomStore) DeleteRoomCallCount() int {
|
||||
return len(fake.deleteRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoomCalls(stub func(context.Context, string) error) {
|
||||
func (fake *FakeRoomStore) DeleteRoomCalls(stub func(context.Context, livekit.RoomName) error) {
|
||||
fake.deleteRoomMutex.Lock()
|
||||
defer fake.deleteRoomMutex.Unlock()
|
||||
fake.DeleteRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoomArgsForCall(i int) (context.Context, string) {
|
||||
func (fake *FakeRoomStore) DeleteRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.deleteRoomMutex.RLock()
|
||||
defer fake.deleteRoomMutex.RUnlock()
|
||||
argsForCall := fake.deleteRoomArgsForCall[i]
|
||||
@@ -275,12 +275,12 @@ func (fake *FakeRoomStore) DeleteRoomReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipants(arg1 context.Context, arg2 string) ([]*livekit.ParticipantInfo, error) {
|
||||
func (fake *FakeRoomStore) ListParticipants(arg1 context.Context, arg2 livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
ret, specificReturn := fake.listParticipantsReturnsOnCall[len(fake.listParticipantsArgsForCall)]
|
||||
fake.listParticipantsArgsForCall = append(fake.listParticipantsArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}{arg1, arg2})
|
||||
stub := fake.ListParticipantsStub
|
||||
fakeReturns := fake.listParticipantsReturns
|
||||
@@ -301,13 +301,13 @@ func (fake *FakeRoomStore) ListParticipantsCallCount() int {
|
||||
return len(fake.listParticipantsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipantsCalls(stub func(context.Context, string) ([]*livekit.ParticipantInfo, error)) {
|
||||
func (fake *FakeRoomStore) ListParticipantsCalls(stub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
defer fake.listParticipantsMutex.Unlock()
|
||||
fake.ListParticipantsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipantsArgsForCall(i int) (context.Context, string) {
|
||||
func (fake *FakeRoomStore) ListParticipantsArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.listParticipantsMutex.RLock()
|
||||
defer fake.listParticipantsMutex.RUnlock()
|
||||
argsForCall := fake.listParticipantsArgsForCall[i]
|
||||
@@ -340,17 +340,17 @@ func (fake *FakeRoomStore) ListParticipantsReturnsOnCall(i int, result1 []*livek
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRooms(arg1 context.Context, arg2 []string) ([]*livekit.Room, error) {
|
||||
var arg2Copy []string
|
||||
func (fake *FakeRoomStore) ListRooms(arg1 context.Context, arg2 []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
var arg2Copy []livekit.RoomName
|
||||
if arg2 != nil {
|
||||
arg2Copy = make([]string, len(arg2))
|
||||
arg2Copy = make([]livekit.RoomName, len(arg2))
|
||||
copy(arg2Copy, arg2)
|
||||
}
|
||||
fake.listRoomsMutex.Lock()
|
||||
ret, specificReturn := fake.listRoomsReturnsOnCall[len(fake.listRoomsArgsForCall)]
|
||||
fake.listRoomsArgsForCall = append(fake.listRoomsArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 []string
|
||||
arg2 []livekit.RoomName
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.ListRoomsStub
|
||||
fakeReturns := fake.listRoomsReturns
|
||||
@@ -371,13 +371,13 @@ func (fake *FakeRoomStore) ListRoomsCallCount() int {
|
||||
return len(fake.listRoomsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRoomsCalls(stub func(context.Context, []string) ([]*livekit.Room, error)) {
|
||||
func (fake *FakeRoomStore) ListRoomsCalls(stub func(context.Context, []livekit.RoomName) ([]*livekit.Room, error)) {
|
||||
fake.listRoomsMutex.Lock()
|
||||
defer fake.listRoomsMutex.Unlock()
|
||||
fake.ListRoomsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRoomsArgsForCall(i int) (context.Context, []string) {
|
||||
func (fake *FakeRoomStore) ListRoomsArgsForCall(i int) (context.Context, []livekit.RoomName) {
|
||||
fake.listRoomsMutex.RLock()
|
||||
defer fake.listRoomsMutex.RUnlock()
|
||||
argsForCall := fake.listRoomsArgsForCall[i]
|
||||
@@ -410,12 +410,12 @@ func (fake *FakeRoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Room
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipant(arg1 context.Context, arg2 string, arg3 string) (*livekit.ParticipantInfo, error) {
|
||||
func (fake *FakeRoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 string) (*livekit.ParticipantInfo, error) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
ret, specificReturn := fake.loadParticipantReturnsOnCall[len(fake.loadParticipantArgsForCall)]
|
||||
fake.loadParticipantArgsForCall = append(fake.loadParticipantArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.LoadParticipantStub
|
||||
@@ -437,13 +437,13 @@ func (fake *FakeRoomStore) LoadParticipantCallCount() int {
|
||||
return len(fake.loadParticipantArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipantCalls(stub func(context.Context, string, string) (*livekit.ParticipantInfo, error)) {
|
||||
func (fake *FakeRoomStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, string) (*livekit.ParticipantInfo, error)) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
defer fake.loadParticipantMutex.Unlock()
|
||||
fake.LoadParticipantStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipantArgsForCall(i int) (context.Context, string, string) {
|
||||
func (fake *FakeRoomStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, string) {
|
||||
fake.loadParticipantMutex.RLock()
|
||||
defer fake.loadParticipantMutex.RUnlock()
|
||||
argsForCall := fake.loadParticipantArgsForCall[i]
|
||||
@@ -476,12 +476,12 @@ func (fake *FakeRoomStore) LoadParticipantReturnsOnCall(i int, result1 *livekit.
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoom(arg1 context.Context, arg2 string) (*livekit.Room, error) {
|
||||
func (fake *FakeRoomStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomName) (*livekit.Room, error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
ret, specificReturn := fake.loadRoomReturnsOnCall[len(fake.loadRoomArgsForCall)]
|
||||
fake.loadRoomArgsForCall = append(fake.loadRoomArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}{arg1, arg2})
|
||||
stub := fake.LoadRoomStub
|
||||
fakeReturns := fake.loadRoomReturns
|
||||
@@ -502,13 +502,13 @@ func (fake *FakeRoomStore) LoadRoomCallCount() int {
|
||||
return len(fake.loadRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoomCalls(stub func(context.Context, string) (*livekit.Room, error)) {
|
||||
func (fake *FakeRoomStore) LoadRoomCalls(stub func(context.Context, livekit.RoomName) (*livekit.Room, error)) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoomArgsForCall(i int) (context.Context, string) {
|
||||
func (fake *FakeRoomStore) LoadRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
argsForCall := fake.loadRoomArgsForCall[i]
|
||||
@@ -541,12 +541,12 @@ func (fake *FakeRoomStore) LoadRoomReturnsOnCall(i int, result1 *livekit.Room, r
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoom(arg1 context.Context, arg2 string, arg3 time.Duration) (string, error) {
|
||||
func (fake *FakeRoomStore) LockRoom(arg1 context.Context, arg2 livekit.RoomName, arg3 time.Duration) (string, error) {
|
||||
fake.lockRoomMutex.Lock()
|
||||
ret, specificReturn := fake.lockRoomReturnsOnCall[len(fake.lockRoomArgsForCall)]
|
||||
fake.lockRoomArgsForCall = append(fake.lockRoomArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 time.Duration
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.LockRoomStub
|
||||
@@ -568,13 +568,13 @@ func (fake *FakeRoomStore) LockRoomCallCount() int {
|
||||
return len(fake.lockRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoomCalls(stub func(context.Context, string, time.Duration) (string, error)) {
|
||||
func (fake *FakeRoomStore) LockRoomCalls(stub func(context.Context, livekit.RoomName, time.Duration) (string, error)) {
|
||||
fake.lockRoomMutex.Lock()
|
||||
defer fake.lockRoomMutex.Unlock()
|
||||
fake.LockRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoomArgsForCall(i int) (context.Context, string, time.Duration) {
|
||||
func (fake *FakeRoomStore) LockRoomArgsForCall(i int) (context.Context, livekit.RoomName, time.Duration) {
|
||||
fake.lockRoomMutex.RLock()
|
||||
defer fake.lockRoomMutex.RUnlock()
|
||||
argsForCall := fake.lockRoomArgsForCall[i]
|
||||
@@ -607,12 +607,12 @@ func (fake *FakeRoomStore) LockRoomReturnsOnCall(i int, result1 string, result2
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipant(arg1 context.Context, arg2 string, arg3 *livekit.ParticipantInfo) error {
|
||||
func (fake *FakeRoomStore) StoreParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 *livekit.ParticipantInfo) error {
|
||||
fake.storeParticipantMutex.Lock()
|
||||
ret, specificReturn := fake.storeParticipantReturnsOnCall[len(fake.storeParticipantArgsForCall)]
|
||||
fake.storeParticipantArgsForCall = append(fake.storeParticipantArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 *livekit.ParticipantInfo
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.StoreParticipantStub
|
||||
@@ -634,13 +634,13 @@ func (fake *FakeRoomStore) StoreParticipantCallCount() int {
|
||||
return len(fake.storeParticipantArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipantCalls(stub func(context.Context, string, *livekit.ParticipantInfo) error) {
|
||||
func (fake *FakeRoomStore) StoreParticipantCalls(stub func(context.Context, livekit.RoomName, *livekit.ParticipantInfo) error) {
|
||||
fake.storeParticipantMutex.Lock()
|
||||
defer fake.storeParticipantMutex.Unlock()
|
||||
fake.StoreParticipantStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipantArgsForCall(i int) (context.Context, string, *livekit.ParticipantInfo) {
|
||||
func (fake *FakeRoomStore) StoreParticipantArgsForCall(i int) (context.Context, livekit.RoomName, *livekit.ParticipantInfo) {
|
||||
fake.storeParticipantMutex.RLock()
|
||||
defer fake.storeParticipantMutex.RUnlock()
|
||||
argsForCall := fake.storeParticipantArgsForCall[i]
|
||||
@@ -732,12 +732,12 @@ func (fake *FakeRoomStore) StoreRoomReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoom(arg1 context.Context, arg2 string, arg3 string) error {
|
||||
func (fake *FakeRoomStore) UnlockRoom(arg1 context.Context, arg2 livekit.RoomName, arg3 string) error {
|
||||
fake.unlockRoomMutex.Lock()
|
||||
ret, specificReturn := fake.unlockRoomReturnsOnCall[len(fake.unlockRoomArgsForCall)]
|
||||
fake.unlockRoomArgsForCall = append(fake.unlockRoomArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.UnlockRoomStub
|
||||
@@ -759,13 +759,13 @@ func (fake *FakeRoomStore) UnlockRoomCallCount() int {
|
||||
return len(fake.unlockRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoomCalls(stub func(context.Context, string, string) error) {
|
||||
func (fake *FakeRoomStore) UnlockRoomCalls(stub func(context.Context, livekit.RoomName, string) error) {
|
||||
fake.unlockRoomMutex.Lock()
|
||||
defer fake.unlockRoomMutex.Unlock()
|
||||
fake.UnlockRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoomArgsForCall(i int) (context.Context, string, string) {
|
||||
func (fake *FakeRoomStore) UnlockRoomArgsForCall(i int) (context.Context, livekit.RoomName, string) {
|
||||
fake.unlockRoomMutex.RLock()
|
||||
defer fake.unlockRoomMutex.RUnlock()
|
||||
argsForCall := fake.unlockRoomArgsForCall[i]
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
)
|
||||
|
||||
type FakeRORoomStore struct {
|
||||
ListParticipantsStub func(context.Context, string) ([]*livekit.ParticipantInfo, error)
|
||||
ListParticipantsStub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)
|
||||
listParticipantsMutex sync.RWMutex
|
||||
listParticipantsArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}
|
||||
listParticipantsReturns struct {
|
||||
result1 []*livekit.ParticipantInfo
|
||||
@@ -24,11 +24,11 @@ type FakeRORoomStore struct {
|
||||
result1 []*livekit.ParticipantInfo
|
||||
result2 error
|
||||
}
|
||||
ListRoomsStub func(context.Context, []string) ([]*livekit.Room, error)
|
||||
ListRoomsStub func(context.Context, []livekit.RoomName) ([]*livekit.Room, error)
|
||||
listRoomsMutex sync.RWMutex
|
||||
listRoomsArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 []string
|
||||
arg2 []livekit.RoomName
|
||||
}
|
||||
listRoomsReturns struct {
|
||||
result1 []*livekit.Room
|
||||
@@ -38,11 +38,11 @@ type FakeRORoomStore struct {
|
||||
result1 []*livekit.Room
|
||||
result2 error
|
||||
}
|
||||
LoadParticipantStub func(context.Context, string, string) (*livekit.ParticipantInfo, error)
|
||||
LoadParticipantStub func(context.Context, livekit.RoomName, string) (*livekit.ParticipantInfo, error)
|
||||
loadParticipantMutex sync.RWMutex
|
||||
loadParticipantArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}
|
||||
loadParticipantReturns struct {
|
||||
@@ -53,11 +53,11 @@ type FakeRORoomStore struct {
|
||||
result1 *livekit.ParticipantInfo
|
||||
result2 error
|
||||
}
|
||||
LoadRoomStub func(context.Context, string) (*livekit.Room, error)
|
||||
LoadRoomStub func(context.Context, livekit.RoomName) (*livekit.Room, error)
|
||||
loadRoomMutex sync.RWMutex
|
||||
loadRoomArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}
|
||||
loadRoomReturns struct {
|
||||
result1 *livekit.Room
|
||||
@@ -71,12 +71,12 @@ type FakeRORoomStore struct {
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipants(arg1 context.Context, arg2 string) ([]*livekit.ParticipantInfo, error) {
|
||||
func (fake *FakeRORoomStore) ListParticipants(arg1 context.Context, arg2 livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
ret, specificReturn := fake.listParticipantsReturnsOnCall[len(fake.listParticipantsArgsForCall)]
|
||||
fake.listParticipantsArgsForCall = append(fake.listParticipantsArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}{arg1, arg2})
|
||||
stub := fake.ListParticipantsStub
|
||||
fakeReturns := fake.listParticipantsReturns
|
||||
@@ -97,13 +97,13 @@ func (fake *FakeRORoomStore) ListParticipantsCallCount() int {
|
||||
return len(fake.listParticipantsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipantsCalls(stub func(context.Context, string) ([]*livekit.ParticipantInfo, error)) {
|
||||
func (fake *FakeRORoomStore) ListParticipantsCalls(stub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
defer fake.listParticipantsMutex.Unlock()
|
||||
fake.ListParticipantsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipantsArgsForCall(i int) (context.Context, string) {
|
||||
func (fake *FakeRORoomStore) ListParticipantsArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.listParticipantsMutex.RLock()
|
||||
defer fake.listParticipantsMutex.RUnlock()
|
||||
argsForCall := fake.listParticipantsArgsForCall[i]
|
||||
@@ -136,17 +136,17 @@ func (fake *FakeRORoomStore) ListParticipantsReturnsOnCall(i int, result1 []*liv
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRooms(arg1 context.Context, arg2 []string) ([]*livekit.Room, error) {
|
||||
var arg2Copy []string
|
||||
func (fake *FakeRORoomStore) ListRooms(arg1 context.Context, arg2 []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
var arg2Copy []livekit.RoomName
|
||||
if arg2 != nil {
|
||||
arg2Copy = make([]string, len(arg2))
|
||||
arg2Copy = make([]livekit.RoomName, len(arg2))
|
||||
copy(arg2Copy, arg2)
|
||||
}
|
||||
fake.listRoomsMutex.Lock()
|
||||
ret, specificReturn := fake.listRoomsReturnsOnCall[len(fake.listRoomsArgsForCall)]
|
||||
fake.listRoomsArgsForCall = append(fake.listRoomsArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 []string
|
||||
arg2 []livekit.RoomName
|
||||
}{arg1, arg2Copy})
|
||||
stub := fake.ListRoomsStub
|
||||
fakeReturns := fake.listRoomsReturns
|
||||
@@ -167,13 +167,13 @@ func (fake *FakeRORoomStore) ListRoomsCallCount() int {
|
||||
return len(fake.listRoomsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRoomsCalls(stub func(context.Context, []string) ([]*livekit.Room, error)) {
|
||||
func (fake *FakeRORoomStore) ListRoomsCalls(stub func(context.Context, []livekit.RoomName) ([]*livekit.Room, error)) {
|
||||
fake.listRoomsMutex.Lock()
|
||||
defer fake.listRoomsMutex.Unlock()
|
||||
fake.ListRoomsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRoomsArgsForCall(i int) (context.Context, []string) {
|
||||
func (fake *FakeRORoomStore) ListRoomsArgsForCall(i int) (context.Context, []livekit.RoomName) {
|
||||
fake.listRoomsMutex.RLock()
|
||||
defer fake.listRoomsMutex.RUnlock()
|
||||
argsForCall := fake.listRoomsArgsForCall[i]
|
||||
@@ -206,12 +206,12 @@ func (fake *FakeRORoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Ro
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipant(arg1 context.Context, arg2 string, arg3 string) (*livekit.ParticipantInfo, error) {
|
||||
func (fake *FakeRORoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 string) (*livekit.ParticipantInfo, error) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
ret, specificReturn := fake.loadParticipantReturnsOnCall[len(fake.loadParticipantArgsForCall)]
|
||||
fake.loadParticipantArgsForCall = append(fake.loadParticipantArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
arg3 string
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.LoadParticipantStub
|
||||
@@ -233,13 +233,13 @@ func (fake *FakeRORoomStore) LoadParticipantCallCount() int {
|
||||
return len(fake.loadParticipantArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipantCalls(stub func(context.Context, string, string) (*livekit.ParticipantInfo, error)) {
|
||||
func (fake *FakeRORoomStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, string) (*livekit.ParticipantInfo, error)) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
defer fake.loadParticipantMutex.Unlock()
|
||||
fake.LoadParticipantStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipantArgsForCall(i int) (context.Context, string, string) {
|
||||
func (fake *FakeRORoomStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, string) {
|
||||
fake.loadParticipantMutex.RLock()
|
||||
defer fake.loadParticipantMutex.RUnlock()
|
||||
argsForCall := fake.loadParticipantArgsForCall[i]
|
||||
@@ -272,12 +272,12 @@ func (fake *FakeRORoomStore) LoadParticipantReturnsOnCall(i int, result1 *liveki
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoom(arg1 context.Context, arg2 string) (*livekit.Room, error) {
|
||||
func (fake *FakeRORoomStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomName) (*livekit.Room, error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
ret, specificReturn := fake.loadRoomReturnsOnCall[len(fake.loadRoomArgsForCall)]
|
||||
fake.loadRoomArgsForCall = append(fake.loadRoomArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
arg2 livekit.RoomName
|
||||
}{arg1, arg2})
|
||||
stub := fake.LoadRoomStub
|
||||
fakeReturns := fake.loadRoomReturns
|
||||
@@ -298,13 +298,13 @@ func (fake *FakeRORoomStore) LoadRoomCallCount() int {
|
||||
return len(fake.loadRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoomCalls(stub func(context.Context, string) (*livekit.Room, error)) {
|
||||
func (fake *FakeRORoomStore) LoadRoomCalls(stub func(context.Context, livekit.RoomName) (*livekit.Room, error)) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoomArgsForCall(i int) (context.Context, string) {
|
||||
func (fake *FakeRORoomStore) LoadRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
argsForCall := fake.loadRoomArgsForCall[i]
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import (
|
||||
"net"
|
||||
"strconv"
|
||||
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
"github.com/pion/turn/v2"
|
||||
"github.com/pkg/errors"
|
||||
@@ -111,7 +112,7 @@ func NewTurnServer(conf *config.Config, authHandler turn.AuthHandler) (*turn.Ser
|
||||
func newTurnAuthHandler(roomStore RoomStore) turn.AuthHandler {
|
||||
return func(username, realm string, srcAddr net.Addr) (key []byte, ok bool) {
|
||||
// room id should be the username, create a hashed room id
|
||||
rm, err := roomStore.LoadRoom(context.Background(), username)
|
||||
rm, err := roomStore.LoadRoom(context.Background(), livekit.RoomName(username))
|
||||
if err != nil {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ func (s *StatsWorker) getOrCreateOutgoingStatsIfEmpty(trackID livekit.TrackID) *
|
||||
Kind: livekit.StreamType_DOWNSTREAM,
|
||||
RoomId: s.roomID,
|
||||
ParticipantId: s.participantID,
|
||||
RoomName: s.roomName,
|
||||
RoomName: string(s.roomName),
|
||||
}}
|
||||
}
|
||||
return s.outgoingPerTrack[trackID]
|
||||
@@ -78,7 +78,7 @@ func (s *StatsWorker) getOrCreateIncomingStatsIfEmpty(trackID livekit.TrackID) *
|
||||
Kind: livekit.StreamType_UPSTREAM,
|
||||
RoomId: s.roomID,
|
||||
ParticipantId: s.participantID,
|
||||
RoomName: s.roomName,
|
||||
RoomName: string(s.roomName),
|
||||
}}
|
||||
}
|
||||
return s.incomingPerTrack[trackID]
|
||||
@@ -170,7 +170,7 @@ func (s *StatsWorker) update(stats *Stats, ts *timestamppb.Timestamp) *livekit.A
|
||||
Kind: next.Kind,
|
||||
RoomId: s.roomID,
|
||||
ParticipantId: s.participantID,
|
||||
RoomName: s.roomName,
|
||||
RoomName: string(s.roomName),
|
||||
}
|
||||
|
||||
next.TimeStamp = ts
|
||||
|
||||
@@ -46,7 +46,7 @@ func (t *telemetryServiceInternal) RoomEnded(ctx context.Context, room *livekit.
|
||||
|
||||
func (t *telemetryServiceInternal) ParticipantJoined(ctx context.Context, room *livekit.Room,
|
||||
participant *livekit.ParticipantInfo, clientInfo *livekit.ClientInfo) {
|
||||
t.workers[participant.Sid] = newStatsWorker(ctx, t, room.Sid, room.Name, participant.Sid)
|
||||
t.workers[participant.Sid] = newStatsWorker(ctx, t, room.Sid, livekit.RoomName(room.Name), participant.Sid)
|
||||
|
||||
prometheus.AddParticipant()
|
||||
|
||||
@@ -100,13 +100,13 @@ func (t *telemetryServiceInternal) TrackPublished(ctx context.Context, participa
|
||||
RoomId: roomID,
|
||||
ParticipantId: participantID,
|
||||
Track: track,
|
||||
Room: &livekit.Room{Name: roomName},
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryServiceInternal) TrackUnpublished(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo, ssrc uint32) {
|
||||
roomID := ""
|
||||
roomName := ""
|
||||
roomName := livekit.RoomName("")
|
||||
w := t.workers[participantID]
|
||||
if w != nil {
|
||||
roomID = w.roomID
|
||||
@@ -122,7 +122,7 @@ func (t *telemetryServiceInternal) TrackUnpublished(ctx context.Context, partici
|
||||
RoomId: roomID,
|
||||
ParticipantId: participantID,
|
||||
TrackId: track.Sid,
|
||||
Room: &livekit.Room{Name: roomName},
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ func (t *telemetryServiceInternal) TrackSubscribed(ctx context.Context, particip
|
||||
RoomId: roomID,
|
||||
ParticipantId: participantID,
|
||||
TrackId: track.Sid,
|
||||
Room: &livekit.Room{Name: roomName},
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ func (t *telemetryServiceInternal) TrackUnsubscribed(ctx context.Context, partic
|
||||
RoomId: roomID,
|
||||
ParticipantId: participantID,
|
||||
TrackId: track.Sid,
|
||||
Room: &livekit.Room{Name: roomName},
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user