type aliases -> type definitions (#312)

* type alias -> type definition

* participantSid -> participantID in a comment

* Update protocol
This commit is contained in:
Raja Subramanian
2022-01-03 12:43:58 +05:30
committed by GitHub
parent d5c955d11f
commit 995c1e8676
39 changed files with 490 additions and 482 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ require (
github.com/google/wire v0.5.0 github.com/google/wire v0.5.0
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.4.2
github.com/hashicorp/golang-lru v0.5.4 github.com/hashicorp/golang-lru v0.5.4
github.com/livekit/protocol v0.11.8-0.20220102040102-feaea540b8df github.com/livekit/protocol v0.11.8-0.20220103045453-c441eb5f03c8
github.com/magefile/mage v1.11.0 github.com/magefile/mage v1.11.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0 github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-homedir v1.1.0
+2 -2
View File
@@ -132,8 +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/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 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY/mKrcvA=
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts= github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
github.com/livekit/protocol v0.11.8-0.20220102040102-feaea540b8df h1:4cqTGvQXH0Tb104eX2oIM7kUvtbX1JB0rtP0Sjf8Ct8= github.com/livekit/protocol v0.11.8-0.20220103045453-c441eb5f03c8 h1:eo4OOUKLgNguaHEmcItTfk2IzVC2s2r6/WXqFfj5HjE=
github.com/livekit/protocol v0.11.8-0.20220102040102-feaea540b8df/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg= github.com/livekit/protocol v0.11.8-0.20220103045453-c441eb5f03c8/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls= 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/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
+1 -1
View File
@@ -107,7 +107,7 @@ func (r *LocalRouter) StartParticipantSignal(ctx context.Context, roomName livek
// response sink // response sink
resChan, resChan,
) )
return pi.Identity, reqChan, resChan, nil return string(pi.Identity), reqChan, resChan, nil
} }
func (r *LocalRouter) WriteParticipantRTC(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity, msg *livekit.RTCNodeMessage) error { func (r *LocalRouter) WriteParticipantRTC(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity, msg *livekit.RTCNodeMessage) error {
+4 -4
View File
@@ -149,9 +149,9 @@ func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName livek
// sends a message to start session // sends a message to start session
err = sink.WriteMessage(&livekit.StartSession{ err = sink.WriteMessage(&livekit.StartSession{
RoomName: string(roomName), RoomName: string(roomName),
Identity: pi.Identity, Identity: string(pi.Identity),
Metadata: pi.Metadata, Metadata: pi.Metadata,
Name: pi.Name, Name: string(pi.Name),
// connection id is to allow the RTC node to identify where to route the message back to // connection id is to allow the RTC node to identify where to route the message back to
ConnectionId: connectionID, ConnectionId: connectionID,
Reconnect: pi.Reconnect, Reconnect: pi.Reconnect,
@@ -239,9 +239,9 @@ func (r *RedisRouter) startParticipantRTC(ss *livekit.StartSession, participantK
} }
pi := ParticipantInit{ pi := ParticipantInit{
Identity: ss.Identity, Identity: livekit.ParticipantIdentity(ss.Identity),
Metadata: ss.Metadata, Metadata: ss.Metadata,
Name: ss.Name, Name: livekit.ParticipantName(ss.Name),
Reconnect: ss.Reconnect, Reconnect: ss.Reconnect,
Permission: ss.Permission, Permission: ss.Permission,
Client: ss.Client, Client: ss.Client,
+12 -12
View File
@@ -138,12 +138,12 @@ type FakeRouter struct {
unregisterNodeReturnsOnCall map[int]struct { unregisterNodeReturnsOnCall map[int]struct {
result1 error result1 error
} }
WriteParticipantRTCStub func(context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) error WriteParticipantRTCStub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity, *livekit.RTCNodeMessage) error
writeParticipantRTCMutex sync.RWMutex writeParticipantRTCMutex sync.RWMutex
writeParticipantRTCArgsForCall []struct { writeParticipantRTCArgsForCall []struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
arg4 *livekit.RTCNodeMessage arg4 *livekit.RTCNodeMessage
} }
writeParticipantRTCReturns struct { writeParticipantRTCReturns struct {
@@ -152,12 +152,12 @@ type FakeRouter struct {
writeParticipantRTCReturnsOnCall map[int]struct { writeParticipantRTCReturnsOnCall map[int]struct {
result1 error result1 error
} }
WriteRoomRTCStub func(context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) error WriteRoomRTCStub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity, *livekit.RTCNodeMessage) error
writeRoomRTCMutex sync.RWMutex writeRoomRTCMutex sync.RWMutex
writeRoomRTCArgsForCall []struct { writeRoomRTCArgsForCall []struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
arg4 *livekit.RTCNodeMessage arg4 *livekit.RTCNodeMessage
} }
writeRoomRTCReturns struct { writeRoomRTCReturns struct {
@@ -812,13 +812,13 @@ func (fake *FakeRouter) UnregisterNodeReturnsOnCall(i int, result1 error) {
}{result1} }{result1}
} }
func (fake *FakeRouter) WriteParticipantRTC(arg1 context.Context, arg2 livekit.RoomName, arg3 string, arg4 *livekit.RTCNodeMessage) error { func (fake *FakeRouter) WriteParticipantRTC(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity, arg4 *livekit.RTCNodeMessage) error {
fake.writeParticipantRTCMutex.Lock() fake.writeParticipantRTCMutex.Lock()
ret, specificReturn := fake.writeParticipantRTCReturnsOnCall[len(fake.writeParticipantRTCArgsForCall)] ret, specificReturn := fake.writeParticipantRTCReturnsOnCall[len(fake.writeParticipantRTCArgsForCall)]
fake.writeParticipantRTCArgsForCall = append(fake.writeParticipantRTCArgsForCall, struct { fake.writeParticipantRTCArgsForCall = append(fake.writeParticipantRTCArgsForCall, struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
arg4 *livekit.RTCNodeMessage arg4 *livekit.RTCNodeMessage
}{arg1, arg2, arg3, arg4}) }{arg1, arg2, arg3, arg4})
stub := fake.WriteParticipantRTCStub stub := fake.WriteParticipantRTCStub
@@ -840,13 +840,13 @@ func (fake *FakeRouter) WriteParticipantRTCCallCount() int {
return len(fake.writeParticipantRTCArgsForCall) return len(fake.writeParticipantRTCArgsForCall)
} }
func (fake *FakeRouter) WriteParticipantRTCCalls(stub func(context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) error) { func (fake *FakeRouter) WriteParticipantRTCCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity, *livekit.RTCNodeMessage) error) {
fake.writeParticipantRTCMutex.Lock() fake.writeParticipantRTCMutex.Lock()
defer fake.writeParticipantRTCMutex.Unlock() defer fake.writeParticipantRTCMutex.Unlock()
fake.WriteParticipantRTCStub = stub fake.WriteParticipantRTCStub = stub
} }
func (fake *FakeRouter) WriteParticipantRTCArgsForCall(i int) (context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) { func (fake *FakeRouter) WriteParticipantRTCArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity, *livekit.RTCNodeMessage) {
fake.writeParticipantRTCMutex.RLock() fake.writeParticipantRTCMutex.RLock()
defer fake.writeParticipantRTCMutex.RUnlock() defer fake.writeParticipantRTCMutex.RUnlock()
argsForCall := fake.writeParticipantRTCArgsForCall[i] argsForCall := fake.writeParticipantRTCArgsForCall[i]
@@ -876,13 +876,13 @@ func (fake *FakeRouter) WriteParticipantRTCReturnsOnCall(i int, result1 error) {
}{result1} }{result1}
} }
func (fake *FakeRouter) WriteRoomRTC(arg1 context.Context, arg2 livekit.RoomName, arg3 string, arg4 *livekit.RTCNodeMessage) error { func (fake *FakeRouter) WriteRoomRTC(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity, arg4 *livekit.RTCNodeMessage) error {
fake.writeRoomRTCMutex.Lock() fake.writeRoomRTCMutex.Lock()
ret, specificReturn := fake.writeRoomRTCReturnsOnCall[len(fake.writeRoomRTCArgsForCall)] ret, specificReturn := fake.writeRoomRTCReturnsOnCall[len(fake.writeRoomRTCArgsForCall)]
fake.writeRoomRTCArgsForCall = append(fake.writeRoomRTCArgsForCall, struct { fake.writeRoomRTCArgsForCall = append(fake.writeRoomRTCArgsForCall, struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
arg4 *livekit.RTCNodeMessage arg4 *livekit.RTCNodeMessage
}{arg1, arg2, arg3, arg4}) }{arg1, arg2, arg3, arg4})
stub := fake.WriteRoomRTCStub stub := fake.WriteRoomRTCStub
@@ -904,13 +904,13 @@ func (fake *FakeRouter) WriteRoomRTCCallCount() int {
return len(fake.writeRoomRTCArgsForCall) return len(fake.writeRoomRTCArgsForCall)
} }
func (fake *FakeRouter) WriteRoomRTCCalls(stub func(context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) error) { func (fake *FakeRouter) WriteRoomRTCCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity, *livekit.RTCNodeMessage) error) {
fake.writeRoomRTCMutex.Lock() fake.writeRoomRTCMutex.Lock()
defer fake.writeRoomRTCMutex.Unlock() defer fake.writeRoomRTCMutex.Unlock()
fake.WriteRoomRTCStub = stub fake.WriteRoomRTCStub = stub
} }
func (fake *FakeRouter) WriteRoomRTCArgsForCall(i int) (context.Context, livekit.RoomName, string, *livekit.RTCNodeMessage) { func (fake *FakeRouter) WriteRoomRTCArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity, *livekit.RTCNodeMessage) {
fake.writeRoomRTCMutex.RLock() fake.writeRoomRTCMutex.RLock()
defer fake.writeRoomRTCMutex.RUnlock() defer fake.writeRoomRTCMutex.RUnlock()
argsForCall := fake.writeRoomRTCArgsForCall[i] argsForCall := fake.writeRoomRTCArgsForCall[i]
+2 -2
View File
@@ -8,7 +8,7 @@ import (
) )
func participantKey(roomName livekit.RoomName, identity livekit.ParticipantIdentity) string { func participantKey(roomName livekit.RoomName, identity livekit.ParticipantIdentity) string {
return string(roomName) + "|" + identity return string(roomName) + "|" + string(identity)
} }
func parseParticipantKey(pkey string) (roomName livekit.RoomName, identity livekit.ParticipantIdentity, err error) { 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
} }
return livekit.RoomName(parts[0]), parts[1], nil return livekit.RoomName(parts[0]), livekit.ParticipantIdentity(parts[1]), nil
} }
+2 -2
View File
@@ -10,7 +10,7 @@ import (
func newMockParticipant(identity livekit.ParticipantIdentity, protocol types.ProtocolVersion, hidden bool) *typesfakes.FakeParticipant { func newMockParticipant(identity livekit.ParticipantIdentity, protocol types.ProtocolVersion, hidden bool) *typesfakes.FakeParticipant {
p := &typesfakes.FakeParticipant{} p := &typesfakes.FakeParticipant{}
p.IDReturns(utils.NewGuid(utils.ParticipantPrefix)) p.IDReturns(livekit.ParticipantID(utils.NewGuid(utils.ParticipantPrefix)))
p.IdentityReturns(identity) p.IdentityReturns(identity)
p.StateReturns(livekit.ParticipantInfo_JOINED) p.StateReturns(livekit.ParticipantInfo_JOINED)
p.ProtocolVersionReturns(protocol) p.ProtocolVersionReturns(protocol)
@@ -50,7 +50,7 @@ func newMockParticipant(identity livekit.ParticipantIdentity, protocol types.Pro
func newMockTrack(kind livekit.TrackType, name string) *typesfakes.FakePublishedTrack { func newMockTrack(kind livekit.TrackType, name string) *typesfakes.FakePublishedTrack {
t := &typesfakes.FakePublishedTrack{} t := &typesfakes.FakePublishedTrack{}
t.IDReturns(utils.NewGuid(utils.TrackPrefix)) t.IDReturns(livekit.TrackID(utils.NewGuid(utils.TrackPrefix)))
t.KindReturns(kind) t.KindReturns(kind)
t.NameReturns(name) t.NameReturns(name)
return t return t
+4 -4
View File
@@ -47,7 +47,7 @@ type MediaTrack struct {
lock sync.RWMutex lock sync.RWMutex
// map of target participantID -> types.SubscribedTrack // map of target participantID -> types.SubscribedTrack
subscribedTracks sync.Map // participantSid => types.SubscribedTrack subscribedTracks sync.Map // participantID => types.SubscribedTrack
twcc *twcc.Responder twcc *twcc.Responder
audioLevel *AudioLevel audioLevel *AudioLevel
receiver sfu.Receiver receiver sfu.Receiver
@@ -120,7 +120,7 @@ func NewMediaTrack(track *webrtc.TrackRemote, params MediaTrackParams) *MediaTra
} }
func (t *MediaTrack) ID() livekit.TrackID { func (t *MediaTrack) ID() livekit.TrackID {
return t.params.TrackInfo.Sid return livekit.TrackID(t.params.TrackInfo.Sid)
} }
func (t *MediaTrack) SignalCid() string { func (t *MediaTrack) SignalCid() string {
@@ -209,7 +209,7 @@ func (t *MediaTrack) AddSubscriber(sub types.Participant) error {
codec := t.receiver.Codec() codec := t.receiver.Codec()
// using DownTrack from ion-sfu // using DownTrack from ion-sfu
streamId := t.params.ParticipantID streamId := string(t.params.ParticipantID)
if sub.ProtocolVersion().SupportsPackedStreamId() { if sub.ProtocolVersion().SupportsPackedStreamId() {
// when possible, pack both IDs in streamID to allow new streams to be generated // when possible, pack both IDs in streamID to allow new streams to be generated
// react-native-webrtc still uses stream based APIs and require this // react-native-webrtc still uses stream based APIs and require this
@@ -500,7 +500,7 @@ func (t *MediaTrack) RevokeDisallowedSubscribers(allowedSubscriberIDs []livekit.
var revokedSubscriberIDs []livekit.ParticipantID var revokedSubscriberIDs []livekit.ParticipantID
// LK-TODO: large number of subscribers needs to be solved for this loop // LK-TODO: large number of subscribers needs to be solved for this loop
t.subscribedTracks.Range(func(key interface{}, val interface{}) bool { t.subscribedTracks.Range(func(key interface{}, val interface{}) bool {
if subID, ok := key.(string); ok { if subID, ok := key.(livekit.ParticipantID); ok {
found := false found := false
for _, allowedID := range allowedSubscriberIDs { for _, allowedID := range allowedSubscriberIDs {
if subID == allowedID { if subID == allowedID {
+9 -9
View File
@@ -28,7 +28,7 @@ func TestTrackInfo(t *testing.T) {
require.Equal(t, ti.Muted, outInfo.Muted) require.Equal(t, ti.Muted, outInfo.Muted)
require.Equal(t, ti.Name, outInfo.Name) require.Equal(t, ti.Name, outInfo.Name)
require.Equal(t, ti.Name, mt.Name()) require.Equal(t, ti.Name, mt.Name())
require.Equal(t, ti.Sid, mt.ID()) require.Equal(t, livekit.TrackID(ti.Sid), mt.ID())
require.Equal(t, ti.Type, outInfo.Type) require.Equal(t, ti.Type, outInfo.Type)
require.Equal(t, ti.Type, mt.Kind()) require.Equal(t, ti.Type, mt.Kind())
require.Equal(t, ti.Source, outInfo.Source) require.Equal(t, ti.Source, outInfo.Source)
@@ -128,7 +128,7 @@ func TestSubscribedMaxQuality(t *testing.T) {
mt.NotifySubscriberMaxQuality("s1", livekit.VideoQuality_HIGH) mt.NotifySubscriberMaxQuality("s1", livekit.VideoQuality_HIGH)
actualTrackID := "" actualTrackID := livekit.TrackID("")
actualSubscribedQualities := []*livekit.SubscribedQuality{} actualSubscribedQualities := []*livekit.SubscribedQuality{}
mt.OnSubscribedMaxQualityChange(func(trackID livekit.TrackID, subscribedQualities []*livekit.SubscribedQuality) error { mt.OnSubscribedMaxQualityChange(func(trackID livekit.TrackID, subscribedQualities []*livekit.SubscribedQuality) error {
actualTrackID = trackID actualTrackID = trackID
@@ -144,7 +144,7 @@ func TestSubscribedMaxQuality(t *testing.T) {
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: false},
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false},
} }
require.Equal(t, "v1", actualTrackID) require.Equal(t, livekit.TrackID("v1"), actualTrackID)
require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities) require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities)
}) })
@@ -173,7 +173,7 @@ func TestSubscribedMaxQuality(t *testing.T) {
}, },
}}) }})
actualTrackID := "" actualTrackID := livekit.TrackID("")
actualSubscribedQualities := []*livekit.SubscribedQuality{} actualSubscribedQualities := []*livekit.SubscribedQuality{}
mt.OnSubscribedMaxQualityChange(func(trackID livekit.TrackID, subscribedQualities []*livekit.SubscribedQuality) error { mt.OnSubscribedMaxQualityChange(func(trackID livekit.TrackID, subscribedQualities []*livekit.SubscribedQuality) error {
actualTrackID = trackID actualTrackID = trackID
@@ -189,7 +189,7 @@ func TestSubscribedMaxQuality(t *testing.T) {
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: true}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: true},
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: true}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: true},
} }
require.Equal(t, "v1", actualTrackID) require.Equal(t, livekit.TrackID("v1"), actualTrackID)
require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities) require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities)
// "s1" dropping to MEDIUM should disable HIGH layer // "s1" dropping to MEDIUM should disable HIGH layer
@@ -200,7 +200,7 @@ func TestSubscribedMaxQuality(t *testing.T) {
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: true}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: true},
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false},
} }
require.Equal(t, "v1", actualTrackID) require.Equal(t, livekit.TrackID("v1"), actualTrackID)
require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities) require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities)
// "s1" and "s1" dropping to LOW should disable HIGH & MEDIUM // "s1" and "s1" dropping to LOW should disable HIGH & MEDIUM
@@ -212,7 +212,7 @@ func TestSubscribedMaxQuality(t *testing.T) {
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: false},
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false},
} }
require.Equal(t, "v1", actualTrackID) require.Equal(t, livekit.TrackID("v1"), actualTrackID)
require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities) require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities)
// muting "s2" only should not disable all qualities // muting "s2" only should not disable all qualities
@@ -223,7 +223,7 @@ func TestSubscribedMaxQuality(t *testing.T) {
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: false},
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false},
} }
require.Equal(t, "v1", actualTrackID) require.Equal(t, livekit.TrackID("v1"), actualTrackID)
require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities) require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities)
// muting "s1" also should disable all qualities // muting "s1" also should disable all qualities
@@ -234,7 +234,7 @@ func TestSubscribedMaxQuality(t *testing.T) {
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_MEDIUM, Enabled: false},
&livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false}, &livekit.SubscribedQuality{Quality: livekit.VideoQuality_HIGH, Enabled: false},
} }
require.Equal(t, "v1", actualTrackID) require.Equal(t, livekit.TrackID("v1"), actualTrackID)
require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities) require.EqualValues(t, expectedSubscribedQualities, actualSubscribedQualities)
// unmuting "s1" should enable previously set max quality // unmuting "s1" should enable previously set max quality
+14 -13
View File
@@ -228,9 +228,9 @@ func (p *ParticipantImpl) SetPermission(permission *livekit.ParticipantPermissio
func (p *ParticipantImpl) ToProto() *livekit.ParticipantInfo { func (p *ParticipantImpl) ToProto() *livekit.ParticipantInfo {
info := &livekit.ParticipantInfo{ info := &livekit.ParticipantInfo{
Sid: p.params.SID, Sid: string(p.params.SID),
Identity: p.params.Identity, Identity: string(p.params.Identity),
Name: p.params.Name, Name: string(p.params.Name),
Metadata: p.metadata, Metadata: p.metadata,
State: p.State(), State: p.State(),
JoinedAt: p.ConnectedAt().Unix(), JoinedAt: p.ConnectedAt().Unix(),
@@ -513,7 +513,8 @@ func (p *ParticipantImpl) SendSpeakerUpdate(speakers []*livekit.SpeakerInfo) err
var scopedSpeakers []*livekit.SpeakerInfo var scopedSpeakers []*livekit.SpeakerInfo
for _, s := range speakers { for _, s := range speakers {
if p.IsSubscribedTo(s.Sid) || s.Sid == p.ID() { participantID := livekit.ParticipantID(s.Sid)
if p.IsSubscribedTo(participantID) || participantID == p.ID() {
scopedSpeakers = append(scopedSpeakers, s) scopedSpeakers = append(scopedSpeakers, s)
} }
} }
@@ -586,7 +587,7 @@ func (p *ParticipantImpl) SetTrackMuted(trackID livekit.TrackID, muted bool, fro
_ = p.writeMessage(&livekit.SignalResponse{ _ = p.writeMessage(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Mute{ Message: &livekit.SignalResponse_Mute{
Mute: &livekit.MuteTrackRequest{ Mute: &livekit.MuteTrackRequest{
Sid: trackID, Sid: string(trackID),
Muted: muted, Muted: muted,
}, },
}, },
@@ -622,7 +623,7 @@ func (p *ParticipantImpl) GetConnectionQuality() *livekit.ConnectionQualityInfo
rating := connectionquality.Score2Rating(avgScore) rating := connectionquality.Score2Rating(avgScore)
return &livekit.ConnectionQualityInfo{ return &livekit.ConnectionQualityInfo{
ParticipantSid: p.ID(), ParticipantSid: string(p.ID()),
Quality: rating, Quality: rating,
Score: float32(avgScore), Score: float32(avgScore),
} }
@@ -755,8 +756,8 @@ func (p *ParticipantImpl) SubscriptionPermissionUpdate(publisherID livekit.Parti
err := p.writeMessage(&livekit.SignalResponse{ err := p.writeMessage(&livekit.SignalResponse{
Message: &livekit.SignalResponse_SubscriptionPermissionUpdate{ Message: &livekit.SignalResponse_SubscriptionPermissionUpdate{
SubscriptionPermissionUpdate: &livekit.SubscriptionPermissionUpdate{ SubscriptionPermissionUpdate: &livekit.SubscriptionPermissionUpdate{
ParticipantSid: publisherID, ParticipantSid: string(publisherID),
TrackSid: trackID, TrackSid: string(trackID),
Allowed: allowed, Allowed: allowed,
}, },
}, },
@@ -927,7 +928,7 @@ func (p *ParticipantImpl) handleDataMessage(kind livekit.DataPacket_Kind, data [
switch payload := dp.Value.(type) { switch payload := dp.Value.(type) {
case *livekit.DataPacket_User: case *livekit.DataPacket_User:
if p.onDataPacket != nil { if p.onDataPacket != nil {
payload.User.ParticipantSid = p.params.SID payload.User.ParticipantSid = string(p.params.SID)
p.onDataPacket(p, &dp) p.onDataPacket(p, &dp)
} }
default: default:
@@ -1108,8 +1109,8 @@ func (p *ParticipantImpl) onStreamStateChange(update *sfu.StreamStateUpdate) err
state = livekit.StreamState_PAUSED state = livekit.StreamState_PAUSED
} }
streamStateUpdate.StreamStates = append(streamStateUpdate.StreamStates, &livekit.StreamStateInfo{ streamStateUpdate.StreamStates = append(streamStateUpdate.StreamStates, &livekit.StreamStateInfo{
ParticipantSid: streamStateInfo.ParticipantSid, ParticipantSid: string(streamStateInfo.ParticipantID),
TrackSid: streamStateInfo.TrackSid, TrackSid: string(streamStateInfo.TrackID),
State: state, State: state,
}) })
} }
@@ -1127,7 +1128,7 @@ func (p *ParticipantImpl) onSubscribedMaxQualityChange(trackID livekit.TrackID,
} }
subscribedQualityUpdate := &livekit.SubscribedQualityUpdate{ subscribedQualityUpdate := &livekit.SubscribedQualityUpdate{
TrackSid: trackID, TrackSid: string(trackID),
SubscribedQualities: subscribedQualities, SubscribedQualities: subscribedQualities,
} }
@@ -1146,7 +1147,7 @@ func (p *ParticipantImpl) DebugInfo() map[string]interface{} {
uptrackManagerInfo := p.uptrackManager.DebugInfo() uptrackManagerInfo := p.uptrackManager.DebugInfo()
subscribedTrackInfo := make(map[string]interface{}) subscribedTrackInfo := make(map[livekit.TrackID]interface{})
p.lock.RLock() p.lock.RLock()
for _, track := range p.subscribedTracks { for _, track := range p.subscribedTracks {
dt := track.DownTrack().DebugInfo() dt := track.DownTrack().DebugInfo()
+1 -1
View File
@@ -222,7 +222,7 @@ func TestMuteSetting(t *testing.T) {
ti := &livekit.TrackInfo{Sid: "testTrack"} ti := &livekit.TrackInfo{Sid: "testTrack"}
p.uptrackManager.pendingTracks["cid"] = ti p.uptrackManager.pendingTracks["cid"] = ti
p.SetTrackMuted(ti.Sid, true, false) p.SetTrackMuted(livekit.TrackID(ti.Sid), true, false)
require.True(t, ti.Muted) require.True(t, ti.Muted)
}) })
+10 -10
View File
@@ -124,7 +124,7 @@ func (r *Room) GetActiveSpeakers() []*livekit.SpeakerInfo {
continue continue
} }
speakers = append(speakers, &livekit.SpeakerInfo{ speakers = append(speakers, &livekit.SpeakerInfo{
Sid: p.ID(), Sid: string(p.ID()),
Level: ConvertAudioLevel(level), Level: ConvertAudioLevel(level),
Active: active, Active: active,
}) })
@@ -355,11 +355,11 @@ func (r *Room) UpdateSubscriptions(
} }
for _, pt := range participantTracks { for _, pt := range participantTracks {
p := r.GetParticipantBySid(pt.ParticipantSid) p := r.GetParticipantBySid(livekit.ParticipantID(pt.ParticipantSid))
if p == nil { if p == nil {
continue continue
} }
for _, trackID := range pt.TrackSids { for _, trackID := range livekit.StringsAsTrackIDs(pt.TrackSids) {
trackPublishers[trackID] = p trackPublishers[trackID] = p
} }
} }
@@ -580,7 +580,7 @@ func (r *Room) onDataPacket(source types.Participant, dp *livekit.DataPacket) {
if len(dest) > 0 { if len(dest) > 0 {
found := false found := false
for _, dID := range dest { for _, dID := range dest {
if op.ID() == dID { if op.ID() == livekit.ParticipantID(dID) {
found = true found = true
break break
} }
@@ -701,7 +701,7 @@ func (r *Room) audioUpdateWorker() {
activeSpeakers := r.GetActiveSpeakers() activeSpeakers := r.GetActiveSpeakers()
if smoothValues != nil { if smoothValues != nil {
for _, speaker := range activeSpeakers { for _, speaker := range activeSpeakers {
sid := speaker.Sid sid := livekit.ParticipantID(speaker.Sid)
level := smoothValues[sid] level := smoothValues[sid]
delete(smoothValues, sid) delete(smoothValues, sid)
// exponential moving average (EMA) // exponential moving average (EMA)
@@ -715,7 +715,7 @@ func (r *Room) audioUpdateWorker() {
level += -level * smoothFactor level += -level * smoothFactor
if level > activeThreshold { if level > activeThreshold {
activeSpeakers = append(activeSpeakers, &livekit.SpeakerInfo{ activeSpeakers = append(activeSpeakers, &livekit.SpeakerInfo{
Sid: sid, Sid: string(sid),
Level: level, Level: level,
Active: true, Active: true,
}) })
@@ -724,7 +724,7 @@ func (r *Room) audioUpdateWorker() {
// smoothValues map is drained, now repopulate it back // smoothValues map is drained, now repopulate it back
for _, speaker := range activeSpeakers { for _, speaker := range activeSpeakers {
smoothValues[speaker.Sid] = speaker.Level smoothValues[livekit.ParticipantID(speaker.Sid)] = speaker.Level
} }
sort.Slice(activeSpeakers, func(i, j int) bool { sort.Slice(activeSpeakers, func(i, j int) bool {
@@ -740,11 +740,11 @@ func (r *Room) audioUpdateWorker() {
changedSpeakers := make([]*livekit.SpeakerInfo, 0, len(activeSpeakers)) changedSpeakers := make([]*livekit.SpeakerInfo, 0, len(activeSpeakers))
nextActiveMap := make(map[livekit.ParticipantID]*livekit.SpeakerInfo, len(activeSpeakers)) nextActiveMap := make(map[livekit.ParticipantID]*livekit.SpeakerInfo, len(activeSpeakers))
for _, speaker := range activeSpeakers { for _, speaker := range activeSpeakers {
prev := lastActiveMap[speaker.Sid] prev := lastActiveMap[livekit.ParticipantID(speaker.Sid)]
if prev == nil || prev.Level != speaker.Level { if prev == nil || prev.Level != speaker.Level {
changedSpeakers = append(changedSpeakers, speaker) changedSpeakers = append(changedSpeakers, speaker)
} }
nextActiveMap[speaker.Sid] = speaker nextActiveMap[livekit.ParticipantID(speaker.Sid)] = speaker
} }
// changedSpeakers need to include previous speakers that are no longer speaking // changedSpeakers need to include previous speakers that are no longer speaking
for sid, speaker := range lastActiveMap { for sid, speaker := range lastActiveMap {
@@ -818,7 +818,7 @@ func (r *Room) DebugInfo() map[string]interface{} {
participants := r.GetParticipants() participants := r.GetParticipants()
participantInfo := make(map[string]interface{}) participantInfo := make(map[string]interface{})
for _, p := range participants { for _, p := range participants {
participantInfo[p.Identity()] = p.DebugInfo() participantInfo[string(p.Identity())] = p.DebugInfo()
} }
info["Participants"] = participantInfo info["Participants"] = participantInfo
+7 -7
View File
@@ -307,8 +307,8 @@ func TestActiveSpeakers(t *testing.T) {
speakers := rm.GetActiveSpeakers() speakers := rm.GetActiveSpeakers()
require.Len(t, speakers, 2) require.Len(t, speakers, 2)
require.Equal(t, p.ID(), speakers[0].Sid) require.Equal(t, string(p.ID()), speakers[0].Sid)
require.Equal(t, p2.ID(), speakers[1].Sid) require.Equal(t, string(p2.ID()), speakers[1].Sid)
}) })
t.Run("participants are getting audio updates (protocol 2)", func(t *testing.T) { t.Run("participants are getting audio updates (protocol 2)", func(t *testing.T) {
@@ -321,7 +321,7 @@ func TestActiveSpeakers(t *testing.T) {
speakers := rm.GetActiveSpeakers() speakers := rm.GetActiveSpeakers()
require.NotEmpty(t, speakers) require.NotEmpty(t, speakers)
require.Equal(t, p.ID(), speakers[0].Sid) require.Equal(t, string(p.ID()), speakers[0].Sid)
testutils.WithTimeout(t, "ensure everyone has gotten an audio update", func() bool { testutils.WithTimeout(t, "ensure everyone has gotten an audio update", func() bool {
for _, op := range participants { for _, op := range participants {
@@ -412,7 +412,7 @@ func TestDataChannel(t *testing.T) {
Kind: livekit.DataPacket_RELIABLE, Kind: livekit.DataPacket_RELIABLE,
Value: &livekit.DataPacket_User{ Value: &livekit.DataPacket_User{
User: &livekit.UserPacket{ User: &livekit.UserPacket{
ParticipantSid: p.ID(), ParticipantSid: string(p.ID()),
Payload: []byte("message.."), Payload: []byte("message.."),
}, },
}, },
@@ -442,9 +442,9 @@ func TestDataChannel(t *testing.T) {
Kind: livekit.DataPacket_RELIABLE, Kind: livekit.DataPacket_RELIABLE,
Value: &livekit.DataPacket_User{ Value: &livekit.DataPacket_User{
User: &livekit.UserPacket{ User: &livekit.UserPacket{
ParticipantSid: p.ID(), ParticipantSid: string(p.ID()),
Payload: []byte("message to p1.."), Payload: []byte("message to p1.."),
DestinationSids: []string{p1.ID()}, DestinationSids: []string{string(p1.ID())},
}, },
}, },
} }
@@ -561,7 +561,7 @@ func newRoomWithParticipants(t *testing.T, opts testRoomOpts) *rtc.Room {
telemetry.NewTelemetryService(nil, nil), telemetry.NewTelemetryService(nil, nil),
) )
for i := 0; i < opts.num+opts.numHidden; i++ { for i := 0; i < opts.num+opts.numHidden; i++ {
identity := fmt.Sprintf("p%d", i) identity := livekit.ParticipantIdentity(fmt.Sprintf("p%d", i))
participant := newMockParticipant(identity, opts.protocol, i >= opts.num) participant := newMockParticipant(identity, opts.protocol, i >= opts.num)
err := rm.Join(participant, &rtc.ParticipantOptions{AutoSubscribe: true}, iceServersForRoom) err := rm.Join(participant, &rtc.ParticipantOptions{AutoSubscribe: true}, iceServersForRoom)
participant.StateReturns(livekit.ParticipantInfo_ACTIVE) participant.StateReturns(livekit.ParticipantInfo_ACTIVE)
+4 -4
View File
@@ -35,13 +35,13 @@ func HandleParticipantSignal(room types.Room, participant types.Participant, req
pLogger.Warnw("could not handle trickle", err) pLogger.Warnw("could not handle trickle", err)
} }
case *livekit.SignalRequest_Mute: case *livekit.SignalRequest_Mute:
participant.SetTrackMuted(msg.Mute.Sid, msg.Mute.Muted, false) participant.SetTrackMuted(livekit.TrackID(msg.Mute.Sid), msg.Mute.Muted, false)
case *livekit.SignalRequest_Subscription: case *livekit.SignalRequest_Subscription:
var err error var err error
if participant.CanSubscribe() { if participant.CanSubscribe() {
updateErr := room.UpdateSubscriptions( updateErr := room.UpdateSubscriptions(
participant, participant,
msg.Subscription.TrackSids, livekit.StringsAsTrackIDs(msg.Subscription.TrackSids),
msg.Subscription.ParticipantTracks, msg.Subscription.ParticipantTracks,
msg.Subscription.Subscribe, msg.Subscription.Subscribe,
) )
@@ -57,7 +57,7 @@ func HandleParticipantSignal(room types.Room, participant types.Participant, req
"subscribe", msg.Subscription.Subscribe) "subscribe", msg.Subscription.Subscribe)
} }
case *livekit.SignalRequest_TrackSetting: case *livekit.SignalRequest_TrackSetting:
for _, sid := range msg.TrackSetting.TrackSids { for _, sid := range livekit.StringsAsTrackIDs(msg.TrackSetting.TrackSids) {
subTrack := participant.GetSubscribedTrack(sid) subTrack := participant.GetSubscribedTrack(sid)
if subTrack == nil { if subTrack == nil {
pLogger.Warnw("unable to find SubscribedTrack", nil, pLogger.Warnw("unable to find SubscribedTrack", nil,
@@ -71,7 +71,7 @@ func HandleParticipantSignal(room types.Room, participant types.Participant, req
subTrack.UpdateSubscriberSettings(msg.TrackSetting) subTrack.UpdateSubscriberSettings(msg.TrackSetting)
} }
case *livekit.SignalRequest_UpdateLayers: case *livekit.SignalRequest_UpdateLayers:
track := participant.GetPublishedTrack(msg.UpdateLayers.TrackSid) track := participant.GetPublishedTrack(livekit.TrackID(msg.UpdateLayers.TrackSid))
if track == nil { if track == nil {
pLogger.Warnw("could not find published track", nil, pLogger.Warnw("could not find published track", nil,
"track", msg.UpdateLayers.TrackSid) "track", msg.UpdateLayers.TrackSid)
+2 -2
View File
@@ -52,8 +52,8 @@ func (t *SubscribedTrack) Bound() {
} }
} }
func (t *SubscribedTrack) ID() string { func (t *SubscribedTrack) ID() livekit.TrackID {
return t.params.DownTrack.ID() return livekit.TrackID(t.params.DownTrack.ID())
} }
func (t *SubscribedTrack) PublisherID() livekit.ParticipantID { func (t *SubscribedTrack) PublisherID() livekit.ParticipantID {
+49 -49
View File
@@ -32,15 +32,15 @@ type FakeMediaTrack struct {
getQualityForDimensionReturnsOnCall map[int]struct { getQualityForDimensionReturnsOnCall map[int]struct {
result1 livekit.VideoQuality result1 livekit.VideoQuality
} }
IDStub func() string IDStub func() livekit.TrackID
iDMutex sync.RWMutex iDMutex sync.RWMutex
iDArgsForCall []struct { iDArgsForCall []struct {
} }
iDReturns struct { iDReturns struct {
result1 string result1 livekit.TrackID
} }
iDReturnsOnCall map[int]struct { iDReturnsOnCall map[int]struct {
result1 string result1 livekit.TrackID
} }
IsMutedStub func() bool IsMutedStub func() bool
isMutedMutex sync.RWMutex isMutedMutex sync.RWMutex
@@ -62,10 +62,10 @@ type FakeMediaTrack struct {
isSimulcastReturnsOnCall map[int]struct { isSimulcastReturnsOnCall map[int]struct {
result1 bool result1 bool
} }
IsSubscriberStub func(string) bool IsSubscriberStub func(livekit.ParticipantID) bool
isSubscriberMutex sync.RWMutex isSubscriberMutex sync.RWMutex
isSubscriberArgsForCall []struct { isSubscriberArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
} }
isSubscriberReturns struct { isSubscriberReturns struct {
result1 bool result1 bool
@@ -93,36 +93,36 @@ type FakeMediaTrack struct {
nameReturnsOnCall map[int]struct { nameReturnsOnCall map[int]struct {
result1 string result1 string
} }
NotifySubscriberMaxQualityStub func(string, livekit.VideoQuality) NotifySubscriberMaxQualityStub func(livekit.ParticipantID, livekit.VideoQuality)
notifySubscriberMaxQualityMutex sync.RWMutex notifySubscriberMaxQualityMutex sync.RWMutex
notifySubscriberMaxQualityArgsForCall []struct { notifySubscriberMaxQualityArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
arg2 livekit.VideoQuality arg2 livekit.VideoQuality
} }
NotifySubscriberMuteStub func(string) NotifySubscriberMuteStub func(livekit.ParticipantID)
notifySubscriberMuteMutex sync.RWMutex notifySubscriberMuteMutex sync.RWMutex
notifySubscriberMuteArgsForCall []struct { notifySubscriberMuteArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
} }
RemoveAllSubscribersStub func() RemoveAllSubscribersStub func()
removeAllSubscribersMutex sync.RWMutex removeAllSubscribersMutex sync.RWMutex
removeAllSubscribersArgsForCall []struct { removeAllSubscribersArgsForCall []struct {
} }
RemoveSubscriberStub func(string) RemoveSubscriberStub func(livekit.ParticipantID)
removeSubscriberMutex sync.RWMutex removeSubscriberMutex sync.RWMutex
removeSubscriberArgsForCall []struct { removeSubscriberArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
} }
RevokeDisallowedSubscribersStub func([]string) []string RevokeDisallowedSubscribersStub func([]livekit.ParticipantID) []livekit.ParticipantID
revokeDisallowedSubscribersMutex sync.RWMutex revokeDisallowedSubscribersMutex sync.RWMutex
revokeDisallowedSubscribersArgsForCall []struct { revokeDisallowedSubscribersArgsForCall []struct {
arg1 []string arg1 []livekit.ParticipantID
} }
revokeDisallowedSubscribersReturns struct { revokeDisallowedSubscribersReturns struct {
result1 []string result1 []livekit.ParticipantID
} }
revokeDisallowedSubscribersReturnsOnCall map[int]struct { revokeDisallowedSubscribersReturnsOnCall map[int]struct {
result1 []string result1 []livekit.ParticipantID
} }
SetMutedStub func(bool) SetMutedStub func(bool)
setMutedMutex sync.RWMutex setMutedMutex sync.RWMutex
@@ -271,7 +271,7 @@ func (fake *FakeMediaTrack) GetQualityForDimensionReturnsOnCall(i int, result1 l
}{result1} }{result1}
} }
func (fake *FakeMediaTrack) ID() string { func (fake *FakeMediaTrack) ID() livekit.TrackID {
fake.iDMutex.Lock() fake.iDMutex.Lock()
ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)] ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)]
fake.iDArgsForCall = append(fake.iDArgsForCall, struct { fake.iDArgsForCall = append(fake.iDArgsForCall, struct {
@@ -295,32 +295,32 @@ func (fake *FakeMediaTrack) IDCallCount() int {
return len(fake.iDArgsForCall) return len(fake.iDArgsForCall)
} }
func (fake *FakeMediaTrack) IDCalls(stub func() string) { func (fake *FakeMediaTrack) IDCalls(stub func() livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = stub fake.IDStub = stub
} }
func (fake *FakeMediaTrack) IDReturns(result1 string) { func (fake *FakeMediaTrack) IDReturns(result1 livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = nil fake.IDStub = nil
fake.iDReturns = struct { fake.iDReturns = struct {
result1 string result1 livekit.TrackID
}{result1} }{result1}
} }
func (fake *FakeMediaTrack) IDReturnsOnCall(i int, result1 string) { func (fake *FakeMediaTrack) IDReturnsOnCall(i int, result1 livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = nil fake.IDStub = nil
if fake.iDReturnsOnCall == nil { if fake.iDReturnsOnCall == nil {
fake.iDReturnsOnCall = make(map[int]struct { fake.iDReturnsOnCall = make(map[int]struct {
result1 string result1 livekit.TrackID
}) })
} }
fake.iDReturnsOnCall[i] = struct { fake.iDReturnsOnCall[i] = struct {
result1 string result1 livekit.TrackID
}{result1} }{result1}
} }
@@ -430,11 +430,11 @@ func (fake *FakeMediaTrack) IsSimulcastReturnsOnCall(i int, result1 bool) {
}{result1} }{result1}
} }
func (fake *FakeMediaTrack) IsSubscriber(arg1 string) bool { func (fake *FakeMediaTrack) IsSubscriber(arg1 livekit.ParticipantID) bool {
fake.isSubscriberMutex.Lock() fake.isSubscriberMutex.Lock()
ret, specificReturn := fake.isSubscriberReturnsOnCall[len(fake.isSubscriberArgsForCall)] ret, specificReturn := fake.isSubscriberReturnsOnCall[len(fake.isSubscriberArgsForCall)]
fake.isSubscriberArgsForCall = append(fake.isSubscriberArgsForCall, struct { fake.isSubscriberArgsForCall = append(fake.isSubscriberArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
}{arg1}) }{arg1})
stub := fake.IsSubscriberStub stub := fake.IsSubscriberStub
fakeReturns := fake.isSubscriberReturns fakeReturns := fake.isSubscriberReturns
@@ -455,13 +455,13 @@ func (fake *FakeMediaTrack) IsSubscriberCallCount() int {
return len(fake.isSubscriberArgsForCall) return len(fake.isSubscriberArgsForCall)
} }
func (fake *FakeMediaTrack) IsSubscriberCalls(stub func(string) bool) { func (fake *FakeMediaTrack) IsSubscriberCalls(stub func(livekit.ParticipantID) bool) {
fake.isSubscriberMutex.Lock() fake.isSubscriberMutex.Lock()
defer fake.isSubscriberMutex.Unlock() defer fake.isSubscriberMutex.Unlock()
fake.IsSubscriberStub = stub fake.IsSubscriberStub = stub
} }
func (fake *FakeMediaTrack) IsSubscriberArgsForCall(i int) string { func (fake *FakeMediaTrack) IsSubscriberArgsForCall(i int) livekit.ParticipantID {
fake.isSubscriberMutex.RLock() fake.isSubscriberMutex.RLock()
defer fake.isSubscriberMutex.RUnlock() defer fake.isSubscriberMutex.RUnlock()
argsForCall := fake.isSubscriberArgsForCall[i] argsForCall := fake.isSubscriberArgsForCall[i]
@@ -597,10 +597,10 @@ func (fake *FakeMediaTrack) NameReturnsOnCall(i int, result1 string) {
}{result1} }{result1}
} }
func (fake *FakeMediaTrack) NotifySubscriberMaxQuality(arg1 string, arg2 livekit.VideoQuality) { func (fake *FakeMediaTrack) NotifySubscriberMaxQuality(arg1 livekit.ParticipantID, arg2 livekit.VideoQuality) {
fake.notifySubscriberMaxQualityMutex.Lock() fake.notifySubscriberMaxQualityMutex.Lock()
fake.notifySubscriberMaxQualityArgsForCall = append(fake.notifySubscriberMaxQualityArgsForCall, struct { fake.notifySubscriberMaxQualityArgsForCall = append(fake.notifySubscriberMaxQualityArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
arg2 livekit.VideoQuality arg2 livekit.VideoQuality
}{arg1, arg2}) }{arg1, arg2})
stub := fake.NotifySubscriberMaxQualityStub stub := fake.NotifySubscriberMaxQualityStub
@@ -617,23 +617,23 @@ func (fake *FakeMediaTrack) NotifySubscriberMaxQualityCallCount() int {
return len(fake.notifySubscriberMaxQualityArgsForCall) return len(fake.notifySubscriberMaxQualityArgsForCall)
} }
func (fake *FakeMediaTrack) NotifySubscriberMaxQualityCalls(stub func(string, livekit.VideoQuality)) { func (fake *FakeMediaTrack) NotifySubscriberMaxQualityCalls(stub func(livekit.ParticipantID, livekit.VideoQuality)) {
fake.notifySubscriberMaxQualityMutex.Lock() fake.notifySubscriberMaxQualityMutex.Lock()
defer fake.notifySubscriberMaxQualityMutex.Unlock() defer fake.notifySubscriberMaxQualityMutex.Unlock()
fake.NotifySubscriberMaxQualityStub = stub fake.NotifySubscriberMaxQualityStub = stub
} }
func (fake *FakeMediaTrack) NotifySubscriberMaxQualityArgsForCall(i int) (string, livekit.VideoQuality) { func (fake *FakeMediaTrack) NotifySubscriberMaxQualityArgsForCall(i int) (livekit.ParticipantID, livekit.VideoQuality) {
fake.notifySubscriberMaxQualityMutex.RLock() fake.notifySubscriberMaxQualityMutex.RLock()
defer fake.notifySubscriberMaxQualityMutex.RUnlock() defer fake.notifySubscriberMaxQualityMutex.RUnlock()
argsForCall := fake.notifySubscriberMaxQualityArgsForCall[i] argsForCall := fake.notifySubscriberMaxQualityArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2 return argsForCall.arg1, argsForCall.arg2
} }
func (fake *FakeMediaTrack) NotifySubscriberMute(arg1 string) { func (fake *FakeMediaTrack) NotifySubscriberMute(arg1 livekit.ParticipantID) {
fake.notifySubscriberMuteMutex.Lock() fake.notifySubscriberMuteMutex.Lock()
fake.notifySubscriberMuteArgsForCall = append(fake.notifySubscriberMuteArgsForCall, struct { fake.notifySubscriberMuteArgsForCall = append(fake.notifySubscriberMuteArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
}{arg1}) }{arg1})
stub := fake.NotifySubscriberMuteStub stub := fake.NotifySubscriberMuteStub
fake.recordInvocation("NotifySubscriberMute", []interface{}{arg1}) fake.recordInvocation("NotifySubscriberMute", []interface{}{arg1})
@@ -649,13 +649,13 @@ func (fake *FakeMediaTrack) NotifySubscriberMuteCallCount() int {
return len(fake.notifySubscriberMuteArgsForCall) return len(fake.notifySubscriberMuteArgsForCall)
} }
func (fake *FakeMediaTrack) NotifySubscriberMuteCalls(stub func(string)) { func (fake *FakeMediaTrack) NotifySubscriberMuteCalls(stub func(livekit.ParticipantID)) {
fake.notifySubscriberMuteMutex.Lock() fake.notifySubscriberMuteMutex.Lock()
defer fake.notifySubscriberMuteMutex.Unlock() defer fake.notifySubscriberMuteMutex.Unlock()
fake.NotifySubscriberMuteStub = stub fake.NotifySubscriberMuteStub = stub
} }
func (fake *FakeMediaTrack) NotifySubscriberMuteArgsForCall(i int) string { func (fake *FakeMediaTrack) NotifySubscriberMuteArgsForCall(i int) livekit.ParticipantID {
fake.notifySubscriberMuteMutex.RLock() fake.notifySubscriberMuteMutex.RLock()
defer fake.notifySubscriberMuteMutex.RUnlock() defer fake.notifySubscriberMuteMutex.RUnlock()
argsForCall := fake.notifySubscriberMuteArgsForCall[i] argsForCall := fake.notifySubscriberMuteArgsForCall[i]
@@ -686,10 +686,10 @@ func (fake *FakeMediaTrack) RemoveAllSubscribersCalls(stub func()) {
fake.RemoveAllSubscribersStub = stub fake.RemoveAllSubscribersStub = stub
} }
func (fake *FakeMediaTrack) RemoveSubscriber(arg1 string) { func (fake *FakeMediaTrack) RemoveSubscriber(arg1 livekit.ParticipantID) {
fake.removeSubscriberMutex.Lock() fake.removeSubscriberMutex.Lock()
fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct { fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
}{arg1}) }{arg1})
stub := fake.RemoveSubscriberStub stub := fake.RemoveSubscriberStub
fake.recordInvocation("RemoveSubscriber", []interface{}{arg1}) fake.recordInvocation("RemoveSubscriber", []interface{}{arg1})
@@ -705,29 +705,29 @@ func (fake *FakeMediaTrack) RemoveSubscriberCallCount() int {
return len(fake.removeSubscriberArgsForCall) return len(fake.removeSubscriberArgsForCall)
} }
func (fake *FakeMediaTrack) RemoveSubscriberCalls(stub func(string)) { func (fake *FakeMediaTrack) RemoveSubscriberCalls(stub func(livekit.ParticipantID)) {
fake.removeSubscriberMutex.Lock() fake.removeSubscriberMutex.Lock()
defer fake.removeSubscriberMutex.Unlock() defer fake.removeSubscriberMutex.Unlock()
fake.RemoveSubscriberStub = stub fake.RemoveSubscriberStub = stub
} }
func (fake *FakeMediaTrack) RemoveSubscriberArgsForCall(i int) string { func (fake *FakeMediaTrack) RemoveSubscriberArgsForCall(i int) livekit.ParticipantID {
fake.removeSubscriberMutex.RLock() fake.removeSubscriberMutex.RLock()
defer fake.removeSubscriberMutex.RUnlock() defer fake.removeSubscriberMutex.RUnlock()
argsForCall := fake.removeSubscriberArgsForCall[i] argsForCall := fake.removeSubscriberArgsForCall[i]
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeMediaTrack) RevokeDisallowedSubscribers(arg1 []string) []string { func (fake *FakeMediaTrack) RevokeDisallowedSubscribers(arg1 []livekit.ParticipantID) []livekit.ParticipantID {
var arg1Copy []string var arg1Copy []livekit.ParticipantID
if arg1 != nil { if arg1 != nil {
arg1Copy = make([]string, len(arg1)) arg1Copy = make([]livekit.ParticipantID, len(arg1))
copy(arg1Copy, arg1) copy(arg1Copy, arg1)
} }
fake.revokeDisallowedSubscribersMutex.Lock() fake.revokeDisallowedSubscribersMutex.Lock()
ret, specificReturn := fake.revokeDisallowedSubscribersReturnsOnCall[len(fake.revokeDisallowedSubscribersArgsForCall)] ret, specificReturn := fake.revokeDisallowedSubscribersReturnsOnCall[len(fake.revokeDisallowedSubscribersArgsForCall)]
fake.revokeDisallowedSubscribersArgsForCall = append(fake.revokeDisallowedSubscribersArgsForCall, struct { fake.revokeDisallowedSubscribersArgsForCall = append(fake.revokeDisallowedSubscribersArgsForCall, struct {
arg1 []string arg1 []livekit.ParticipantID
}{arg1Copy}) }{arg1Copy})
stub := fake.RevokeDisallowedSubscribersStub stub := fake.RevokeDisallowedSubscribersStub
fakeReturns := fake.revokeDisallowedSubscribersReturns fakeReturns := fake.revokeDisallowedSubscribersReturns
@@ -748,39 +748,39 @@ func (fake *FakeMediaTrack) RevokeDisallowedSubscribersCallCount() int {
return len(fake.revokeDisallowedSubscribersArgsForCall) return len(fake.revokeDisallowedSubscribersArgsForCall)
} }
func (fake *FakeMediaTrack) RevokeDisallowedSubscribersCalls(stub func([]string) []string) { func (fake *FakeMediaTrack) RevokeDisallowedSubscribersCalls(stub func([]livekit.ParticipantID) []livekit.ParticipantID) {
fake.revokeDisallowedSubscribersMutex.Lock() fake.revokeDisallowedSubscribersMutex.Lock()
defer fake.revokeDisallowedSubscribersMutex.Unlock() defer fake.revokeDisallowedSubscribersMutex.Unlock()
fake.RevokeDisallowedSubscribersStub = stub fake.RevokeDisallowedSubscribersStub = stub
} }
func (fake *FakeMediaTrack) RevokeDisallowedSubscribersArgsForCall(i int) []string { func (fake *FakeMediaTrack) RevokeDisallowedSubscribersArgsForCall(i int) []livekit.ParticipantID {
fake.revokeDisallowedSubscribersMutex.RLock() fake.revokeDisallowedSubscribersMutex.RLock()
defer fake.revokeDisallowedSubscribersMutex.RUnlock() defer fake.revokeDisallowedSubscribersMutex.RUnlock()
argsForCall := fake.revokeDisallowedSubscribersArgsForCall[i] argsForCall := fake.revokeDisallowedSubscribersArgsForCall[i]
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeMediaTrack) RevokeDisallowedSubscribersReturns(result1 []string) { func (fake *FakeMediaTrack) RevokeDisallowedSubscribersReturns(result1 []livekit.ParticipantID) {
fake.revokeDisallowedSubscribersMutex.Lock() fake.revokeDisallowedSubscribersMutex.Lock()
defer fake.revokeDisallowedSubscribersMutex.Unlock() defer fake.revokeDisallowedSubscribersMutex.Unlock()
fake.RevokeDisallowedSubscribersStub = nil fake.RevokeDisallowedSubscribersStub = nil
fake.revokeDisallowedSubscribersReturns = struct { fake.revokeDisallowedSubscribersReturns = struct {
result1 []string result1 []livekit.ParticipantID
}{result1} }{result1}
} }
func (fake *FakeMediaTrack) RevokeDisallowedSubscribersReturnsOnCall(i int, result1 []string) { func (fake *FakeMediaTrack) RevokeDisallowedSubscribersReturnsOnCall(i int, result1 []livekit.ParticipantID) {
fake.revokeDisallowedSubscribersMutex.Lock() fake.revokeDisallowedSubscribersMutex.Lock()
defer fake.revokeDisallowedSubscribersMutex.Unlock() defer fake.revokeDisallowedSubscribersMutex.Unlock()
fake.RevokeDisallowedSubscribersStub = nil fake.RevokeDisallowedSubscribersStub = nil
if fake.revokeDisallowedSubscribersReturnsOnCall == nil { if fake.revokeDisallowedSubscribersReturnsOnCall == nil {
fake.revokeDisallowedSubscribersReturnsOnCall = make(map[int]struct { fake.revokeDisallowedSubscribersReturnsOnCall = make(map[int]struct {
result1 []string result1 []livekit.ParticipantID
}) })
} }
fake.revokeDisallowedSubscribersReturnsOnCall[i] = struct { fake.revokeDisallowedSubscribersReturnsOnCall[i] = struct {
result1 []string result1 []livekit.ParticipantID
}{result1} }{result1}
} }
+80 -80
View File
@@ -130,10 +130,10 @@ type FakeParticipant struct {
getConnectionQualityReturnsOnCall map[int]struct { getConnectionQualityReturnsOnCall map[int]struct {
result1 *livekit.ConnectionQualityInfo result1 *livekit.ConnectionQualityInfo
} }
GetPublishedTrackStub func(string) types.PublishedTrack GetPublishedTrackStub func(livekit.TrackID) types.PublishedTrack
getPublishedTrackMutex sync.RWMutex getPublishedTrackMutex sync.RWMutex
getPublishedTrackArgsForCall []struct { getPublishedTrackArgsForCall []struct {
arg1 string arg1 livekit.TrackID
} }
getPublishedTrackReturns struct { getPublishedTrackReturns struct {
result1 types.PublishedTrack result1 types.PublishedTrack
@@ -161,20 +161,20 @@ type FakeParticipant struct {
getResponseSinkReturnsOnCall map[int]struct { getResponseSinkReturnsOnCall map[int]struct {
result1 routing.MessageSink result1 routing.MessageSink
} }
GetSubscribedParticipantsStub func() []string GetSubscribedParticipantsStub func() []livekit.ParticipantID
getSubscribedParticipantsMutex sync.RWMutex getSubscribedParticipantsMutex sync.RWMutex
getSubscribedParticipantsArgsForCall []struct { getSubscribedParticipantsArgsForCall []struct {
} }
getSubscribedParticipantsReturns struct { getSubscribedParticipantsReturns struct {
result1 []string result1 []livekit.ParticipantID
} }
getSubscribedParticipantsReturnsOnCall map[int]struct { getSubscribedParticipantsReturnsOnCall map[int]struct {
result1 []string result1 []livekit.ParticipantID
} }
GetSubscribedTrackStub func(string) types.SubscribedTrack GetSubscribedTrackStub func(livekit.TrackID) types.SubscribedTrack
getSubscribedTrackMutex sync.RWMutex getSubscribedTrackMutex sync.RWMutex
getSubscribedTrackArgsForCall []struct { getSubscribedTrackArgsForCall []struct {
arg1 string arg1 livekit.TrackID
} }
getSubscribedTrackReturns struct { getSubscribedTrackReturns struct {
result1 types.SubscribedTrack result1 types.SubscribedTrack
@@ -236,25 +236,25 @@ type FakeParticipant struct {
iCERestartReturnsOnCall map[int]struct { iCERestartReturnsOnCall map[int]struct {
result1 error result1 error
} }
IDStub func() string IDStub func() livekit.ParticipantID
iDMutex sync.RWMutex iDMutex sync.RWMutex
iDArgsForCall []struct { iDArgsForCall []struct {
} }
iDReturns struct { iDReturns struct {
result1 string result1 livekit.ParticipantID
} }
iDReturnsOnCall map[int]struct { iDReturnsOnCall map[int]struct {
result1 string result1 livekit.ParticipantID
} }
IdentityStub func() string IdentityStub func() livekit.ParticipantIdentity
identityMutex sync.RWMutex identityMutex sync.RWMutex
identityArgsForCall []struct { identityArgsForCall []struct {
} }
identityReturns struct { identityReturns struct {
result1 string result1 livekit.ParticipantIdentity
} }
identityReturnsOnCall map[int]struct { identityReturnsOnCall map[int]struct {
result1 string result1 livekit.ParticipantIdentity
} }
IsReadyStub func() bool IsReadyStub func() bool
isReadyMutex sync.RWMutex isReadyMutex sync.RWMutex
@@ -276,10 +276,10 @@ type FakeParticipant struct {
isRecorderReturnsOnCall map[int]struct { isRecorderReturnsOnCall map[int]struct {
result1 bool result1 bool
} }
IsSubscribedToStub func(string) bool IsSubscribedToStub func(livekit.ParticipantID) bool
isSubscribedToMutex sync.RWMutex isSubscribedToMutex sync.RWMutex
isSubscribedToArgsForCall []struct { isSubscribedToArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
} }
isSubscribedToReturns struct { isSubscribedToReturns struct {
result1 bool result1 bool
@@ -291,10 +291,10 @@ type FakeParticipant struct {
negotiateMutex sync.RWMutex negotiateMutex sync.RWMutex
negotiateArgsForCall []struct { negotiateArgsForCall []struct {
} }
OnCloseStub func(func(types.Participant, map[string]string)) OnCloseStub func(func(types.Participant, map[livekit.TrackID]livekit.ParticipantID))
onCloseMutex sync.RWMutex onCloseMutex sync.RWMutex
onCloseArgsForCall []struct { onCloseArgsForCall []struct {
arg1 func(types.Participant, map[string]string) arg1 func(types.Participant, map[livekit.TrackID]livekit.ParticipantID)
} }
OnDataPacketStub func(func(types.Participant, *livekit.DataPacket)) OnDataPacketStub func(func(types.Participant, *livekit.DataPacket))
onDataPacketMutex sync.RWMutex onDataPacketMutex sync.RWMutex
@@ -336,11 +336,11 @@ type FakeParticipant struct {
removeSubscribedTrackArgsForCall []struct { removeSubscribedTrackArgsForCall []struct {
arg1 types.SubscribedTrack arg1 types.SubscribedTrack
} }
RemoveSubscriberStub func(types.Participant, string) RemoveSubscriberStub func(types.Participant, livekit.TrackID)
removeSubscriberMutex sync.RWMutex removeSubscriberMutex sync.RWMutex
removeSubscriberArgsForCall []struct { removeSubscriberArgsForCall []struct {
arg1 types.Participant arg1 types.Participant
arg2 string arg2 livekit.TrackID
} }
SendConnectionQualityUpdateStub func(*livekit.ConnectionQualityUpdate) error SendConnectionQualityUpdateStub func(*livekit.ConnectionQualityUpdate) error
sendConnectionQualityUpdateMutex sync.RWMutex sendConnectionQualityUpdateMutex sync.RWMutex
@@ -426,10 +426,10 @@ type FakeParticipant struct {
setResponseSinkArgsForCall []struct { setResponseSinkArgsForCall []struct {
arg1 routing.MessageSink arg1 routing.MessageSink
} }
SetTrackMutedStub func(string, bool, bool) SetTrackMutedStub func(livekit.TrackID, bool, bool)
setTrackMutedMutex sync.RWMutex setTrackMutedMutex sync.RWMutex
setTrackMutedArgsForCall []struct { setTrackMutedArgsForCall []struct {
arg1 string arg1 livekit.TrackID
arg2 bool arg2 bool
arg3 bool arg3 bool
} }
@@ -477,11 +477,11 @@ type FakeParticipant struct {
subscriberPCReturnsOnCall map[int]struct { subscriberPCReturnsOnCall map[int]struct {
result1 *webrtc.PeerConnection result1 *webrtc.PeerConnection
} }
SubscriptionPermissionUpdateStub func(string, string, bool) SubscriptionPermissionUpdateStub func(livekit.ParticipantID, livekit.TrackID, bool)
subscriptionPermissionUpdateMutex sync.RWMutex subscriptionPermissionUpdateMutex sync.RWMutex
subscriptionPermissionUpdateArgsForCall []struct { subscriptionPermissionUpdateArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
arg2 string arg2 livekit.TrackID
arg3 bool arg3 bool
} }
ToProtoStub func() *livekit.ParticipantInfo ToProtoStub func() *livekit.ParticipantInfo
@@ -494,11 +494,11 @@ type FakeParticipant struct {
toProtoReturnsOnCall map[int]struct { toProtoReturnsOnCall map[int]struct {
result1 *livekit.ParticipantInfo result1 *livekit.ParticipantInfo
} }
UpdateSubscriptionPermissionsStub func(*livekit.UpdateSubscriptionPermissions, func(participantID string) types.Participant) error UpdateSubscriptionPermissionsStub func(*livekit.UpdateSubscriptionPermissions, func(participantID livekit.ParticipantID) types.Participant) error
updateSubscriptionPermissionsMutex sync.RWMutex updateSubscriptionPermissionsMutex sync.RWMutex
updateSubscriptionPermissionsArgsForCall []struct { updateSubscriptionPermissionsArgsForCall []struct {
arg1 *livekit.UpdateSubscriptionPermissions arg1 *livekit.UpdateSubscriptionPermissions
arg2 func(participantID string) types.Participant arg2 func(participantID livekit.ParticipantID) types.Participant
} }
updateSubscriptionPermissionsReturns struct { updateSubscriptionPermissionsReturns struct {
result1 error result1 error
@@ -1128,11 +1128,11 @@ func (fake *FakeParticipant) GetConnectionQualityReturnsOnCall(i int, result1 *l
}{result1} }{result1}
} }
func (fake *FakeParticipant) GetPublishedTrack(arg1 string) types.PublishedTrack { func (fake *FakeParticipant) GetPublishedTrack(arg1 livekit.TrackID) types.PublishedTrack {
fake.getPublishedTrackMutex.Lock() fake.getPublishedTrackMutex.Lock()
ret, specificReturn := fake.getPublishedTrackReturnsOnCall[len(fake.getPublishedTrackArgsForCall)] ret, specificReturn := fake.getPublishedTrackReturnsOnCall[len(fake.getPublishedTrackArgsForCall)]
fake.getPublishedTrackArgsForCall = append(fake.getPublishedTrackArgsForCall, struct { fake.getPublishedTrackArgsForCall = append(fake.getPublishedTrackArgsForCall, struct {
arg1 string arg1 livekit.TrackID
}{arg1}) }{arg1})
stub := fake.GetPublishedTrackStub stub := fake.GetPublishedTrackStub
fakeReturns := fake.getPublishedTrackReturns fakeReturns := fake.getPublishedTrackReturns
@@ -1153,13 +1153,13 @@ func (fake *FakeParticipant) GetPublishedTrackCallCount() int {
return len(fake.getPublishedTrackArgsForCall) return len(fake.getPublishedTrackArgsForCall)
} }
func (fake *FakeParticipant) GetPublishedTrackCalls(stub func(string) types.PublishedTrack) { func (fake *FakeParticipant) GetPublishedTrackCalls(stub func(livekit.TrackID) types.PublishedTrack) {
fake.getPublishedTrackMutex.Lock() fake.getPublishedTrackMutex.Lock()
defer fake.getPublishedTrackMutex.Unlock() defer fake.getPublishedTrackMutex.Unlock()
fake.GetPublishedTrackStub = stub fake.GetPublishedTrackStub = stub
} }
func (fake *FakeParticipant) GetPublishedTrackArgsForCall(i int) string { func (fake *FakeParticipant) GetPublishedTrackArgsForCall(i int) livekit.TrackID {
fake.getPublishedTrackMutex.RLock() fake.getPublishedTrackMutex.RLock()
defer fake.getPublishedTrackMutex.RUnlock() defer fake.getPublishedTrackMutex.RUnlock()
argsForCall := fake.getPublishedTrackArgsForCall[i] argsForCall := fake.getPublishedTrackArgsForCall[i]
@@ -1295,7 +1295,7 @@ func (fake *FakeParticipant) GetResponseSinkReturnsOnCall(i int, result1 routing
}{result1} }{result1}
} }
func (fake *FakeParticipant) GetSubscribedParticipants() []string { func (fake *FakeParticipant) GetSubscribedParticipants() []livekit.ParticipantID {
fake.getSubscribedParticipantsMutex.Lock() fake.getSubscribedParticipantsMutex.Lock()
ret, specificReturn := fake.getSubscribedParticipantsReturnsOnCall[len(fake.getSubscribedParticipantsArgsForCall)] ret, specificReturn := fake.getSubscribedParticipantsReturnsOnCall[len(fake.getSubscribedParticipantsArgsForCall)]
fake.getSubscribedParticipantsArgsForCall = append(fake.getSubscribedParticipantsArgsForCall, struct { fake.getSubscribedParticipantsArgsForCall = append(fake.getSubscribedParticipantsArgsForCall, struct {
@@ -1319,40 +1319,40 @@ func (fake *FakeParticipant) GetSubscribedParticipantsCallCount() int {
return len(fake.getSubscribedParticipantsArgsForCall) return len(fake.getSubscribedParticipantsArgsForCall)
} }
func (fake *FakeParticipant) GetSubscribedParticipantsCalls(stub func() []string) { func (fake *FakeParticipant) GetSubscribedParticipantsCalls(stub func() []livekit.ParticipantID) {
fake.getSubscribedParticipantsMutex.Lock() fake.getSubscribedParticipantsMutex.Lock()
defer fake.getSubscribedParticipantsMutex.Unlock() defer fake.getSubscribedParticipantsMutex.Unlock()
fake.GetSubscribedParticipantsStub = stub fake.GetSubscribedParticipantsStub = stub
} }
func (fake *FakeParticipant) GetSubscribedParticipantsReturns(result1 []string) { func (fake *FakeParticipant) GetSubscribedParticipantsReturns(result1 []livekit.ParticipantID) {
fake.getSubscribedParticipantsMutex.Lock() fake.getSubscribedParticipantsMutex.Lock()
defer fake.getSubscribedParticipantsMutex.Unlock() defer fake.getSubscribedParticipantsMutex.Unlock()
fake.GetSubscribedParticipantsStub = nil fake.GetSubscribedParticipantsStub = nil
fake.getSubscribedParticipantsReturns = struct { fake.getSubscribedParticipantsReturns = struct {
result1 []string result1 []livekit.ParticipantID
}{result1} }{result1}
} }
func (fake *FakeParticipant) GetSubscribedParticipantsReturnsOnCall(i int, result1 []string) { func (fake *FakeParticipant) GetSubscribedParticipantsReturnsOnCall(i int, result1 []livekit.ParticipantID) {
fake.getSubscribedParticipantsMutex.Lock() fake.getSubscribedParticipantsMutex.Lock()
defer fake.getSubscribedParticipantsMutex.Unlock() defer fake.getSubscribedParticipantsMutex.Unlock()
fake.GetSubscribedParticipantsStub = nil fake.GetSubscribedParticipantsStub = nil
if fake.getSubscribedParticipantsReturnsOnCall == nil { if fake.getSubscribedParticipantsReturnsOnCall == nil {
fake.getSubscribedParticipantsReturnsOnCall = make(map[int]struct { fake.getSubscribedParticipantsReturnsOnCall = make(map[int]struct {
result1 []string result1 []livekit.ParticipantID
}) })
} }
fake.getSubscribedParticipantsReturnsOnCall[i] = struct { fake.getSubscribedParticipantsReturnsOnCall[i] = struct {
result1 []string result1 []livekit.ParticipantID
}{result1} }{result1}
} }
func (fake *FakeParticipant) GetSubscribedTrack(arg1 string) types.SubscribedTrack { func (fake *FakeParticipant) GetSubscribedTrack(arg1 livekit.TrackID) types.SubscribedTrack {
fake.getSubscribedTrackMutex.Lock() fake.getSubscribedTrackMutex.Lock()
ret, specificReturn := fake.getSubscribedTrackReturnsOnCall[len(fake.getSubscribedTrackArgsForCall)] ret, specificReturn := fake.getSubscribedTrackReturnsOnCall[len(fake.getSubscribedTrackArgsForCall)]
fake.getSubscribedTrackArgsForCall = append(fake.getSubscribedTrackArgsForCall, struct { fake.getSubscribedTrackArgsForCall = append(fake.getSubscribedTrackArgsForCall, struct {
arg1 string arg1 livekit.TrackID
}{arg1}) }{arg1})
stub := fake.GetSubscribedTrackStub stub := fake.GetSubscribedTrackStub
fakeReturns := fake.getSubscribedTrackReturns fakeReturns := fake.getSubscribedTrackReturns
@@ -1373,13 +1373,13 @@ func (fake *FakeParticipant) GetSubscribedTrackCallCount() int {
return len(fake.getSubscribedTrackArgsForCall) return len(fake.getSubscribedTrackArgsForCall)
} }
func (fake *FakeParticipant) GetSubscribedTrackCalls(stub func(string) types.SubscribedTrack) { func (fake *FakeParticipant) GetSubscribedTrackCalls(stub func(livekit.TrackID) types.SubscribedTrack) {
fake.getSubscribedTrackMutex.Lock() fake.getSubscribedTrackMutex.Lock()
defer fake.getSubscribedTrackMutex.Unlock() defer fake.getSubscribedTrackMutex.Unlock()
fake.GetSubscribedTrackStub = stub fake.GetSubscribedTrackStub = stub
} }
func (fake *FakeParticipant) GetSubscribedTrackArgsForCall(i int) string { func (fake *FakeParticipant) GetSubscribedTrackArgsForCall(i int) livekit.TrackID {
fake.getSubscribedTrackMutex.RLock() fake.getSubscribedTrackMutex.RLock()
defer fake.getSubscribedTrackMutex.RUnlock() defer fake.getSubscribedTrackMutex.RUnlock()
argsForCall := fake.getSubscribedTrackArgsForCall[i] argsForCall := fake.getSubscribedTrackArgsForCall[i]
@@ -1693,7 +1693,7 @@ func (fake *FakeParticipant) ICERestartReturnsOnCall(i int, result1 error) {
}{result1} }{result1}
} }
func (fake *FakeParticipant) ID() string { func (fake *FakeParticipant) ID() livekit.ParticipantID {
fake.iDMutex.Lock() fake.iDMutex.Lock()
ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)] ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)]
fake.iDArgsForCall = append(fake.iDArgsForCall, struct { fake.iDArgsForCall = append(fake.iDArgsForCall, struct {
@@ -1717,36 +1717,36 @@ func (fake *FakeParticipant) IDCallCount() int {
return len(fake.iDArgsForCall) return len(fake.iDArgsForCall)
} }
func (fake *FakeParticipant) IDCalls(stub func() string) { func (fake *FakeParticipant) IDCalls(stub func() livekit.ParticipantID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = stub fake.IDStub = stub
} }
func (fake *FakeParticipant) IDReturns(result1 string) { func (fake *FakeParticipant) IDReturns(result1 livekit.ParticipantID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = nil fake.IDStub = nil
fake.iDReturns = struct { fake.iDReturns = struct {
result1 string result1 livekit.ParticipantID
}{result1} }{result1}
} }
func (fake *FakeParticipant) IDReturnsOnCall(i int, result1 string) { func (fake *FakeParticipant) IDReturnsOnCall(i int, result1 livekit.ParticipantID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = nil fake.IDStub = nil
if fake.iDReturnsOnCall == nil { if fake.iDReturnsOnCall == nil {
fake.iDReturnsOnCall = make(map[int]struct { fake.iDReturnsOnCall = make(map[int]struct {
result1 string result1 livekit.ParticipantID
}) })
} }
fake.iDReturnsOnCall[i] = struct { fake.iDReturnsOnCall[i] = struct {
result1 string result1 livekit.ParticipantID
}{result1} }{result1}
} }
func (fake *FakeParticipant) Identity() string { func (fake *FakeParticipant) Identity() livekit.ParticipantIdentity {
fake.identityMutex.Lock() fake.identityMutex.Lock()
ret, specificReturn := fake.identityReturnsOnCall[len(fake.identityArgsForCall)] ret, specificReturn := fake.identityReturnsOnCall[len(fake.identityArgsForCall)]
fake.identityArgsForCall = append(fake.identityArgsForCall, struct { fake.identityArgsForCall = append(fake.identityArgsForCall, struct {
@@ -1770,32 +1770,32 @@ func (fake *FakeParticipant) IdentityCallCount() int {
return len(fake.identityArgsForCall) return len(fake.identityArgsForCall)
} }
func (fake *FakeParticipant) IdentityCalls(stub func() string) { func (fake *FakeParticipant) IdentityCalls(stub func() livekit.ParticipantIdentity) {
fake.identityMutex.Lock() fake.identityMutex.Lock()
defer fake.identityMutex.Unlock() defer fake.identityMutex.Unlock()
fake.IdentityStub = stub fake.IdentityStub = stub
} }
func (fake *FakeParticipant) IdentityReturns(result1 string) { func (fake *FakeParticipant) IdentityReturns(result1 livekit.ParticipantIdentity) {
fake.identityMutex.Lock() fake.identityMutex.Lock()
defer fake.identityMutex.Unlock() defer fake.identityMutex.Unlock()
fake.IdentityStub = nil fake.IdentityStub = nil
fake.identityReturns = struct { fake.identityReturns = struct {
result1 string result1 livekit.ParticipantIdentity
}{result1} }{result1}
} }
func (fake *FakeParticipant) IdentityReturnsOnCall(i int, result1 string) { func (fake *FakeParticipant) IdentityReturnsOnCall(i int, result1 livekit.ParticipantIdentity) {
fake.identityMutex.Lock() fake.identityMutex.Lock()
defer fake.identityMutex.Unlock() defer fake.identityMutex.Unlock()
fake.IdentityStub = nil fake.IdentityStub = nil
if fake.identityReturnsOnCall == nil { if fake.identityReturnsOnCall == nil {
fake.identityReturnsOnCall = make(map[int]struct { fake.identityReturnsOnCall = make(map[int]struct {
result1 string result1 livekit.ParticipantIdentity
}) })
} }
fake.identityReturnsOnCall[i] = struct { fake.identityReturnsOnCall[i] = struct {
result1 string result1 livekit.ParticipantIdentity
}{result1} }{result1}
} }
@@ -1905,11 +1905,11 @@ func (fake *FakeParticipant) IsRecorderReturnsOnCall(i int, result1 bool) {
}{result1} }{result1}
} }
func (fake *FakeParticipant) IsSubscribedTo(arg1 string) bool { func (fake *FakeParticipant) IsSubscribedTo(arg1 livekit.ParticipantID) bool {
fake.isSubscribedToMutex.Lock() fake.isSubscribedToMutex.Lock()
ret, specificReturn := fake.isSubscribedToReturnsOnCall[len(fake.isSubscribedToArgsForCall)] ret, specificReturn := fake.isSubscribedToReturnsOnCall[len(fake.isSubscribedToArgsForCall)]
fake.isSubscribedToArgsForCall = append(fake.isSubscribedToArgsForCall, struct { fake.isSubscribedToArgsForCall = append(fake.isSubscribedToArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
}{arg1}) }{arg1})
stub := fake.IsSubscribedToStub stub := fake.IsSubscribedToStub
fakeReturns := fake.isSubscribedToReturns fakeReturns := fake.isSubscribedToReturns
@@ -1930,13 +1930,13 @@ func (fake *FakeParticipant) IsSubscribedToCallCount() int {
return len(fake.isSubscribedToArgsForCall) return len(fake.isSubscribedToArgsForCall)
} }
func (fake *FakeParticipant) IsSubscribedToCalls(stub func(string) bool) { func (fake *FakeParticipant) IsSubscribedToCalls(stub func(livekit.ParticipantID) bool) {
fake.isSubscribedToMutex.Lock() fake.isSubscribedToMutex.Lock()
defer fake.isSubscribedToMutex.Unlock() defer fake.isSubscribedToMutex.Unlock()
fake.IsSubscribedToStub = stub fake.IsSubscribedToStub = stub
} }
func (fake *FakeParticipant) IsSubscribedToArgsForCall(i int) string { func (fake *FakeParticipant) IsSubscribedToArgsForCall(i int) livekit.ParticipantID {
fake.isSubscribedToMutex.RLock() fake.isSubscribedToMutex.RLock()
defer fake.isSubscribedToMutex.RUnlock() defer fake.isSubscribedToMutex.RUnlock()
argsForCall := fake.isSubscribedToArgsForCall[i] argsForCall := fake.isSubscribedToArgsForCall[i]
@@ -1990,10 +1990,10 @@ func (fake *FakeParticipant) NegotiateCalls(stub func()) {
fake.NegotiateStub = stub fake.NegotiateStub = stub
} }
func (fake *FakeParticipant) OnClose(arg1 func(types.Participant, map[string]string)) { func (fake *FakeParticipant) OnClose(arg1 func(types.Participant, map[livekit.TrackID]livekit.ParticipantID)) {
fake.onCloseMutex.Lock() fake.onCloseMutex.Lock()
fake.onCloseArgsForCall = append(fake.onCloseArgsForCall, struct { fake.onCloseArgsForCall = append(fake.onCloseArgsForCall, struct {
arg1 func(types.Participant, map[string]string) arg1 func(types.Participant, map[livekit.TrackID]livekit.ParticipantID)
}{arg1}) }{arg1})
stub := fake.OnCloseStub stub := fake.OnCloseStub
fake.recordInvocation("OnClose", []interface{}{arg1}) fake.recordInvocation("OnClose", []interface{}{arg1})
@@ -2009,13 +2009,13 @@ func (fake *FakeParticipant) OnCloseCallCount() int {
return len(fake.onCloseArgsForCall) return len(fake.onCloseArgsForCall)
} }
func (fake *FakeParticipant) OnCloseCalls(stub func(func(types.Participant, map[string]string))) { func (fake *FakeParticipant) OnCloseCalls(stub func(func(types.Participant, map[livekit.TrackID]livekit.ParticipantID))) {
fake.onCloseMutex.Lock() fake.onCloseMutex.Lock()
defer fake.onCloseMutex.Unlock() defer fake.onCloseMutex.Unlock()
fake.OnCloseStub = stub fake.OnCloseStub = stub
} }
func (fake *FakeParticipant) OnCloseArgsForCall(i int) func(types.Participant, map[string]string) { func (fake *FakeParticipant) OnCloseArgsForCall(i int) func(types.Participant, map[livekit.TrackID]livekit.ParticipantID) {
fake.onCloseMutex.RLock() fake.onCloseMutex.RLock()
defer fake.onCloseMutex.RUnlock() defer fake.onCloseMutex.RUnlock()
argsForCall := fake.onCloseArgsForCall[i] argsForCall := fake.onCloseArgsForCall[i]
@@ -2267,11 +2267,11 @@ func (fake *FakeParticipant) RemoveSubscribedTrackArgsForCall(i int) types.Subsc
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeParticipant) RemoveSubscriber(arg1 types.Participant, arg2 string) { func (fake *FakeParticipant) RemoveSubscriber(arg1 types.Participant, arg2 livekit.TrackID) {
fake.removeSubscriberMutex.Lock() fake.removeSubscriberMutex.Lock()
fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct { fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct {
arg1 types.Participant arg1 types.Participant
arg2 string arg2 livekit.TrackID
}{arg1, arg2}) }{arg1, arg2})
stub := fake.RemoveSubscriberStub stub := fake.RemoveSubscriberStub
fake.recordInvocation("RemoveSubscriber", []interface{}{arg1, arg2}) fake.recordInvocation("RemoveSubscriber", []interface{}{arg1, arg2})
@@ -2287,13 +2287,13 @@ func (fake *FakeParticipant) RemoveSubscriberCallCount() int {
return len(fake.removeSubscriberArgsForCall) return len(fake.removeSubscriberArgsForCall)
} }
func (fake *FakeParticipant) RemoveSubscriberCalls(stub func(types.Participant, string)) { func (fake *FakeParticipant) RemoveSubscriberCalls(stub func(types.Participant, livekit.TrackID)) {
fake.removeSubscriberMutex.Lock() fake.removeSubscriberMutex.Lock()
defer fake.removeSubscriberMutex.Unlock() defer fake.removeSubscriberMutex.Unlock()
fake.RemoveSubscriberStub = stub fake.RemoveSubscriberStub = stub
} }
func (fake *FakeParticipant) RemoveSubscriberArgsForCall(i int) (types.Participant, string) { func (fake *FakeParticipant) RemoveSubscriberArgsForCall(i int) (types.Participant, livekit.TrackID) {
fake.removeSubscriberMutex.RLock() fake.removeSubscriberMutex.RLock()
defer fake.removeSubscriberMutex.RUnlock() defer fake.removeSubscriberMutex.RUnlock()
argsForCall := fake.removeSubscriberArgsForCall[i] argsForCall := fake.removeSubscriberArgsForCall[i]
@@ -2785,10 +2785,10 @@ func (fake *FakeParticipant) SetResponseSinkArgsForCall(i int) routing.MessageSi
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeParticipant) SetTrackMuted(arg1 string, arg2 bool, arg3 bool) { func (fake *FakeParticipant) SetTrackMuted(arg1 livekit.TrackID, arg2 bool, arg3 bool) {
fake.setTrackMutedMutex.Lock() fake.setTrackMutedMutex.Lock()
fake.setTrackMutedArgsForCall = append(fake.setTrackMutedArgsForCall, struct { fake.setTrackMutedArgsForCall = append(fake.setTrackMutedArgsForCall, struct {
arg1 string arg1 livekit.TrackID
arg2 bool arg2 bool
arg3 bool arg3 bool
}{arg1, arg2, arg3}) }{arg1, arg2, arg3})
@@ -2806,13 +2806,13 @@ func (fake *FakeParticipant) SetTrackMutedCallCount() int {
return len(fake.setTrackMutedArgsForCall) return len(fake.setTrackMutedArgsForCall)
} }
func (fake *FakeParticipant) SetTrackMutedCalls(stub func(string, bool, bool)) { func (fake *FakeParticipant) SetTrackMutedCalls(stub func(livekit.TrackID, bool, bool)) {
fake.setTrackMutedMutex.Lock() fake.setTrackMutedMutex.Lock()
defer fake.setTrackMutedMutex.Unlock() defer fake.setTrackMutedMutex.Unlock()
fake.SetTrackMutedStub = stub fake.SetTrackMutedStub = stub
} }
func (fake *FakeParticipant) SetTrackMutedArgsForCall(i int) (string, bool, bool) { func (fake *FakeParticipant) SetTrackMutedArgsForCall(i int) (livekit.TrackID, bool, bool) {
fake.setTrackMutedMutex.RLock() fake.setTrackMutedMutex.RLock()
defer fake.setTrackMutedMutex.RUnlock() defer fake.setTrackMutedMutex.RUnlock()
argsForCall := fake.setTrackMutedArgsForCall[i] argsForCall := fake.setTrackMutedArgsForCall[i]
@@ -3055,11 +3055,11 @@ func (fake *FakeParticipant) SubscriberPCReturnsOnCall(i int, result1 *webrtc.Pe
}{result1} }{result1}
} }
func (fake *FakeParticipant) SubscriptionPermissionUpdate(arg1 string, arg2 string, arg3 bool) { func (fake *FakeParticipant) SubscriptionPermissionUpdate(arg1 livekit.ParticipantID, arg2 livekit.TrackID, arg3 bool) {
fake.subscriptionPermissionUpdateMutex.Lock() fake.subscriptionPermissionUpdateMutex.Lock()
fake.subscriptionPermissionUpdateArgsForCall = append(fake.subscriptionPermissionUpdateArgsForCall, struct { fake.subscriptionPermissionUpdateArgsForCall = append(fake.subscriptionPermissionUpdateArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
arg2 string arg2 livekit.TrackID
arg3 bool arg3 bool
}{arg1, arg2, arg3}) }{arg1, arg2, arg3})
stub := fake.SubscriptionPermissionUpdateStub stub := fake.SubscriptionPermissionUpdateStub
@@ -3076,13 +3076,13 @@ func (fake *FakeParticipant) SubscriptionPermissionUpdateCallCount() int {
return len(fake.subscriptionPermissionUpdateArgsForCall) return len(fake.subscriptionPermissionUpdateArgsForCall)
} }
func (fake *FakeParticipant) SubscriptionPermissionUpdateCalls(stub func(string, string, bool)) { func (fake *FakeParticipant) SubscriptionPermissionUpdateCalls(stub func(livekit.ParticipantID, livekit.TrackID, bool)) {
fake.subscriptionPermissionUpdateMutex.Lock() fake.subscriptionPermissionUpdateMutex.Lock()
defer fake.subscriptionPermissionUpdateMutex.Unlock() defer fake.subscriptionPermissionUpdateMutex.Unlock()
fake.SubscriptionPermissionUpdateStub = stub fake.SubscriptionPermissionUpdateStub = stub
} }
func (fake *FakeParticipant) SubscriptionPermissionUpdateArgsForCall(i int) (string, string, bool) { func (fake *FakeParticipant) SubscriptionPermissionUpdateArgsForCall(i int) (livekit.ParticipantID, livekit.TrackID, bool) {
fake.subscriptionPermissionUpdateMutex.RLock() fake.subscriptionPermissionUpdateMutex.RLock()
defer fake.subscriptionPermissionUpdateMutex.RUnlock() defer fake.subscriptionPermissionUpdateMutex.RUnlock()
argsForCall := fake.subscriptionPermissionUpdateArgsForCall[i] argsForCall := fake.subscriptionPermissionUpdateArgsForCall[i]
@@ -3142,12 +3142,12 @@ func (fake *FakeParticipant) ToProtoReturnsOnCall(i int, result1 *livekit.Partic
}{result1} }{result1}
} }
func (fake *FakeParticipant) UpdateSubscriptionPermissions(arg1 *livekit.UpdateSubscriptionPermissions, arg2 func(participantID string) types.Participant) error { func (fake *FakeParticipant) UpdateSubscriptionPermissions(arg1 *livekit.UpdateSubscriptionPermissions, arg2 func(participantID livekit.ParticipantID) types.Participant) error {
fake.updateSubscriptionPermissionsMutex.Lock() fake.updateSubscriptionPermissionsMutex.Lock()
ret, specificReturn := fake.updateSubscriptionPermissionsReturnsOnCall[len(fake.updateSubscriptionPermissionsArgsForCall)] ret, specificReturn := fake.updateSubscriptionPermissionsReturnsOnCall[len(fake.updateSubscriptionPermissionsArgsForCall)]
fake.updateSubscriptionPermissionsArgsForCall = append(fake.updateSubscriptionPermissionsArgsForCall, struct { fake.updateSubscriptionPermissionsArgsForCall = append(fake.updateSubscriptionPermissionsArgsForCall, struct {
arg1 *livekit.UpdateSubscriptionPermissions arg1 *livekit.UpdateSubscriptionPermissions
arg2 func(participantID string) types.Participant arg2 func(participantID livekit.ParticipantID) types.Participant
}{arg1, arg2}) }{arg1, arg2})
stub := fake.UpdateSubscriptionPermissionsStub stub := fake.UpdateSubscriptionPermissionsStub
fakeReturns := fake.updateSubscriptionPermissionsReturns fakeReturns := fake.updateSubscriptionPermissionsReturns
@@ -3168,13 +3168,13 @@ func (fake *FakeParticipant) UpdateSubscriptionPermissionsCallCount() int {
return len(fake.updateSubscriptionPermissionsArgsForCall) return len(fake.updateSubscriptionPermissionsArgsForCall)
} }
func (fake *FakeParticipant) UpdateSubscriptionPermissionsCalls(stub func(*livekit.UpdateSubscriptionPermissions, func(participantID string) types.Participant) error) { func (fake *FakeParticipant) UpdateSubscriptionPermissionsCalls(stub func(*livekit.UpdateSubscriptionPermissions, func(participantID livekit.ParticipantID) types.Participant) error) {
fake.updateSubscriptionPermissionsMutex.Lock() fake.updateSubscriptionPermissionsMutex.Lock()
defer fake.updateSubscriptionPermissionsMutex.Unlock() defer fake.updateSubscriptionPermissionsMutex.Unlock()
fake.UpdateSubscriptionPermissionsStub = stub fake.UpdateSubscriptionPermissionsStub = stub
} }
func (fake *FakeParticipant) UpdateSubscriptionPermissionsArgsForCall(i int) (*livekit.UpdateSubscriptionPermissions, func(participantID string) types.Participant) { func (fake *FakeParticipant) UpdateSubscriptionPermissionsArgsForCall(i int) (*livekit.UpdateSubscriptionPermissions, func(participantID livekit.ParticipantID) types.Participant) {
fake.updateSubscriptionPermissionsMutex.RLock() fake.updateSubscriptionPermissionsMutex.RLock()
defer fake.updateSubscriptionPermissionsMutex.RUnlock() defer fake.updateSubscriptionPermissionsMutex.RUnlock()
argsForCall := fake.updateSubscriptionPermissionsArgsForCall[i] argsForCall := fake.updateSubscriptionPermissionsArgsForCall[i]
@@ -48,15 +48,15 @@ type FakePublishedTrack struct {
getQualityForDimensionReturnsOnCall map[int]struct { getQualityForDimensionReturnsOnCall map[int]struct {
result1 livekit.VideoQuality result1 livekit.VideoQuality
} }
IDStub func() string IDStub func() livekit.TrackID
iDMutex sync.RWMutex iDMutex sync.RWMutex
iDArgsForCall []struct { iDArgsForCall []struct {
} }
iDReturns struct { iDReturns struct {
result1 string result1 livekit.TrackID
} }
iDReturnsOnCall map[int]struct { iDReturnsOnCall map[int]struct {
result1 string result1 livekit.TrackID
} }
IsMutedStub func() bool IsMutedStub func() bool
isMutedMutex sync.RWMutex isMutedMutex sync.RWMutex
@@ -78,10 +78,10 @@ type FakePublishedTrack struct {
isSimulcastReturnsOnCall map[int]struct { isSimulcastReturnsOnCall map[int]struct {
result1 bool result1 bool
} }
IsSubscriberStub func(string) bool IsSubscriberStub func(livekit.ParticipantID) bool
isSubscriberMutex sync.RWMutex isSubscriberMutex sync.RWMutex
isSubscriberArgsForCall []struct { isSubscriberArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
} }
isSubscriberReturns struct { isSubscriberReturns struct {
result1 bool result1 bool
@@ -109,16 +109,16 @@ type FakePublishedTrack struct {
nameReturnsOnCall map[int]struct { nameReturnsOnCall map[int]struct {
result1 string result1 string
} }
NotifySubscriberMaxQualityStub func(string, livekit.VideoQuality) NotifySubscriberMaxQualityStub func(livekit.ParticipantID, livekit.VideoQuality)
notifySubscriberMaxQualityMutex sync.RWMutex notifySubscriberMaxQualityMutex sync.RWMutex
notifySubscriberMaxQualityArgsForCall []struct { notifySubscriberMaxQualityArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
arg2 livekit.VideoQuality arg2 livekit.VideoQuality
} }
NotifySubscriberMuteStub func(string) NotifySubscriberMuteStub func(livekit.ParticipantID)
notifySubscriberMuteMutex sync.RWMutex notifySubscriberMuteMutex sync.RWMutex
notifySubscriberMuteArgsForCall []struct { notifySubscriberMuteArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
} }
NumUpTracksStub func() (uint32, uint32) NumUpTracksStub func() (uint32, uint32)
numUpTracksMutex sync.RWMutex numUpTracksMutex sync.RWMutex
@@ -156,21 +156,21 @@ type FakePublishedTrack struct {
removeAllSubscribersMutex sync.RWMutex removeAllSubscribersMutex sync.RWMutex
removeAllSubscribersArgsForCall []struct { removeAllSubscribersArgsForCall []struct {
} }
RemoveSubscriberStub func(string) RemoveSubscriberStub func(livekit.ParticipantID)
removeSubscriberMutex sync.RWMutex removeSubscriberMutex sync.RWMutex
removeSubscriberArgsForCall []struct { removeSubscriberArgsForCall []struct {
arg1 string arg1 livekit.ParticipantID
} }
RevokeDisallowedSubscribersStub func([]string) []string RevokeDisallowedSubscribersStub func([]livekit.ParticipantID) []livekit.ParticipantID
revokeDisallowedSubscribersMutex sync.RWMutex revokeDisallowedSubscribersMutex sync.RWMutex
revokeDisallowedSubscribersArgsForCall []struct { revokeDisallowedSubscribersArgsForCall []struct {
arg1 []string arg1 []livekit.ParticipantID
} }
revokeDisallowedSubscribersReturns struct { revokeDisallowedSubscribersReturns struct {
result1 []string result1 []livekit.ParticipantID
} }
revokeDisallowedSubscribersReturnsOnCall map[int]struct { revokeDisallowedSubscribersReturnsOnCall map[int]struct {
result1 []string result1 []livekit.ParticipantID
} }
SdpCidStub func() string SdpCidStub func() string
sdpCidMutex sync.RWMutex sdpCidMutex sync.RWMutex
@@ -434,7 +434,7 @@ func (fake *FakePublishedTrack) GetQualityForDimensionReturnsOnCall(i int, resul
}{result1} }{result1}
} }
func (fake *FakePublishedTrack) ID() string { func (fake *FakePublishedTrack) ID() livekit.TrackID {
fake.iDMutex.Lock() fake.iDMutex.Lock()
ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)] ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)]
fake.iDArgsForCall = append(fake.iDArgsForCall, struct { fake.iDArgsForCall = append(fake.iDArgsForCall, struct {
@@ -458,32 +458,32 @@ func (fake *FakePublishedTrack) IDCallCount() int {
return len(fake.iDArgsForCall) return len(fake.iDArgsForCall)
} }
func (fake *FakePublishedTrack) IDCalls(stub func() string) { func (fake *FakePublishedTrack) IDCalls(stub func() livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = stub fake.IDStub = stub
} }
func (fake *FakePublishedTrack) IDReturns(result1 string) { func (fake *FakePublishedTrack) IDReturns(result1 livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = nil fake.IDStub = nil
fake.iDReturns = struct { fake.iDReturns = struct {
result1 string result1 livekit.TrackID
}{result1} }{result1}
} }
func (fake *FakePublishedTrack) IDReturnsOnCall(i int, result1 string) { func (fake *FakePublishedTrack) IDReturnsOnCall(i int, result1 livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = nil fake.IDStub = nil
if fake.iDReturnsOnCall == nil { if fake.iDReturnsOnCall == nil {
fake.iDReturnsOnCall = make(map[int]struct { fake.iDReturnsOnCall = make(map[int]struct {
result1 string result1 livekit.TrackID
}) })
} }
fake.iDReturnsOnCall[i] = struct { fake.iDReturnsOnCall[i] = struct {
result1 string result1 livekit.TrackID
}{result1} }{result1}
} }
@@ -593,11 +593,11 @@ func (fake *FakePublishedTrack) IsSimulcastReturnsOnCall(i int, result1 bool) {
}{result1} }{result1}
} }
func (fake *FakePublishedTrack) IsSubscriber(arg1 string) bool { func (fake *FakePublishedTrack) IsSubscriber(arg1 livekit.ParticipantID) bool {
fake.isSubscriberMutex.Lock() fake.isSubscriberMutex.Lock()
ret, specificReturn := fake.isSubscriberReturnsOnCall[len(fake.isSubscriberArgsForCall)] ret, specificReturn := fake.isSubscriberReturnsOnCall[len(fake.isSubscriberArgsForCall)]
fake.isSubscriberArgsForCall = append(fake.isSubscriberArgsForCall, struct { fake.isSubscriberArgsForCall = append(fake.isSubscriberArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
}{arg1}) }{arg1})
stub := fake.IsSubscriberStub stub := fake.IsSubscriberStub
fakeReturns := fake.isSubscriberReturns fakeReturns := fake.isSubscriberReturns
@@ -618,13 +618,13 @@ func (fake *FakePublishedTrack) IsSubscriberCallCount() int {
return len(fake.isSubscriberArgsForCall) return len(fake.isSubscriberArgsForCall)
} }
func (fake *FakePublishedTrack) IsSubscriberCalls(stub func(string) bool) { func (fake *FakePublishedTrack) IsSubscriberCalls(stub func(livekit.ParticipantID) bool) {
fake.isSubscriberMutex.Lock() fake.isSubscriberMutex.Lock()
defer fake.isSubscriberMutex.Unlock() defer fake.isSubscriberMutex.Unlock()
fake.IsSubscriberStub = stub fake.IsSubscriberStub = stub
} }
func (fake *FakePublishedTrack) IsSubscriberArgsForCall(i int) string { func (fake *FakePublishedTrack) IsSubscriberArgsForCall(i int) livekit.ParticipantID {
fake.isSubscriberMutex.RLock() fake.isSubscriberMutex.RLock()
defer fake.isSubscriberMutex.RUnlock() defer fake.isSubscriberMutex.RUnlock()
argsForCall := fake.isSubscriberArgsForCall[i] argsForCall := fake.isSubscriberArgsForCall[i]
@@ -760,10 +760,10 @@ func (fake *FakePublishedTrack) NameReturnsOnCall(i int, result1 string) {
}{result1} }{result1}
} }
func (fake *FakePublishedTrack) NotifySubscriberMaxQuality(arg1 string, arg2 livekit.VideoQuality) { func (fake *FakePublishedTrack) NotifySubscriberMaxQuality(arg1 livekit.ParticipantID, arg2 livekit.VideoQuality) {
fake.notifySubscriberMaxQualityMutex.Lock() fake.notifySubscriberMaxQualityMutex.Lock()
fake.notifySubscriberMaxQualityArgsForCall = append(fake.notifySubscriberMaxQualityArgsForCall, struct { fake.notifySubscriberMaxQualityArgsForCall = append(fake.notifySubscriberMaxQualityArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
arg2 livekit.VideoQuality arg2 livekit.VideoQuality
}{arg1, arg2}) }{arg1, arg2})
stub := fake.NotifySubscriberMaxQualityStub stub := fake.NotifySubscriberMaxQualityStub
@@ -780,23 +780,23 @@ func (fake *FakePublishedTrack) NotifySubscriberMaxQualityCallCount() int {
return len(fake.notifySubscriberMaxQualityArgsForCall) return len(fake.notifySubscriberMaxQualityArgsForCall)
} }
func (fake *FakePublishedTrack) NotifySubscriberMaxQualityCalls(stub func(string, livekit.VideoQuality)) { func (fake *FakePublishedTrack) NotifySubscriberMaxQualityCalls(stub func(livekit.ParticipantID, livekit.VideoQuality)) {
fake.notifySubscriberMaxQualityMutex.Lock() fake.notifySubscriberMaxQualityMutex.Lock()
defer fake.notifySubscriberMaxQualityMutex.Unlock() defer fake.notifySubscriberMaxQualityMutex.Unlock()
fake.NotifySubscriberMaxQualityStub = stub fake.NotifySubscriberMaxQualityStub = stub
} }
func (fake *FakePublishedTrack) NotifySubscriberMaxQualityArgsForCall(i int) (string, livekit.VideoQuality) { func (fake *FakePublishedTrack) NotifySubscriberMaxQualityArgsForCall(i int) (livekit.ParticipantID, livekit.VideoQuality) {
fake.notifySubscriberMaxQualityMutex.RLock() fake.notifySubscriberMaxQualityMutex.RLock()
defer fake.notifySubscriberMaxQualityMutex.RUnlock() defer fake.notifySubscriberMaxQualityMutex.RUnlock()
argsForCall := fake.notifySubscriberMaxQualityArgsForCall[i] argsForCall := fake.notifySubscriberMaxQualityArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2 return argsForCall.arg1, argsForCall.arg2
} }
func (fake *FakePublishedTrack) NotifySubscriberMute(arg1 string) { func (fake *FakePublishedTrack) NotifySubscriberMute(arg1 livekit.ParticipantID) {
fake.notifySubscriberMuteMutex.Lock() fake.notifySubscriberMuteMutex.Lock()
fake.notifySubscriberMuteArgsForCall = append(fake.notifySubscriberMuteArgsForCall, struct { fake.notifySubscriberMuteArgsForCall = append(fake.notifySubscriberMuteArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
}{arg1}) }{arg1})
stub := fake.NotifySubscriberMuteStub stub := fake.NotifySubscriberMuteStub
fake.recordInvocation("NotifySubscriberMute", []interface{}{arg1}) fake.recordInvocation("NotifySubscriberMute", []interface{}{arg1})
@@ -812,13 +812,13 @@ func (fake *FakePublishedTrack) NotifySubscriberMuteCallCount() int {
return len(fake.notifySubscriberMuteArgsForCall) return len(fake.notifySubscriberMuteArgsForCall)
} }
func (fake *FakePublishedTrack) NotifySubscriberMuteCalls(stub func(string)) { func (fake *FakePublishedTrack) NotifySubscriberMuteCalls(stub func(livekit.ParticipantID)) {
fake.notifySubscriberMuteMutex.Lock() fake.notifySubscriberMuteMutex.Lock()
defer fake.notifySubscriberMuteMutex.Unlock() defer fake.notifySubscriberMuteMutex.Unlock()
fake.NotifySubscriberMuteStub = stub fake.NotifySubscriberMuteStub = stub
} }
func (fake *FakePublishedTrack) NotifySubscriberMuteArgsForCall(i int) string { func (fake *FakePublishedTrack) NotifySubscriberMuteArgsForCall(i int) livekit.ParticipantID {
fake.notifySubscriberMuteMutex.RLock() fake.notifySubscriberMuteMutex.RLock()
defer fake.notifySubscriberMuteMutex.RUnlock() defer fake.notifySubscriberMuteMutex.RUnlock()
argsForCall := fake.notifySubscriberMuteArgsForCall[i] argsForCall := fake.notifySubscriberMuteArgsForCall[i]
@@ -1011,10 +1011,10 @@ func (fake *FakePublishedTrack) RemoveAllSubscribersCalls(stub func()) {
fake.RemoveAllSubscribersStub = stub fake.RemoveAllSubscribersStub = stub
} }
func (fake *FakePublishedTrack) RemoveSubscriber(arg1 string) { func (fake *FakePublishedTrack) RemoveSubscriber(arg1 livekit.ParticipantID) {
fake.removeSubscriberMutex.Lock() fake.removeSubscriberMutex.Lock()
fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct { fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct {
arg1 string arg1 livekit.ParticipantID
}{arg1}) }{arg1})
stub := fake.RemoveSubscriberStub stub := fake.RemoveSubscriberStub
fake.recordInvocation("RemoveSubscriber", []interface{}{arg1}) fake.recordInvocation("RemoveSubscriber", []interface{}{arg1})
@@ -1030,29 +1030,29 @@ func (fake *FakePublishedTrack) RemoveSubscriberCallCount() int {
return len(fake.removeSubscriberArgsForCall) return len(fake.removeSubscriberArgsForCall)
} }
func (fake *FakePublishedTrack) RemoveSubscriberCalls(stub func(string)) { func (fake *FakePublishedTrack) RemoveSubscriberCalls(stub func(livekit.ParticipantID)) {
fake.removeSubscriberMutex.Lock() fake.removeSubscriberMutex.Lock()
defer fake.removeSubscriberMutex.Unlock() defer fake.removeSubscriberMutex.Unlock()
fake.RemoveSubscriberStub = stub fake.RemoveSubscriberStub = stub
} }
func (fake *FakePublishedTrack) RemoveSubscriberArgsForCall(i int) string { func (fake *FakePublishedTrack) RemoveSubscriberArgsForCall(i int) livekit.ParticipantID {
fake.removeSubscriberMutex.RLock() fake.removeSubscriberMutex.RLock()
defer fake.removeSubscriberMutex.RUnlock() defer fake.removeSubscriberMutex.RUnlock()
argsForCall := fake.removeSubscriberArgsForCall[i] argsForCall := fake.removeSubscriberArgsForCall[i]
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakePublishedTrack) RevokeDisallowedSubscribers(arg1 []string) []string { func (fake *FakePublishedTrack) RevokeDisallowedSubscribers(arg1 []livekit.ParticipantID) []livekit.ParticipantID {
var arg1Copy []string var arg1Copy []livekit.ParticipantID
if arg1 != nil { if arg1 != nil {
arg1Copy = make([]string, len(arg1)) arg1Copy = make([]livekit.ParticipantID, len(arg1))
copy(arg1Copy, arg1) copy(arg1Copy, arg1)
} }
fake.revokeDisallowedSubscribersMutex.Lock() fake.revokeDisallowedSubscribersMutex.Lock()
ret, specificReturn := fake.revokeDisallowedSubscribersReturnsOnCall[len(fake.revokeDisallowedSubscribersArgsForCall)] ret, specificReturn := fake.revokeDisallowedSubscribersReturnsOnCall[len(fake.revokeDisallowedSubscribersArgsForCall)]
fake.revokeDisallowedSubscribersArgsForCall = append(fake.revokeDisallowedSubscribersArgsForCall, struct { fake.revokeDisallowedSubscribersArgsForCall = append(fake.revokeDisallowedSubscribersArgsForCall, struct {
arg1 []string arg1 []livekit.ParticipantID
}{arg1Copy}) }{arg1Copy})
stub := fake.RevokeDisallowedSubscribersStub stub := fake.RevokeDisallowedSubscribersStub
fakeReturns := fake.revokeDisallowedSubscribersReturns fakeReturns := fake.revokeDisallowedSubscribersReturns
@@ -1073,39 +1073,39 @@ func (fake *FakePublishedTrack) RevokeDisallowedSubscribersCallCount() int {
return len(fake.revokeDisallowedSubscribersArgsForCall) return len(fake.revokeDisallowedSubscribersArgsForCall)
} }
func (fake *FakePublishedTrack) RevokeDisallowedSubscribersCalls(stub func([]string) []string) { func (fake *FakePublishedTrack) RevokeDisallowedSubscribersCalls(stub func([]livekit.ParticipantID) []livekit.ParticipantID) {
fake.revokeDisallowedSubscribersMutex.Lock() fake.revokeDisallowedSubscribersMutex.Lock()
defer fake.revokeDisallowedSubscribersMutex.Unlock() defer fake.revokeDisallowedSubscribersMutex.Unlock()
fake.RevokeDisallowedSubscribersStub = stub fake.RevokeDisallowedSubscribersStub = stub
} }
func (fake *FakePublishedTrack) RevokeDisallowedSubscribersArgsForCall(i int) []string { func (fake *FakePublishedTrack) RevokeDisallowedSubscribersArgsForCall(i int) []livekit.ParticipantID {
fake.revokeDisallowedSubscribersMutex.RLock() fake.revokeDisallowedSubscribersMutex.RLock()
defer fake.revokeDisallowedSubscribersMutex.RUnlock() defer fake.revokeDisallowedSubscribersMutex.RUnlock()
argsForCall := fake.revokeDisallowedSubscribersArgsForCall[i] argsForCall := fake.revokeDisallowedSubscribersArgsForCall[i]
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakePublishedTrack) RevokeDisallowedSubscribersReturns(result1 []string) { func (fake *FakePublishedTrack) RevokeDisallowedSubscribersReturns(result1 []livekit.ParticipantID) {
fake.revokeDisallowedSubscribersMutex.Lock() fake.revokeDisallowedSubscribersMutex.Lock()
defer fake.revokeDisallowedSubscribersMutex.Unlock() defer fake.revokeDisallowedSubscribersMutex.Unlock()
fake.RevokeDisallowedSubscribersStub = nil fake.RevokeDisallowedSubscribersStub = nil
fake.revokeDisallowedSubscribersReturns = struct { fake.revokeDisallowedSubscribersReturns = struct {
result1 []string result1 []livekit.ParticipantID
}{result1} }{result1}
} }
func (fake *FakePublishedTrack) RevokeDisallowedSubscribersReturnsOnCall(i int, result1 []string) { func (fake *FakePublishedTrack) RevokeDisallowedSubscribersReturnsOnCall(i int, result1 []livekit.ParticipantID) {
fake.revokeDisallowedSubscribersMutex.Lock() fake.revokeDisallowedSubscribersMutex.Lock()
defer fake.revokeDisallowedSubscribersMutex.Unlock() defer fake.revokeDisallowedSubscribersMutex.Unlock()
fake.RevokeDisallowedSubscribersStub = nil fake.RevokeDisallowedSubscribersStub = nil
if fake.revokeDisallowedSubscribersReturnsOnCall == nil { if fake.revokeDisallowedSubscribersReturnsOnCall == nil {
fake.revokeDisallowedSubscribersReturnsOnCall = make(map[int]struct { fake.revokeDisallowedSubscribersReturnsOnCall = make(map[int]struct {
result1 []string result1 []livekit.ParticipantID
}) })
} }
fake.revokeDisallowedSubscribersReturnsOnCall[i] = struct { fake.revokeDisallowedSubscribersReturnsOnCall[i] = struct {
result1 []string result1 []livekit.ParticipantID
}{result1} }{result1}
} }
+8 -8
View File
@@ -31,11 +31,11 @@ type FakeRoom struct {
updateSubscriptionPermissionsReturnsOnCall map[int]struct { updateSubscriptionPermissionsReturnsOnCall map[int]struct {
result1 error result1 error
} }
UpdateSubscriptionsStub func(types.Participant, []string, []*livekit.ParticipantTracks, bool) error UpdateSubscriptionsStub func(types.Participant, []livekit.TrackID, []*livekit.ParticipantTracks, bool) error
updateSubscriptionsMutex sync.RWMutex updateSubscriptionsMutex sync.RWMutex
updateSubscriptionsArgsForCall []struct { updateSubscriptionsArgsForCall []struct {
arg1 types.Participant arg1 types.Participant
arg2 []string arg2 []livekit.TrackID
arg3 []*livekit.ParticipantTracks arg3 []*livekit.ParticipantTracks
arg4 bool arg4 bool
} }
@@ -164,10 +164,10 @@ func (fake *FakeRoom) UpdateSubscriptionPermissionsReturnsOnCall(i int, result1
}{result1} }{result1}
} }
func (fake *FakeRoom) UpdateSubscriptions(arg1 types.Participant, arg2 []string, arg3 []*livekit.ParticipantTracks, arg4 bool) error { func (fake *FakeRoom) UpdateSubscriptions(arg1 types.Participant, arg2 []livekit.TrackID, arg3 []*livekit.ParticipantTracks, arg4 bool) error {
var arg2Copy []string var arg2Copy []livekit.TrackID
if arg2 != nil { if arg2 != nil {
arg2Copy = make([]string, len(arg2)) arg2Copy = make([]livekit.TrackID, len(arg2))
copy(arg2Copy, arg2) copy(arg2Copy, arg2)
} }
var arg3Copy []*livekit.ParticipantTracks var arg3Copy []*livekit.ParticipantTracks
@@ -179,7 +179,7 @@ func (fake *FakeRoom) UpdateSubscriptions(arg1 types.Participant, arg2 []string,
ret, specificReturn := fake.updateSubscriptionsReturnsOnCall[len(fake.updateSubscriptionsArgsForCall)] ret, specificReturn := fake.updateSubscriptionsReturnsOnCall[len(fake.updateSubscriptionsArgsForCall)]
fake.updateSubscriptionsArgsForCall = append(fake.updateSubscriptionsArgsForCall, struct { fake.updateSubscriptionsArgsForCall = append(fake.updateSubscriptionsArgsForCall, struct {
arg1 types.Participant arg1 types.Participant
arg2 []string arg2 []livekit.TrackID
arg3 []*livekit.ParticipantTracks arg3 []*livekit.ParticipantTracks
arg4 bool arg4 bool
}{arg1, arg2Copy, arg3Copy, arg4}) }{arg1, arg2Copy, arg3Copy, arg4})
@@ -202,13 +202,13 @@ func (fake *FakeRoom) UpdateSubscriptionsCallCount() int {
return len(fake.updateSubscriptionsArgsForCall) return len(fake.updateSubscriptionsArgsForCall)
} }
func (fake *FakeRoom) UpdateSubscriptionsCalls(stub func(types.Participant, []string, []*livekit.ParticipantTracks, bool) error) { func (fake *FakeRoom) UpdateSubscriptionsCalls(stub func(types.Participant, []livekit.TrackID, []*livekit.ParticipantTracks, bool) error) {
fake.updateSubscriptionsMutex.Lock() fake.updateSubscriptionsMutex.Lock()
defer fake.updateSubscriptionsMutex.Unlock() defer fake.updateSubscriptionsMutex.Unlock()
fake.UpdateSubscriptionsStub = stub fake.UpdateSubscriptionsStub = stub
} }
func (fake *FakeRoom) UpdateSubscriptionsArgsForCall(i int) (types.Participant, []string, []*livekit.ParticipantTracks, bool) { func (fake *FakeRoom) UpdateSubscriptionsArgsForCall(i int) (types.Participant, []livekit.TrackID, []*livekit.ParticipantTracks, bool) {
fake.updateSubscriptionsMutex.RLock() fake.updateSubscriptionsMutex.RLock()
defer fake.updateSubscriptionsMutex.RUnlock() defer fake.updateSubscriptionsMutex.RUnlock()
argsForCall := fake.updateSubscriptionsArgsForCall[i] argsForCall := fake.updateSubscriptionsArgsForCall[i]
@@ -20,15 +20,15 @@ type FakeSubscribedTrack struct {
downTrackReturnsOnCall map[int]struct { downTrackReturnsOnCall map[int]struct {
result1 *sfu.DownTrack result1 *sfu.DownTrack
} }
IDStub func() string IDStub func() livekit.TrackID
iDMutex sync.RWMutex iDMutex sync.RWMutex
iDArgsForCall []struct { iDArgsForCall []struct {
} }
iDReturns struct { iDReturns struct {
result1 string result1 livekit.TrackID
} }
iDReturnsOnCall map[int]struct { iDReturnsOnCall map[int]struct {
result1 string result1 livekit.TrackID
} }
IsMutedStub func() bool IsMutedStub func() bool
isMutedMutex sync.RWMutex isMutedMutex sync.RWMutex
@@ -55,25 +55,25 @@ type FakeSubscribedTrack struct {
onBindArgsForCall []struct { onBindArgsForCall []struct {
arg1 func() arg1 func()
} }
PublisherIDStub func() string PublisherIDStub func() livekit.ParticipantID
publisherIDMutex sync.RWMutex publisherIDMutex sync.RWMutex
publisherIDArgsForCall []struct { publisherIDArgsForCall []struct {
} }
publisherIDReturns struct { publisherIDReturns struct {
result1 string result1 livekit.ParticipantID
} }
publisherIDReturnsOnCall map[int]struct { publisherIDReturnsOnCall map[int]struct {
result1 string result1 livekit.ParticipantID
} }
PublisherIdentityStub func() string PublisherIdentityStub func() livekit.ParticipantIdentity
publisherIdentityMutex sync.RWMutex publisherIdentityMutex sync.RWMutex
publisherIdentityArgsForCall []struct { publisherIdentityArgsForCall []struct {
} }
publisherIdentityReturns struct { publisherIdentityReturns struct {
result1 string result1 livekit.ParticipantIdentity
} }
publisherIdentityReturnsOnCall map[int]struct { publisherIdentityReturnsOnCall map[int]struct {
result1 string result1 livekit.ParticipantIdentity
} }
SetPublisherMutedStub func(bool) SetPublisherMutedStub func(bool)
setPublisherMutedMutex sync.RWMutex setPublisherMutedMutex sync.RWMutex
@@ -146,7 +146,7 @@ func (fake *FakeSubscribedTrack) DownTrackReturnsOnCall(i int, result1 *sfu.Down
}{result1} }{result1}
} }
func (fake *FakeSubscribedTrack) ID() string { func (fake *FakeSubscribedTrack) ID() livekit.TrackID {
fake.iDMutex.Lock() fake.iDMutex.Lock()
ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)] ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)]
fake.iDArgsForCall = append(fake.iDArgsForCall, struct { fake.iDArgsForCall = append(fake.iDArgsForCall, struct {
@@ -170,32 +170,32 @@ func (fake *FakeSubscribedTrack) IDCallCount() int {
return len(fake.iDArgsForCall) return len(fake.iDArgsForCall)
} }
func (fake *FakeSubscribedTrack) IDCalls(stub func() string) { func (fake *FakeSubscribedTrack) IDCalls(stub func() livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = stub fake.IDStub = stub
} }
func (fake *FakeSubscribedTrack) IDReturns(result1 string) { func (fake *FakeSubscribedTrack) IDReturns(result1 livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = nil fake.IDStub = nil
fake.iDReturns = struct { fake.iDReturns = struct {
result1 string result1 livekit.TrackID
}{result1} }{result1}
} }
func (fake *FakeSubscribedTrack) IDReturnsOnCall(i int, result1 string) { func (fake *FakeSubscribedTrack) IDReturnsOnCall(i int, result1 livekit.TrackID) {
fake.iDMutex.Lock() fake.iDMutex.Lock()
defer fake.iDMutex.Unlock() defer fake.iDMutex.Unlock()
fake.IDStub = nil fake.IDStub = nil
if fake.iDReturnsOnCall == nil { if fake.iDReturnsOnCall == nil {
fake.iDReturnsOnCall = make(map[int]struct { fake.iDReturnsOnCall = make(map[int]struct {
result1 string result1 livekit.TrackID
}) })
} }
fake.iDReturnsOnCall[i] = struct { fake.iDReturnsOnCall[i] = struct {
result1 string result1 livekit.TrackID
}{result1} }{result1}
} }
@@ -337,7 +337,7 @@ func (fake *FakeSubscribedTrack) OnBindArgsForCall(i int) func() {
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeSubscribedTrack) PublisherID() string { func (fake *FakeSubscribedTrack) PublisherID() livekit.ParticipantID {
fake.publisherIDMutex.Lock() fake.publisherIDMutex.Lock()
ret, specificReturn := fake.publisherIDReturnsOnCall[len(fake.publisherIDArgsForCall)] ret, specificReturn := fake.publisherIDReturnsOnCall[len(fake.publisherIDArgsForCall)]
fake.publisherIDArgsForCall = append(fake.publisherIDArgsForCall, struct { fake.publisherIDArgsForCall = append(fake.publisherIDArgsForCall, struct {
@@ -361,36 +361,36 @@ func (fake *FakeSubscribedTrack) PublisherIDCallCount() int {
return len(fake.publisherIDArgsForCall) return len(fake.publisherIDArgsForCall)
} }
func (fake *FakeSubscribedTrack) PublisherIDCalls(stub func() string) { func (fake *FakeSubscribedTrack) PublisherIDCalls(stub func() livekit.ParticipantID) {
fake.publisherIDMutex.Lock() fake.publisherIDMutex.Lock()
defer fake.publisherIDMutex.Unlock() defer fake.publisherIDMutex.Unlock()
fake.PublisherIDStub = stub fake.PublisherIDStub = stub
} }
func (fake *FakeSubscribedTrack) PublisherIDReturns(result1 string) { func (fake *FakeSubscribedTrack) PublisherIDReturns(result1 livekit.ParticipantID) {
fake.publisherIDMutex.Lock() fake.publisherIDMutex.Lock()
defer fake.publisherIDMutex.Unlock() defer fake.publisherIDMutex.Unlock()
fake.PublisherIDStub = nil fake.PublisherIDStub = nil
fake.publisherIDReturns = struct { fake.publisherIDReturns = struct {
result1 string result1 livekit.ParticipantID
}{result1} }{result1}
} }
func (fake *FakeSubscribedTrack) PublisherIDReturnsOnCall(i int, result1 string) { func (fake *FakeSubscribedTrack) PublisherIDReturnsOnCall(i int, result1 livekit.ParticipantID) {
fake.publisherIDMutex.Lock() fake.publisherIDMutex.Lock()
defer fake.publisherIDMutex.Unlock() defer fake.publisherIDMutex.Unlock()
fake.PublisherIDStub = nil fake.PublisherIDStub = nil
if fake.publisherIDReturnsOnCall == nil { if fake.publisherIDReturnsOnCall == nil {
fake.publisherIDReturnsOnCall = make(map[int]struct { fake.publisherIDReturnsOnCall = make(map[int]struct {
result1 string result1 livekit.ParticipantID
}) })
} }
fake.publisherIDReturnsOnCall[i] = struct { fake.publisherIDReturnsOnCall[i] = struct {
result1 string result1 livekit.ParticipantID
}{result1} }{result1}
} }
func (fake *FakeSubscribedTrack) PublisherIdentity() string { func (fake *FakeSubscribedTrack) PublisherIdentity() livekit.ParticipantIdentity {
fake.publisherIdentityMutex.Lock() fake.publisherIdentityMutex.Lock()
ret, specificReturn := fake.publisherIdentityReturnsOnCall[len(fake.publisherIdentityArgsForCall)] ret, specificReturn := fake.publisherIdentityReturnsOnCall[len(fake.publisherIdentityArgsForCall)]
fake.publisherIdentityArgsForCall = append(fake.publisherIdentityArgsForCall, struct { fake.publisherIdentityArgsForCall = append(fake.publisherIdentityArgsForCall, struct {
@@ -414,32 +414,32 @@ func (fake *FakeSubscribedTrack) PublisherIdentityCallCount() int {
return len(fake.publisherIdentityArgsForCall) return len(fake.publisherIdentityArgsForCall)
} }
func (fake *FakeSubscribedTrack) PublisherIdentityCalls(stub func() string) { func (fake *FakeSubscribedTrack) PublisherIdentityCalls(stub func() livekit.ParticipantIdentity) {
fake.publisherIdentityMutex.Lock() fake.publisherIdentityMutex.Lock()
defer fake.publisherIdentityMutex.Unlock() defer fake.publisherIdentityMutex.Unlock()
fake.PublisherIdentityStub = stub fake.PublisherIdentityStub = stub
} }
func (fake *FakeSubscribedTrack) PublisherIdentityReturns(result1 string) { func (fake *FakeSubscribedTrack) PublisherIdentityReturns(result1 livekit.ParticipantIdentity) {
fake.publisherIdentityMutex.Lock() fake.publisherIdentityMutex.Lock()
defer fake.publisherIdentityMutex.Unlock() defer fake.publisherIdentityMutex.Unlock()
fake.PublisherIdentityStub = nil fake.PublisherIdentityStub = nil
fake.publisherIdentityReturns = struct { fake.publisherIdentityReturns = struct {
result1 string result1 livekit.ParticipantIdentity
}{result1} }{result1}
} }
func (fake *FakeSubscribedTrack) PublisherIdentityReturnsOnCall(i int, result1 string) { func (fake *FakeSubscribedTrack) PublisherIdentityReturnsOnCall(i int, result1 livekit.ParticipantIdentity) {
fake.publisherIdentityMutex.Lock() fake.publisherIdentityMutex.Lock()
defer fake.publisherIdentityMutex.Unlock() defer fake.publisherIdentityMutex.Unlock()
fake.PublisherIdentityStub = nil fake.PublisherIdentityStub = nil
if fake.publisherIdentityReturnsOnCall == nil { if fake.publisherIdentityReturnsOnCall == nil {
fake.publisherIdentityReturnsOnCall = make(map[int]struct { fake.publisherIdentityReturnsOnCall = make(map[int]struct {
result1 string result1 livekit.ParticipantIdentity
}) })
} }
fake.publisherIdentityReturnsOnCall[i] = struct { fake.publisherIdentityReturnsOnCall[i] = struct {
result1 string result1 livekit.ParticipantIdentity
}{result1} }{result1}
} }
+9 -9
View File
@@ -16,8 +16,8 @@ import (
) )
type UptrackManagerParams struct { type UptrackManagerParams struct {
Identity string Identity livekit.ParticipantIdentity
SID string SID livekit.ParticipantID
Config *WebRTCConfig Config *WebRTCConfig
AudioConfig config.AudioConfig AudioConfig config.AudioConfig
Telemetry telemetry.TelemetryService Telemetry telemetry.TelemetryService
@@ -200,7 +200,7 @@ func (u *UptrackManager) SetTrackMuted(trackID livekit.TrackID, muted bool) {
isPending := false isPending := false
u.lock.RLock() u.lock.RLock()
for _, ti := range u.pendingTracks { for _, ti := range u.pendingTracks {
if ti.Sid == trackID { if livekit.TrackID(ti.Sid) == trackID {
ti.Muted = muted ti.Muted = muted
isPending = true isPending = true
} }
@@ -470,7 +470,7 @@ func (u *UptrackManager) updateSubscriptionPermissions(permissions *livekit.Upda
// per participant permissions // per participant permissions
u.subscriptionPermissions = make(map[livekit.ParticipantID]*livekit.TrackPermission) u.subscriptionPermissions = make(map[livekit.ParticipantID]*livekit.TrackPermission)
for _, trackPerms := range permissions.TrackPermissions { for _, trackPerms := range permissions.TrackPermissions {
u.subscriptionPermissions[trackPerms.ParticipantSid] = trackPerms u.subscriptionPermissions[livekit.ParticipantID(trackPerms.ParticipantSid)] = trackPerms
} }
} }
@@ -489,7 +489,7 @@ func (u *UptrackManager) hasPermission(trackID livekit.TrackID, subscriberID liv
} }
for _, sid := range perms.TrackSids { for _, sid := range perms.TrackSids {
if sid == trackID { if livekit.TrackID(sid) == trackID {
return true return true
} }
} }
@@ -497,12 +497,12 @@ func (u *UptrackManager) hasPermission(trackID livekit.TrackID, subscriberID liv
return false return false
} }
func (u *UptrackManager) getAllowedSubscribers(trackID livekit.TrackID) []string { func (u *UptrackManager) getAllowedSubscribers(trackID livekit.TrackID) []livekit.ParticipantID {
if u.subscriptionPermissions == nil { if u.subscriptionPermissions == nil {
return nil return nil
} }
allowed := []string{} allowed := []livekit.ParticipantID{}
for subscriberID, perms := range u.subscriptionPermissions { for subscriberID, perms := range u.subscriptionPermissions {
if perms.AllTracks { if perms.AllTracks {
allowed = append(allowed, subscriberID) allowed = append(allowed, subscriberID)
@@ -510,7 +510,7 @@ func (u *UptrackManager) getAllowedSubscribers(trackID livekit.TrackID) []string
} }
for _, sid := range perms.TrackSids { for _, sid := range perms.TrackSids {
if sid == trackID { if livekit.TrackID(sid) == trackID {
allowed = append(allowed, subscriberID) allowed = append(allowed, subscriberID)
break break
} }
@@ -651,7 +651,7 @@ func (u *UptrackManager) rtcpSendWorker() {
func (u *UptrackManager) DebugInfo() map[string]interface{} { func (u *UptrackManager) DebugInfo() map[string]interface{} {
info := map[string]interface{}{} info := map[string]interface{}{}
publishedTrackInfo := make(map[string]interface{}) publishedTrackInfo := make(map[livekit.TrackID]interface{})
pendingTrackInfo := make(map[string]interface{}) pendingTrackInfo := make(map[string]interface{})
u.lock.RLock() u.lock.RLock()
+7 -7
View File
@@ -21,26 +21,26 @@ const (
func UnpackStreamID(packed string) (participantID livekit.ParticipantID, trackID livekit.TrackID) { func UnpackStreamID(packed string) (participantID livekit.ParticipantID, trackID livekit.TrackID) {
parts := strings.Split(packed, trackIdSeparator) parts := strings.Split(packed, trackIdSeparator)
if len(parts) > 1 { if len(parts) > 1 {
return parts[0], packed[len(parts[0])+1:] return livekit.ParticipantID(parts[0]), livekit.TrackID(packed[len(parts[0])+1:])
} }
return packed, "" return livekit.ParticipantID(packed), ""
} }
func PackStreamID(participantID livekit.ParticipantID, trackID livekit.TrackID) string { func PackStreamID(participantID livekit.ParticipantID, trackID livekit.TrackID) string {
return participantID + trackIdSeparator + trackID return string(participantID) + trackIdSeparator + string(trackID)
} }
func PackDataTrackLabel(participantID livekit.ParticipantID, trackID livekit.TrackID, label string) string { func PackDataTrackLabel(participantID livekit.ParticipantID, trackID livekit.TrackID, label string) string {
return participantID + trackIdSeparator + trackID + trackIdSeparator + label return string(participantID) + trackIdSeparator + string(trackID) + trackIdSeparator + label
} }
func UnpackDataTrackLabel(packed string) (peerID livekit.ParticipantID, trackID livekit.TrackID, label string) { func UnpackDataTrackLabel(packed string) (peerID livekit.ParticipantID, trackID livekit.TrackID, label string) {
parts := strings.Split(packed, trackIdSeparator) parts := strings.Split(packed, trackIdSeparator)
if len(parts) != 3 { if len(parts) != 3 {
return "", packed, "" return "", livekit.TrackID(packed), ""
} }
peerID = parts[0] peerID = livekit.ParticipantID(parts[0])
trackID = parts[1] trackID = livekit.TrackID(parts[1])
label = parts[2] label = parts[2]
return return
} }
+5 -4
View File
@@ -3,21 +3,22 @@ package rtc
import ( import (
"testing" "testing"
"github.com/livekit/protocol/livekit"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestPackStreamId(t *testing.T) { func TestPackStreamId(t *testing.T) {
packed := "PA_123abc|uuid-id" packed := "PA_123abc|uuid-id"
pID, trackID := UnpackStreamID(packed) pID, trackID := UnpackStreamID(packed)
require.Equal(t, "PA_123abc", pID) require.Equal(t, livekit.ParticipantID("PA_123abc"), pID)
require.Equal(t, "uuid-id", trackID) require.Equal(t, livekit.TrackID("uuid-id"), trackID)
require.Equal(t, packed, PackStreamID(pID, trackID)) require.Equal(t, packed, PackStreamID(pID, trackID))
} }
func TestPackDataTrackLabel(t *testing.T) { func TestPackDataTrackLabel(t *testing.T) {
pID := "PA_123abc" pID := livekit.ParticipantID("PA_123abc")
trackID := "TR_b3da25" trackID := livekit.TrackID("TR_b3da25")
label := "trackLabel" label := "trackLabel"
packed := "PA_123abc|TR_b3da25|trackLabel" packed := "PA_123abc|TR_b3da25|trackLabel"
require.Equal(t, packed, PackDataTrackLabel(pID, trackID, label)) require.Equal(t, packed, PackDataTrackLabel(pID, trackID, label))
+1 -1
View File
@@ -95,7 +95,7 @@ func (p *LocalRoomStore) StoreParticipant(_ context.Context, roomName livekit.Ro
roomParticipants = make(map[livekit.ParticipantIdentity]*livekit.ParticipantInfo) roomParticipants = make(map[livekit.ParticipantIdentity]*livekit.ParticipantInfo)
p.participants[roomName] = roomParticipants p.participants[roomName] = roomParticipants
} }
roomParticipants[participant.Identity] = participant roomParticipants[livekit.ParticipantIdentity(participant.Identity)] = participant
return nil return nil
} }
+2 -2
View File
@@ -176,7 +176,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) { func (p *RedisRoomStore) LoadParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
key := RoomParticipantsPrefix + string(roomName) key := RoomParticipantsPrefix + string(roomName)
data, err := p.rc.HGet(p.ctx, key, identity).Result() data, err := p.rc.HGet(p.ctx, key, string(identity)).Result()
if err == redis.Nil { if err == redis.Nil {
return nil, ErrParticipantNotFound return nil, ErrParticipantNotFound
} else if err != nil { } else if err != nil {
@@ -213,5 +213,5 @@ func (p *RedisRoomStore) ListParticipants(_ context.Context, roomName livekit.Ro
func (p *RedisRoomStore) DeleteParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error { func (p *RedisRoomStore) DeleteParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error {
key := RoomParticipantsPrefix + string(roomName) key := RoomParticipantsPrefix + string(roomName)
return p.rc.HDel(p.ctx, key, identity).Err() return p.rc.HDel(p.ctx, key, string(identity)).Err()
} }
+3 -3
View File
@@ -37,7 +37,7 @@ func TestParticipantPersistence(t *testing.T) {
require.NoError(t, rs.StoreParticipant(ctx, roomName, p)) require.NoError(t, rs.StoreParticipant(ctx, roomName, p))
// result should match // result should match
pGet, err := rs.LoadParticipant(ctx, roomName, p.Identity) pGet, err := rs.LoadParticipant(ctx, roomName, livekit.ParticipantIdentity(p.Identity))
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, p.Identity, pGet.Identity) require.Equal(t, p.Identity, pGet.Identity)
require.Equal(t, len(p.Tracks), len(pGet.Tracks)) require.Equal(t, len(p.Tracks), len(pGet.Tracks))
@@ -49,14 +49,14 @@ func TestParticipantPersistence(t *testing.T) {
require.Len(t, participants, 1) require.Len(t, participants, 1)
// deleting participant should return back to normal // deleting participant should return back to normal
require.NoError(t, rs.DeleteParticipant(ctx, roomName, p.Identity)) require.NoError(t, rs.DeleteParticipant(ctx, roomName, livekit.ParticipantIdentity(p.Identity)))
participants, err = rs.ListParticipants(ctx, roomName) participants, err = rs.ListParticipants(ctx, roomName)
require.NoError(t, err) require.NoError(t, err)
require.Len(t, participants, 0) require.Len(t, participants, 0)
// shouldn't be able to get it // shouldn't be able to get it
_, err = rs.LoadParticipant(ctx, roomName, p.Identity) _, err = rs.LoadParticipant(ctx, roomName, livekit.ParticipantIdentity(p.Identity))
require.Equal(t, err, service.ErrParticipantNotFound) require.Equal(t, err, service.ErrParticipantNotFound)
} }
+2 -2
View File
@@ -226,7 +226,7 @@ func (r *RoomManager) StartSession(ctx context.Context, roomName livekit.RoomNam
pv := types.ProtocolVersion(pi.Client.Protocol) pv := types.ProtocolVersion(pi.Client.Protocol)
rtcConf := *r.rtcConfig rtcConf := *r.rtcConfig
rtcConf.SetBufferFactory(room.GetBufferFactory()) rtcConf.SetBufferFactory(room.GetBufferFactory())
sid := utils.NewGuid(utils.ParticipantPrefix) sid := livekit.ParticipantID(utils.NewGuid(utils.ParticipantPrefix))
pLogger := rtc.LoggerWithParticipant(room.Logger, pi.Identity, sid) pLogger := rtc.LoggerWithParticipant(room.Logger, pi.Identity, sid)
participant, err = rtc.NewParticipant(rtc.ParticipantParams{ participant, err = rtc.NewParticipant(rtc.ParticipantParams{
Identity: pi.Identity, Identity: pi.Identity,
@@ -443,7 +443,7 @@ func (r *RoomManager) handleRTCMessage(_ context.Context, roomName livekit.RoomN
pLogger.Debugw("updating participant subscriptions") pLogger.Debugw("updating participant subscriptions")
if err := room.UpdateSubscriptions( if err := room.UpdateSubscriptions(
participant, participant,
rm.UpdateSubscriptions.TrackSids, livekit.StringsAsTrackIDs(rm.UpdateSubscriptions.TrackSids),
rm.UpdateSubscriptions.ParticipantTracks, rm.UpdateSubscriptions.ParticipantTracks,
rm.UpdateSubscriptions.Subscribe, rm.UpdateSubscriptions.Subscribe,
); err != nil { ); err != nil {
+7 -7
View File
@@ -99,7 +99,7 @@ func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParti
return nil, twirpAuthError(err) return nil, twirpAuthError(err)
} }
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity) participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity))
if err != nil { if err != nil {
return 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) { func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.RemoveParticipantResponse, err error) {
err = s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{ err = s.writeRoomMessage(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity), &livekit.RTCNodeMessage{
Message: &livekit.RTCNodeMessage_RemoveParticipant{ Message: &livekit.RTCNodeMessage_RemoveParticipant{
RemoveParticipant: req, RemoveParticipant: req,
}, },
@@ -127,7 +127,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
return nil, twirpAuthError(err) return nil, twirpAuthError(err)
} }
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity) participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity))
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -139,7 +139,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
return nil, twirp.NotFoundError(ErrTrackNotFound.Error()) return nil, twirp.NotFoundError(ErrTrackNotFound.Error())
} }
err = s.writeParticipantMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{ err = s.writeParticipantMessage(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity), &livekit.RTCNodeMessage{
Message: &livekit.RTCNodeMessage_MuteTrack{ Message: &livekit.RTCNodeMessage_MuteTrack{
MuteTrack: req, 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) { func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error) {
err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{ err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity), &livekit.RTCNodeMessage{
Message: &livekit.RTCNodeMessage_UpdateParticipant{ Message: &livekit.RTCNodeMessage_UpdateParticipant{
UpdateParticipant: req, UpdateParticipant: req,
}, },
@@ -166,7 +166,7 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
return nil, err return nil, err
} }
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity) participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity))
if err != nil { if err != nil {
return nil, err 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) { func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.UpdateSubscriptionsRequest) (*livekit.UpdateSubscriptionsResponse, error) {
err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{ err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity), &livekit.RTCNodeMessage{
Message: &livekit.RTCNodeMessage_UpdateSubscriptions{ Message: &livekit.RTCNodeMessage_UpdateSubscriptions{
UpdateSubscriptions: req, UpdateSubscriptions: req,
}, },
+2 -2
View File
@@ -99,8 +99,8 @@ func (s *RTCService) validate(r *http.Request) (livekit.RoomName, routing.Partic
pi := routing.ParticipantInit{ pi := routing.ParticipantInit{
Reconnect: boolValue(reconnectParam), Reconnect: boolValue(reconnectParam),
Identity: claims.Identity, Identity: livekit.ParticipantIdentity(claims.Identity),
Name: claims.Name, Name: livekit.ParticipantName(claims.Name),
AutoSubscribe: true, AutoSubscribe: true,
Metadata: claims.Metadata, Metadata: claims.Metadata,
Hidden: claims.Video.Hidden, Hidden: claims.Video.Hidden,
+12 -12
View File
@@ -11,12 +11,12 @@ import (
) )
type FakeRoomStore struct { type FakeRoomStore struct {
DeleteParticipantStub func(context.Context, livekit.RoomName, string) error DeleteParticipantStub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) error
deleteParticipantMutex sync.RWMutex deleteParticipantMutex sync.RWMutex
deleteParticipantArgsForCall []struct { deleteParticipantArgsForCall []struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
} }
deleteParticipantReturns struct { deleteParticipantReturns struct {
result1 error result1 error
@@ -64,12 +64,12 @@ type FakeRoomStore struct {
result1 []*livekit.Room result1 []*livekit.Room
result2 error result2 error
} }
LoadParticipantStub func(context.Context, livekit.RoomName, string) (*livekit.ParticipantInfo, error) LoadParticipantStub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)
loadParticipantMutex sync.RWMutex loadParticipantMutex sync.RWMutex
loadParticipantArgsForCall []struct { loadParticipantArgsForCall []struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
} }
loadParticipantReturns struct { loadParticipantReturns struct {
result1 *livekit.ParticipantInfo result1 *livekit.ParticipantInfo
@@ -150,13 +150,13 @@ type FakeRoomStore struct {
invocationsMutex sync.RWMutex invocationsMutex sync.RWMutex
} }
func (fake *FakeRoomStore) DeleteParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 string) error { func (fake *FakeRoomStore) DeleteParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) error {
fake.deleteParticipantMutex.Lock() fake.deleteParticipantMutex.Lock()
ret, specificReturn := fake.deleteParticipantReturnsOnCall[len(fake.deleteParticipantArgsForCall)] ret, specificReturn := fake.deleteParticipantReturnsOnCall[len(fake.deleteParticipantArgsForCall)]
fake.deleteParticipantArgsForCall = append(fake.deleteParticipantArgsForCall, struct { fake.deleteParticipantArgsForCall = append(fake.deleteParticipantArgsForCall, struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
}{arg1, arg2, arg3}) }{arg1, arg2, arg3})
stub := fake.DeleteParticipantStub stub := fake.DeleteParticipantStub
fakeReturns := fake.deleteParticipantReturns fakeReturns := fake.deleteParticipantReturns
@@ -177,13 +177,13 @@ func (fake *FakeRoomStore) DeleteParticipantCallCount() int {
return len(fake.deleteParticipantArgsForCall) return len(fake.deleteParticipantArgsForCall)
} }
func (fake *FakeRoomStore) DeleteParticipantCalls(stub func(context.Context, livekit.RoomName, string) error) { func (fake *FakeRoomStore) DeleteParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) error) {
fake.deleteParticipantMutex.Lock() fake.deleteParticipantMutex.Lock()
defer fake.deleteParticipantMutex.Unlock() defer fake.deleteParticipantMutex.Unlock()
fake.DeleteParticipantStub = stub fake.DeleteParticipantStub = stub
} }
func (fake *FakeRoomStore) DeleteParticipantArgsForCall(i int) (context.Context, livekit.RoomName, string) { func (fake *FakeRoomStore) DeleteParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
fake.deleteParticipantMutex.RLock() fake.deleteParticipantMutex.RLock()
defer fake.deleteParticipantMutex.RUnlock() defer fake.deleteParticipantMutex.RUnlock()
argsForCall := fake.deleteParticipantArgsForCall[i] argsForCall := fake.deleteParticipantArgsForCall[i]
@@ -410,13 +410,13 @@ func (fake *FakeRoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Room
}{result1, result2} }{result1, result2}
} }
func (fake *FakeRoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 string) (*livekit.ParticipantInfo, error) { func (fake *FakeRoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
fake.loadParticipantMutex.Lock() fake.loadParticipantMutex.Lock()
ret, specificReturn := fake.loadParticipantReturnsOnCall[len(fake.loadParticipantArgsForCall)] ret, specificReturn := fake.loadParticipantReturnsOnCall[len(fake.loadParticipantArgsForCall)]
fake.loadParticipantArgsForCall = append(fake.loadParticipantArgsForCall, struct { fake.loadParticipantArgsForCall = append(fake.loadParticipantArgsForCall, struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
}{arg1, arg2, arg3}) }{arg1, arg2, arg3})
stub := fake.LoadParticipantStub stub := fake.LoadParticipantStub
fakeReturns := fake.loadParticipantReturns fakeReturns := fake.loadParticipantReturns
@@ -437,13 +437,13 @@ func (fake *FakeRoomStore) LoadParticipantCallCount() int {
return len(fake.loadParticipantArgsForCall) return len(fake.loadParticipantArgsForCall)
} }
func (fake *FakeRoomStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, string) (*livekit.ParticipantInfo, error)) { func (fake *FakeRoomStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)) {
fake.loadParticipantMutex.Lock() fake.loadParticipantMutex.Lock()
defer fake.loadParticipantMutex.Unlock() defer fake.loadParticipantMutex.Unlock()
fake.LoadParticipantStub = stub fake.LoadParticipantStub = stub
} }
func (fake *FakeRoomStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, string) { func (fake *FakeRoomStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
fake.loadParticipantMutex.RLock() fake.loadParticipantMutex.RLock()
defer fake.loadParticipantMutex.RUnlock() defer fake.loadParticipantMutex.RUnlock()
argsForCall := fake.loadParticipantArgsForCall[i] argsForCall := fake.loadParticipantArgsForCall[i]
@@ -38,12 +38,12 @@ type FakeRORoomStore struct {
result1 []*livekit.Room result1 []*livekit.Room
result2 error result2 error
} }
LoadParticipantStub func(context.Context, livekit.RoomName, string) (*livekit.ParticipantInfo, error) LoadParticipantStub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)
loadParticipantMutex sync.RWMutex loadParticipantMutex sync.RWMutex
loadParticipantArgsForCall []struct { loadParticipantArgsForCall []struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
} }
loadParticipantReturns struct { loadParticipantReturns struct {
result1 *livekit.ParticipantInfo result1 *livekit.ParticipantInfo
@@ -206,13 +206,13 @@ func (fake *FakeRORoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Ro
}{result1, result2} }{result1, result2}
} }
func (fake *FakeRORoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 string) (*livekit.ParticipantInfo, error) { func (fake *FakeRORoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
fake.loadParticipantMutex.Lock() fake.loadParticipantMutex.Lock()
ret, specificReturn := fake.loadParticipantReturnsOnCall[len(fake.loadParticipantArgsForCall)] ret, specificReturn := fake.loadParticipantReturnsOnCall[len(fake.loadParticipantArgsForCall)]
fake.loadParticipantArgsForCall = append(fake.loadParticipantArgsForCall, struct { fake.loadParticipantArgsForCall = append(fake.loadParticipantArgsForCall, struct {
arg1 context.Context arg1 context.Context
arg2 livekit.RoomName arg2 livekit.RoomName
arg3 string arg3 livekit.ParticipantIdentity
}{arg1, arg2, arg3}) }{arg1, arg2, arg3})
stub := fake.LoadParticipantStub stub := fake.LoadParticipantStub
fakeReturns := fake.loadParticipantReturns fakeReturns := fake.loadParticipantReturns
@@ -233,13 +233,13 @@ func (fake *FakeRORoomStore) LoadParticipantCallCount() int {
return len(fake.loadParticipantArgsForCall) return len(fake.loadParticipantArgsForCall)
} }
func (fake *FakeRORoomStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, string) (*livekit.ParticipantInfo, error)) { func (fake *FakeRORoomStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)) {
fake.loadParticipantMutex.Lock() fake.loadParticipantMutex.Lock()
defer fake.loadParticipantMutex.Unlock() defer fake.loadParticipantMutex.Unlock()
fake.LoadParticipantStub = stub fake.LoadParticipantStub = stub
} }
func (fake *FakeRORoomStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, string) { func (fake *FakeRORoomStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
fake.loadParticipantMutex.RLock() fake.loadParticipantMutex.RLock()
defer fake.loadParticipantMutex.RUnlock() defer fake.loadParticipantMutex.RUnlock()
argsForCall := fake.loadParticipantArgsForCall[i] argsForCall := fake.loadParticipantArgsForCall[i]
+7 -6
View File
@@ -11,6 +11,7 @@ import (
"time" "time"
"github.com/livekit/livekit-server/pkg/sfu/connectionquality" "github.com/livekit/livekit-server/pkg/sfu/connectionquality"
"github.com/livekit/protocol/livekit"
"github.com/pion/rtcp" "github.com/pion/rtcp"
"github.com/pion/rtp" "github.com/pion/rtp"
@@ -33,7 +34,7 @@ type TrackSender interface {
// ID is the globally unique identifier for this Track. // ID is the globally unique identifier for this Track.
ID() string ID() string
Codec() webrtc.RTPCodecCapability Codec() webrtc.RTPCodecCapability
PeerID() string PeerID() livekit.ParticipantID
} }
const ( const (
@@ -74,8 +75,8 @@ type PacketStats struct {
// to SFU Subscriber, the track handle the packets for simple, simulcast // to SFU Subscriber, the track handle the packets for simple, simulcast
// and SVC Publisher. // and SVC Publisher.
type DownTrack struct { type DownTrack struct {
id string id livekit.TrackID
peerID string peerID livekit.ParticipantID
bound atomicBool bound atomicBool
kind webrtc.RTPCodecType kind webrtc.RTPCodecType
mime string mime string
@@ -136,7 +137,7 @@ type DownTrack struct {
} }
// NewDownTrack returns a DownTrack. // NewDownTrack returns a DownTrack.
func NewDownTrack(c webrtc.RTPCodecCapability, r TrackReceiver, bf *buffer.Factory, peerID string, mt int) (*DownTrack, error) { func NewDownTrack(c webrtc.RTPCodecCapability, r TrackReceiver, bf *buffer.Factory, peerID livekit.ParticipantID, mt int) (*DownTrack, error) {
var kind webrtc.RTPCodecType var kind webrtc.RTPCodecType
switch { switch {
case strings.HasPrefix(c.MimeType, "audio/"): case strings.HasPrefix(c.MimeType, "audio/"):
@@ -208,7 +209,7 @@ func (d *DownTrack) Unbind(_ webrtc.TrackLocalContext) error {
// ID is the unique identifier for this Track. This should be unique for the // ID is the unique identifier for this Track. This should be unique for the
// stream, but doesn't have to globally unique. A common example would be 'audio' or 'video' // stream, but doesn't have to globally unique. A common example would be 'audio' or 'video'
// and StreamID would be 'desktop' or 'webcam' // and StreamID would be 'desktop' or 'webcam'
func (d *DownTrack) ID() string { return d.id } func (d *DownTrack) ID() string { return string(d.id) }
// Codec returns current track codec capability // Codec returns current track codec capability
func (d *DownTrack) Codec() webrtc.RTPCodecCapability { return d.codec } func (d *DownTrack) Codec() webrtc.RTPCodecCapability { return d.codec }
@@ -216,7 +217,7 @@ func (d *DownTrack) Codec() webrtc.RTPCodecCapability { return d.codec }
// StreamID is the group this track belongs too. This must be unique // StreamID is the group this track belongs too. This must be unique
func (d *DownTrack) StreamID() string { return d.streamID } func (d *DownTrack) StreamID() string { return d.streamID }
func (d *DownTrack) PeerID() string { return d.peerID } func (d *DownTrack) PeerID() livekit.ParticipantID { return d.peerID }
// Sets RTP header extensions for this track // Sets RTP header extensions for this track
func (d *DownTrack) SetRTPHeaderExtensions(rtpHeaderExtensions []webrtc.RTPHeaderExtensionParameter) { func (d *DownTrack) SetRTPHeaderExtensions(rtpHeaderExtensions []webrtc.RTPHeaderExtensionParameter) {
+16 -15
View File
@@ -14,18 +14,19 @@ import (
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/livekit/livekit-server/pkg/sfu/buffer" "github.com/livekit/livekit-server/pkg/sfu/buffer"
"github.com/livekit/protocol/livekit"
) )
type Bitrates [DefaultMaxLayerSpatial + 1][DefaultMaxLayerTemporal + 1]int64 type Bitrates [DefaultMaxLayerSpatial + 1][DefaultMaxLayerTemporal + 1]int64
// TrackReceiver defines an interface receive media from remote peer // TrackReceiver defines an interface receive media from remote peer
type TrackReceiver interface { type TrackReceiver interface {
TrackID() string TrackID() livekit.TrackID
StreamID() string StreamID() string
GetBitrateTemporalCumulative() Bitrates GetBitrateTemporalCumulative() Bitrates
ReadRTP(buf []byte, layer uint8, sn uint16) (int, error) ReadRTP(buf []byte, layer uint8, sn uint16) (int, error)
AddDownTrack(track TrackSender) AddDownTrack(track TrackSender)
DeleteDownTrack(peerID string) DeleteDownTrack(peerID livekit.ParticipantID)
SendPLI(layer int32) SendPLI(layer int32)
GetSenderReportTime(layer int32) (rtpTS uint32, ntpTS uint64) GetSenderReportTime(layer int32) (rtpTS uint32, ntpTS uint64)
Codec() webrtc.RTPCodecCapability Codec() webrtc.RTPCodecCapability
@@ -33,7 +34,7 @@ type TrackReceiver interface {
// Receiver defines an interface for a track receivers // Receiver defines an interface for a track receivers
type Receiver interface { type Receiver interface {
TrackID() string TrackID() livekit.TrackID
StreamID() string StreamID() string
Codec() webrtc.RTPCodecCapability Codec() webrtc.RTPCodecCapability
AddUpTrack(track *webrtc.TrackRemote, buffer *buffer.Buffer) AddUpTrack(track *webrtc.TrackRemote, buffer *buffer.Buffer)
@@ -43,7 +44,7 @@ type Receiver interface {
NumAvailableSpatialLayers() int NumAvailableSpatialLayers() int
GetBitrateTemporalCumulative() Bitrates GetBitrateTemporalCumulative() Bitrates
ReadRTP(buf []byte, layer uint8, sn uint16) (int, error) ReadRTP(buf []byte, layer uint8, sn uint16) (int, error)
DeleteDownTrack(peerID string) DeleteDownTrack(peerID livekit.ParticipantID)
OnCloseHandler(fn func()) OnCloseHandler(fn func())
SendPLI(layer int32) SendPLI(layer int32)
SetRTCPCh(ch chan []rtcp.Packet) SetRTCPCh(ch chan []rtcp.Packet)
@@ -54,8 +55,8 @@ type Receiver interface {
// WebRTCReceiver receives a video track // WebRTCReceiver receives a video track
type WebRTCReceiver struct { type WebRTCReceiver struct {
peerID string peerID livekit.ParticipantID
trackID string trackID livekit.TrackID
streamID string streamID string
kind webrtc.RTPCodecType kind webrtc.RTPCodecType
receiver *webrtc.RTPReceiver receiver *webrtc.RTPReceiver
@@ -82,7 +83,7 @@ type WebRTCReceiver struct {
downTrackMu sync.RWMutex downTrackMu sync.RWMutex
downTracks []TrackSender downTracks []TrackSender
index map[string]int index map[livekit.ParticipantID]int
free map[int]struct{} free map[int]struct{}
numProcs int numProcs int
lbThreshold int lbThreshold int
@@ -119,11 +120,11 @@ func WithLoadBalanceThreshold(downTracks int) ReceiverOpts {
} }
// NewWebRTCReceiver creates a new webrtc track receivers // NewWebRTCReceiver creates a new webrtc track receivers
func NewWebRTCReceiver(receiver *webrtc.RTPReceiver, track *webrtc.TrackRemote, pid string, opts ...ReceiverOpts) Receiver { func NewWebRTCReceiver(receiver *webrtc.RTPReceiver, track *webrtc.TrackRemote, pid livekit.ParticipantID, opts ...ReceiverOpts) Receiver {
w := &WebRTCReceiver{ w := &WebRTCReceiver{
peerID: pid, peerID: pid,
receiver: receiver, receiver: receiver,
trackID: track.ID(), trackID: livekit.TrackID(track.ID()),
streamID: track.StreamID(), streamID: track.StreamID(),
codec: track.Codec(), codec: track.Codec(),
kind: track.Kind(), kind: track.Kind(),
@@ -132,7 +133,7 @@ func NewWebRTCReceiver(receiver *webrtc.RTPReceiver, track *webrtc.TrackRemote,
maxExpectedLayer: DefaultMaxLayerSpatial, maxExpectedLayer: DefaultMaxLayerSpatial,
pliThrottle: 500e6, pliThrottle: 500e6,
downTracks: make([]TrackSender, 0), downTracks: make([]TrackSender, 0),
index: make(map[string]int), index: make(map[livekit.ParticipantID]int),
free: make(map[int]struct{}), free: make(map[int]struct{}),
numProcs: runtime.NumCPU(), numProcs: runtime.NumCPU(),
} }
@@ -145,7 +146,7 @@ func NewWebRTCReceiver(receiver *webrtc.RTPReceiver, track *webrtc.TrackRemote,
return w return w
} }
func (w *WebRTCReceiver) SetTrackMeta(trackID, streamID string) { func (w *WebRTCReceiver) SetTrackMeta(trackID livekit.TrackID, streamID string) {
w.streamID = streamID w.streamID = streamID
w.trackID = trackID w.trackID = trackID
} }
@@ -154,7 +155,7 @@ func (w *WebRTCReceiver) StreamID() string {
return w.streamID return w.streamID
} }
func (w *WebRTCReceiver) TrackID() string { func (w *WebRTCReceiver) TrackID() livekit.TrackID {
return w.trackID return w.trackID
} }
@@ -407,7 +408,7 @@ func (w *WebRTCReceiver) OnCloseHandler(fn func()) {
} }
// DeleteDownTrack removes a DownTrack from a Receiver // DeleteDownTrack removes a DownTrack from a Receiver
func (w *WebRTCReceiver) DeleteDownTrack(peerID string) { func (w *WebRTCReceiver) DeleteDownTrack(peerID livekit.ParticipantID) {
if w.closed.get() { if w.closed.get() {
return return
} }
@@ -544,7 +545,7 @@ func (w *WebRTCReceiver) forwardRTP(layer int32) {
func (w *WebRTCReceiver) writeRTP(layer int32, dt TrackSender, pkt *buffer.ExtPacket) { func (w *WebRTCReceiver) writeRTP(layer int32, dt TrackSender, pkt *buffer.ExtPacket) {
if err := dt.WriteRTP(pkt, layer); err != nil { if err := dt.WriteRTP(pkt, layer); err != nil {
log.Error().Err(err).Str("id", dt.ID()).Msg("Error writing to down track") log.Error().Err(err).Str("id", string(dt.ID())).Msg("Error writing to down track")
} }
} }
@@ -557,7 +558,7 @@ func (w *WebRTCReceiver) closeTracks() {
} }
} }
w.downTracks = make([]TrackSender, 0) w.downTracks = make([]TrackSender, 0)
w.index = make(map[string]int) w.index = make(map[livekit.ParticipantID]int)
w.free = make(map[int]struct{}) w.free = make(map[int]struct{})
w.downTrackMu.Unlock() w.downTrackMu.Unlock()
+31 -27
View File
@@ -132,8 +132,8 @@ type StreamAllocator struct {
lastGratuitousProbeTime time.Time lastGratuitousProbeTime time.Time
audioTracks map[string]*Track audioTracks map[livekit.TrackID]*Track
videoTracks map[string]*Track videoTracks map[livekit.TrackID]*Track
exemptVideoTracksSorted TrackSorter exemptVideoTracksSorted TrackSorter
managedVideoTracksSorted TrackSorter managedVideoTracksSorted TrackSorter
@@ -149,8 +149,8 @@ type StreamAllocator struct {
func NewStreamAllocator(params StreamAllocatorParams) *StreamAllocator { func NewStreamAllocator(params StreamAllocatorParams) *StreamAllocator {
s := &StreamAllocator{ s := &StreamAllocator{
params: params, params: params,
audioTracks: make(map[string]*Track), audioTracks: make(map[livekit.TrackID]*Track),
videoTracks: make(map[string]*Track), videoTracks: make(map[livekit.TrackID]*Track),
prober: NewProber(ProberParams{ prober: NewProber(ProberParams{
Logger: params.Logger, Logger: params.Logger,
}), }),
@@ -374,11 +374,12 @@ func (s *StreamAllocator) handleSignalAddTrack(event *Event) {
isManaged := (params.Source != livekit.TrackSource_SCREEN_SHARE && params.Source != livekit.TrackSource_SCREEN_SHARE_AUDIO) || params.IsSimulcast isManaged := (params.Source != livekit.TrackSource_SCREEN_SHARE && params.Source != livekit.TrackSource_SCREEN_SHARE_AUDIO) || params.IsSimulcast
track := newTrack(event.DownTrack, isManaged) track := newTrack(event.DownTrack, isManaged)
trackID := livekit.TrackID(event.DownTrack.ID())
switch event.DownTrack.Kind() { switch event.DownTrack.Kind() {
case webrtc.RTPCodecTypeAudio: case webrtc.RTPCodecTypeAudio:
s.audioTracks[event.DownTrack.ID()] = track s.audioTracks[trackID] = track
case webrtc.RTPCodecTypeVideo: case webrtc.RTPCodecTypeVideo:
s.videoTracks[event.DownTrack.ID()] = track s.videoTracks[trackID] = track
if isManaged { if isManaged {
s.managedVideoTracksSorted = append(s.managedVideoTracksSorted, track) s.managedVideoTracksSorted = append(s.managedVideoTracksSorted, track)
@@ -393,20 +394,21 @@ func (s *StreamAllocator) handleSignalAddTrack(event *Event) {
} }
func (s *StreamAllocator) handleSignalRemoveTrack(event *Event) { func (s *StreamAllocator) handleSignalRemoveTrack(event *Event) {
trackID := livekit.TrackID(event.DownTrack.ID())
switch event.DownTrack.Kind() { switch event.DownTrack.Kind() {
case webrtc.RTPCodecTypeAudio: case webrtc.RTPCodecTypeAudio:
if _, ok := s.audioTracks[event.DownTrack.ID()]; !ok { if _, ok := s.audioTracks[trackID]; !ok {
return return
} }
delete(s.audioTracks, event.DownTrack.ID()) delete(s.audioTracks, trackID)
case webrtc.RTPCodecTypeVideo: case webrtc.RTPCodecTypeVideo:
track, ok := s.videoTracks[event.DownTrack.ID()] track, ok := s.videoTracks[trackID]
if !ok { if !ok {
return return
} }
delete(s.videoTracks, event.DownTrack.ID()) delete(s.videoTracks, trackID)
if track.IsManaged() { if track.IsManaged() {
n := len(s.managedVideoTracksSorted) n := len(s.managedVideoTracksSorted)
@@ -548,11 +550,13 @@ func (s *StreamAllocator) handleSignalTargetBitrate(event *Event) {
func (s *StreamAllocator) handleSignalReceiverReport(event *Event) { func (s *StreamAllocator) handleSignalReceiverReport(event *Event) {
var track *Track var track *Track
ok := false ok := false
trackID := livekit.TrackID(event.DownTrack.ID())
switch event.DownTrack.Kind() { switch event.DownTrack.Kind() {
case webrtc.RTPCodecTypeAudio: case webrtc.RTPCodecTypeAudio:
track, ok = s.audioTracks[event.DownTrack.ID()] track, ok = s.audioTracks[trackID]
case webrtc.RTPCodecTypeVideo: case webrtc.RTPCodecTypeVideo:
track, ok = s.videoTracks[event.DownTrack.ID()] track, ok = s.videoTracks[trackID]
} }
if !ok { if !ok {
return return
@@ -563,7 +567,7 @@ func (s *StreamAllocator) handleSignalReceiverReport(event *Event) {
} }
func (s *StreamAllocator) handleSignalAvailableLayersChange(event *Event) { func (s *StreamAllocator) handleSignalAvailableLayersChange(event *Event) {
track, ok := s.videoTracks[event.DownTrack.ID()] track, ok := s.videoTracks[livekit.TrackID(event.DownTrack.ID())]
if !ok { if !ok {
return return
} }
@@ -572,7 +576,7 @@ func (s *StreamAllocator) handleSignalAvailableLayersChange(event *Event) {
} }
func (s *StreamAllocator) handleSignalSubscriptionChange(event *Event) { func (s *StreamAllocator) handleSignalSubscriptionChange(event *Event) {
track, ok := s.videoTracks[event.DownTrack.ID()] track, ok := s.videoTracks[livekit.TrackID(event.DownTrack.ID())]
if !ok { if !ok {
return return
} }
@@ -581,7 +585,7 @@ func (s *StreamAllocator) handleSignalSubscriptionChange(event *Event) {
} }
func (s *StreamAllocator) handleSignalSubscribedLayersChange(event *Event) { func (s *StreamAllocator) handleSignalSubscribedLayersChange(event *Event) {
track, ok := s.videoTracks[event.DownTrack.ID()] track, ok := s.videoTracks[livekit.TrackID(event.DownTrack.ID())]
if !ok { if !ok {
return return
} }
@@ -1034,9 +1038,9 @@ const (
) )
type StreamStateInfo struct { type StreamStateInfo struct {
ParticipantSid string ParticipantID livekit.ParticipantID
TrackSid string TrackID livekit.TrackID
State StreamState State StreamState
} }
type StreamStateUpdate struct { type StreamStateUpdate struct {
@@ -1051,15 +1055,15 @@ func (s *StreamStateUpdate) HandleStreamingChange(change VideoStreamingChange, t
switch change { switch change {
case VideoStreamingChangePausing: case VideoStreamingChangePausing:
s.StreamStates = append(s.StreamStates, &StreamStateInfo{ s.StreamStates = append(s.StreamStates, &StreamStateInfo{
ParticipantSid: track.PeerID(), ParticipantID: track.PeerID(),
TrackSid: track.ID(), TrackID: track.ID(),
State: StreamStatePaused, State: StreamStatePaused,
}) })
case VideoStreamingChangeResuming: case VideoStreamingChangeResuming:
s.StreamStates = append(s.StreamStates, &StreamStateInfo{ s.StreamStates = append(s.StreamStates, &StreamStateInfo{
ParticipantSid: track.PeerID(), ParticipantID: track.PeerID(),
TrackSid: track.ID(), TrackID: track.ID(),
State: StreamStateActive, State: StreamStateActive,
}) })
} }
} }
@@ -1100,11 +1104,11 @@ func (t *Track) IsManaged() bool {
return t.isManaged return t.isManaged
} }
func (t *Track) ID() string { func (t *Track) ID() livekit.TrackID {
return t.downTrack.ID() return livekit.TrackID(t.downTrack.ID())
} }
func (t *Track) PeerID() string { func (t *Track) PeerID() livekit.ParticipantID {
return t.downTrack.PeerID() return t.downTrack.PeerID()
} }
+8 -8
View File
@@ -64,8 +64,8 @@ func (s *StatsWorker) getOrCreateOutgoingStatsIfEmpty(trackID livekit.TrackID) *
if s.outgoingPerTrack[trackID] == nil { if s.outgoingPerTrack[trackID] == nil {
s.outgoingPerTrack[trackID] = &Stats{next: &livekit.AnalyticsStat{ s.outgoingPerTrack[trackID] = &Stats{next: &livekit.AnalyticsStat{
Kind: livekit.StreamType_DOWNSTREAM, Kind: livekit.StreamType_DOWNSTREAM,
RoomId: s.roomID, RoomId: string(s.roomID),
ParticipantId: s.participantID, ParticipantId: string(s.participantID),
RoomName: string(s.roomName), RoomName: string(s.roomName),
}} }}
} }
@@ -76,8 +76,8 @@ func (s *StatsWorker) getOrCreateIncomingStatsIfEmpty(trackID livekit.TrackID) *
if s.incomingPerTrack[trackID] == nil { if s.incomingPerTrack[trackID] == nil {
s.incomingPerTrack[trackID] = &Stats{next: &livekit.AnalyticsStat{ s.incomingPerTrack[trackID] = &Stats{next: &livekit.AnalyticsStat{
Kind: livekit.StreamType_UPSTREAM, Kind: livekit.StreamType_UPSTREAM,
RoomId: s.roomID, RoomId: string(s.roomID),
ParticipantId: s.participantID, ParticipantId: string(s.participantID),
RoomName: string(s.roomName), RoomName: string(s.roomName),
}} }}
} }
@@ -129,7 +129,7 @@ func (s *StatsWorker) collectDownstreamStats(ts *timestamppb.Timestamp, stats []
for trackID, trackDownStreamStats := range s.outgoingPerTrack { for trackID, trackDownStreamStats := range s.outgoingPerTrack {
analyticsStat := s.update(trackDownStreamStats, ts) analyticsStat := s.update(trackDownStreamStats, ts)
if analyticsStat != nil { if analyticsStat != nil {
analyticsStat.TrackId = trackID analyticsStat.TrackId = string(trackID)
stats = append(stats, analyticsStat) stats = append(stats, analyticsStat)
} }
} }
@@ -145,7 +145,7 @@ func (s *StatsWorker) collectUpstreamStats(ts *timestamppb.Timestamp, stats []*l
analyticsStats := s.update(s.incomingPerTrack[trackID], ts) analyticsStats := s.update(s.incomingPerTrack[trackID], ts)
if analyticsStats != nil { if analyticsStats != nil {
analyticsStats.TrackId = trackID analyticsStats.TrackId = string(trackID)
stats = append(stats, analyticsStats) stats = append(stats, analyticsStats)
} }
} }
@@ -168,8 +168,8 @@ func (s *StatsWorker) update(stats *Stats, ts *timestamppb.Timestamp) *livekit.A
next := stats.next next := stats.next
stats.next = &livekit.AnalyticsStat{ stats.next = &livekit.AnalyticsStat{
Kind: next.Kind, Kind: next.Kind,
RoomId: s.roomID, RoomId: string(s.roomID),
ParticipantId: s.participantID, ParticipantId: string(s.participantID),
RoomName: string(s.roomName), RoomName: string(s.roomName),
} }
+13 -13
View File
@@ -46,7 +46,7 @@ func (t *telemetryServiceInternal) RoomEnded(ctx context.Context, room *livekit.
func (t *telemetryServiceInternal) ParticipantJoined(ctx context.Context, room *livekit.Room, func (t *telemetryServiceInternal) ParticipantJoined(ctx context.Context, room *livekit.Room,
participant *livekit.ParticipantInfo, clientInfo *livekit.ClientInfo) { participant *livekit.ParticipantInfo, clientInfo *livekit.ClientInfo) {
t.workers[participant.Sid] = newStatsWorker(ctx, t, room.Sid, livekit.RoomName(room.Name), participant.Sid) t.workers[livekit.ParticipantID(participant.Sid)] = newStatsWorker(ctx, t, livekit.RoomID(room.Sid), livekit.RoomName(room.Name), livekit.ParticipantID(participant.Sid))
prometheus.AddParticipant() prometheus.AddParticipant()
@@ -68,9 +68,9 @@ func (t *telemetryServiceInternal) ParticipantJoined(ctx context.Context, room *
} }
func (t *telemetryServiceInternal) ParticipantLeft(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo) { func (t *telemetryServiceInternal) ParticipantLeft(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo) {
if w := t.workers[participant.Sid]; w != nil { if w := t.workers[livekit.ParticipantID(participant.Sid)]; w != nil {
w.Close() w.Close()
delete(t.workers, participant.Sid) delete(t.workers, livekit.ParticipantID(participant.Sid))
} }
prometheus.SubParticipant() prometheus.SubParticipant()
@@ -97,20 +97,20 @@ func (t *telemetryServiceInternal) TrackPublished(ctx context.Context, participa
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{ t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
Type: livekit.AnalyticsEventType_TRACK_PUBLISHED, Type: livekit.AnalyticsEventType_TRACK_PUBLISHED,
Timestamp: timestamppb.Now(), Timestamp: timestamppb.Now(),
RoomId: roomID, RoomId: string(roomID),
ParticipantId: participantID, ParticipantId: string(participantID),
Track: track, Track: track,
Room: &livekit.Room{Name: string(roomName)}, Room: &livekit.Room{Name: string(roomName)},
}) })
} }
func (t *telemetryServiceInternal) TrackUnpublished(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo, ssrc uint32) { func (t *telemetryServiceInternal) TrackUnpublished(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo, ssrc uint32) {
roomID := "" roomID := livekit.RoomID("")
roomName := livekit.RoomName("") roomName := livekit.RoomName("")
w := t.workers[participantID] w := t.workers[participantID]
if w != nil { if w != nil {
roomID = w.roomID roomID = w.roomID
w.RemoveBuffer(track.GetSid()) w.RemoveBuffer(livekit.TrackID(track.GetSid()))
roomName = w.roomName roomName = w.roomName
} }
@@ -119,8 +119,8 @@ func (t *telemetryServiceInternal) TrackUnpublished(ctx context.Context, partici
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{ t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
Type: livekit.AnalyticsEventType_TRACK_UNPUBLISHED, Type: livekit.AnalyticsEventType_TRACK_UNPUBLISHED,
Timestamp: timestamppb.Now(), Timestamp: timestamppb.Now(),
RoomId: roomID, RoomId: string(roomID),
ParticipantId: participantID, ParticipantId: string(participantID),
TrackId: track.Sid, TrackId: track.Sid,
Room: &livekit.Room{Name: string(roomName)}, Room: &livekit.Room{Name: string(roomName)},
}) })
@@ -133,8 +133,8 @@ func (t *telemetryServiceInternal) TrackSubscribed(ctx context.Context, particip
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{ t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
Type: livekit.AnalyticsEventType_TRACK_SUBSCRIBED, Type: livekit.AnalyticsEventType_TRACK_SUBSCRIBED,
Timestamp: timestamppb.Now(), Timestamp: timestamppb.Now(),
RoomId: roomID, RoomId: string(roomID),
ParticipantId: participantID, ParticipantId: string(participantID),
TrackId: track.Sid, TrackId: track.Sid,
Room: &livekit.Room{Name: string(roomName)}, Room: &livekit.Room{Name: string(roomName)},
}) })
@@ -147,8 +147,8 @@ func (t *telemetryServiceInternal) TrackUnsubscribed(ctx context.Context, partic
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{ t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
Type: livekit.AnalyticsEventType_TRACK_UNSUBSCRIBED, Type: livekit.AnalyticsEventType_TRACK_UNSUBSCRIBED,
Timestamp: timestamppb.Now(), Timestamp: timestamppb.Now(),
RoomId: roomID, RoomId: string(roomID),
ParticipantId: participantID, ParticipantId: string(participantID),
TrackId: track.Sid, TrackId: track.Sid,
Room: &livekit.Room{Name: string(roomName)}, Room: &livekit.Room{Name: string(roomName)},
}) })
+47 -47
View File
@@ -30,9 +30,9 @@ func Test_ParticipantAndRoomDataAreSentWithAnalytics(t *testing.T) {
//prepare //prepare
room := &livekit.Room{Sid: "RoomSid", Name: "RoomName"} room := &livekit.Room{Sid: "RoomSid", Name: "RoomName"}
partSID := "part1" partSID := livekit.ParticipantID("part1")
clientInfo := &livekit.ClientInfo{Sdk: 2} clientInfo := &livekit.ClientInfo{Sdk: 2}
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, clientInfo) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, clientInfo)
//do //do
@@ -45,7 +45,7 @@ func Test_ParticipantAndRoomDataAreSentWithAnalytics(t *testing.T) {
_, stats := fixture.analytics.SendStatsArgsForCall(0) _, stats := fixture.analytics.SendStatsArgsForCall(0)
require.Equal(t, 1, len(stats)) require.Equal(t, 1, len(stats))
require.Equal(t, livekit.StreamType_DOWNSTREAM, stats[0].Kind) require.Equal(t, livekit.StreamType_DOWNSTREAM, stats[0].Kind)
require.Equal(t, partSID, stats[0].ParticipantId) require.Equal(t, string(partSID), stats[0].ParticipantId)
require.Equal(t, room.Sid, stats[0].RoomId) require.Equal(t, room.Sid, stats[0].RoomId)
require.Equal(t, room.Name, stats[0].RoomName) require.Equal(t, room.Name, stats[0].RoomName)
} }
@@ -55,16 +55,16 @@ func Test_OnDownstreamPackets(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
clientInfo := &livekit.ClientInfo{Sdk: 2} clientInfo := &livekit.ClientInfo{Sdk: 2}
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, clientInfo) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, clientInfo)
//do //do
packets := []int{33, 23} packets := []int{33, 23}
totalBytes := packets[0] + packets[1] totalBytes := packets[0] + packets[1]
totalPackets := len(packets) totalPackets := len(packets)
trackID := "trackID" trackID := livekit.TrackID("trackID")
for i := range packets { for i := range packets {
fixture.sut.OnDownstreamPacket(partSID, trackID, packets[i]) fixture.sut.OnDownstreamPacket(partSID, trackID, packets[i])
} }
@@ -77,7 +77,7 @@ func Test_OnDownstreamPackets(t *testing.T) {
require.Equal(t, livekit.StreamType_DOWNSTREAM, stats[0].Kind) require.Equal(t, livekit.StreamType_DOWNSTREAM, stats[0].Kind)
require.Equal(t, totalBytes, int(stats[0].TotalBytes)) require.Equal(t, totalBytes, int(stats[0].TotalBytes))
require.Equal(t, totalPackets, int(stats[0].TotalPackets)) require.Equal(t, totalPackets, int(stats[0].TotalPackets))
require.Equal(t, trackID, stats[0].TrackId) require.Equal(t, string(trackID), stats[0].TrackId)
} }
func Test_OnDownstreamPackets_SeveralTracks(t *testing.T) { func Test_OnDownstreamPackets_SeveralTracks(t *testing.T) {
@@ -85,16 +85,16 @@ func Test_OnDownstreamPackets_SeveralTracks(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
clientInfo := &livekit.ClientInfo{Sdk: 2} clientInfo := &livekit.ClientInfo{Sdk: 2}
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, clientInfo) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, clientInfo)
//do //do
packet1 := 33 packet1 := 33
trackID1 := "trackID1" trackID1 := livekit.TrackID("trackID1")
packet2 := 23 packet2 := 23
trackID2 := "trackID2" trackID2 := livekit.TrackID("trackID2")
fixture.sut.OnDownstreamPacket(partSID, trackID1, packet1) fixture.sut.OnDownstreamPacket(partSID, trackID1, packet1)
fixture.sut.OnDownstreamPacket(partSID, trackID2, packet2) fixture.sut.OnDownstreamPacket(partSID, trackID2, packet2)
fixture.sut.SendAnalytics() fixture.sut.SendAnalytics()
@@ -107,11 +107,11 @@ func Test_OnDownstreamPackets_SeveralTracks(t *testing.T) {
found1 := false found1 := false
found2 := false found2 := false
for _, sentStat := range stats { for _, sentStat := range stats {
if sentStat.TrackId == trackID1 { if livekit.TrackID(sentStat.TrackId) == trackID1 {
found1 = true found1 = true
require.Equal(t, packet1, int(sentStat.TotalBytes)) require.Equal(t, packet1, int(sentStat.TotalBytes))
require.Equal(t, 1, int(sentStat.TotalPackets)) require.Equal(t, 1, int(sentStat.TotalPackets))
} else if sentStat.TrackId == trackID2 { } else if livekit.TrackID(sentStat.TrackId) == trackID2 {
found2 = true found2 = true
require.Equal(t, packet2, int(sentStat.TotalBytes)) require.Equal(t, packet2, int(sentStat.TotalBytes))
require.Equal(t, 1, int(sentStat.TotalPackets)) require.Equal(t, 1, int(sentStat.TotalPackets))
@@ -126,8 +126,8 @@ func Test_OnDownStreamRTCP(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil)
//do //do
@@ -142,7 +142,7 @@ func Test_OnDownStreamRTCP(t *testing.T) {
}, },
}, },
} }
trackID := "trackID1" trackID := livekit.TrackID("trackID1")
fixture.sut.OnDownstreamPacket(partSID, trackID, 1) // there should be bytes reported so that stats are sent fixture.sut.OnDownstreamPacket(partSID, trackID, 1) // there should be bytes reported so that stats are sent
fixture.sut.HandleRTCP(livekit.StreamType_DOWNSTREAM, partSID, trackID, pkts) fixture.sut.HandleRTCP(livekit.StreamType_DOWNSTREAM, partSID, trackID, pkts)
fixture.sut.SendAnalytics() fixture.sut.SendAnalytics()
@@ -158,7 +158,7 @@ func Test_OnDownStreamRTCP(t *testing.T) {
require.Equal(t, 0, int(stats[0].Rtt)) // TODO: test for RTT require.Equal(t, 0, int(stats[0].Rtt)) // TODO: test for RTT
require.Equal(t, 5, int(stats[0].Jitter)) // max of jitter, see list of rtcp.ReceptionReport above require.Equal(t, 5, int(stats[0].Jitter)) // max of jitter, see list of rtcp.ReceptionReport above
require.Equal(t, 4, int(stats[0].PacketLost)) // last reported packets lost, see list of rtcp.ReceptionReport above require.Equal(t, 4, int(stats[0].PacketLost)) // last reported packets lost, see list of rtcp.ReceptionReport above
require.Equal(t, trackID, stats[0].TrackId) require.Equal(t, string(trackID), stats[0].TrackId)
} }
func Test_PacketLostDiffShouldBeSentToTelemetry(t *testing.T) { func Test_PacketLostDiffShouldBeSentToTelemetry(t *testing.T) {
@@ -166,8 +166,8 @@ func Test_PacketLostDiffShouldBeSentToTelemetry(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil)
//do //do
@@ -185,7 +185,7 @@ func Test_PacketLostDiffShouldBeSentToTelemetry(t *testing.T) {
}, },
}, },
} }
trackID := "trackID1" trackID := livekit.TrackID("trackID1")
fixture.sut.OnDownstreamPacket(partSID, trackID, 1) // there should be bytes reported so that stats are sent fixture.sut.OnDownstreamPacket(partSID, trackID, 1) // there should be bytes reported so that stats are sent
fixture.sut.HandleRTCP(livekit.StreamType_DOWNSTREAM, partSID, trackID, pkts1) fixture.sut.HandleRTCP(livekit.StreamType_DOWNSTREAM, partSID, trackID, pkts1)
fixture.sut.SendAnalytics() fixture.sut.SendAnalytics()
@@ -210,8 +210,8 @@ func Test_OnDownStreamRTCP_SeveralTracks(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil)
//do //do
@@ -221,8 +221,8 @@ func Test_OnDownStreamRTCP_SeveralTracks(t *testing.T) {
pkts2 := []rtcp.Packet{ pkts2 := []rtcp.Packet{
&rtcp.FullIntraRequest{}, &rtcp.FullIntraRequest{},
} }
trackID1 := "trackID1" trackID1 := livekit.TrackID("trackID1")
trackID2 := "trackID2" trackID2 := livekit.TrackID("trackID2")
fixture.sut.OnDownstreamPacket(partSID, trackID1, 1) // there should be bytes reported so that stats are sent fixture.sut.OnDownstreamPacket(partSID, trackID1, 1) // there should be bytes reported so that stats are sent
fixture.sut.HandleRTCP(livekit.StreamType_DOWNSTREAM, partSID, trackID1, pkts1) fixture.sut.HandleRTCP(livekit.StreamType_DOWNSTREAM, partSID, trackID1, pkts1)
fixture.sut.OnDownstreamPacket(partSID, trackID2, 1) // there should be bytes reported so that stats are sent fixture.sut.OnDownstreamPacket(partSID, trackID2, 1) // there should be bytes reported so that stats are sent
@@ -237,11 +237,11 @@ func Test_OnDownStreamRTCP_SeveralTracks(t *testing.T) {
found1 := false found1 := false
found2 := false found2 := false
for _, sentStat := range stats { for _, sentStat := range stats {
if sentStat.TrackId == trackID1 { if livekit.TrackID(sentStat.TrackId) == trackID1 {
found1 = true found1 = true
require.Equal(t, livekit.StreamType_DOWNSTREAM, sentStat.Kind) require.Equal(t, livekit.StreamType_DOWNSTREAM, sentStat.Kind)
require.Equal(t, 1, int(sentStat.NackCount)) // see pkts1 above require.Equal(t, 1, int(sentStat.NackCount)) // see pkts1 above
} else if sentStat.TrackId == trackID2 { } else if livekit.TrackID(sentStat.TrackId) == trackID2 {
found2 = true found2 = true
require.Equal(t, livekit.StreamType_DOWNSTREAM, sentStat.Kind) require.Equal(t, livekit.StreamType_DOWNSTREAM, sentStat.Kind)
require.Equal(t, 1, int(sentStat.FirCount)) // see pkts2 above require.Equal(t, 1, int(sentStat.FirCount)) // see pkts2 above
@@ -255,8 +255,8 @@ func Test_OnUpstreamRTCP(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil)
//do //do
@@ -277,7 +277,7 @@ func Test_OnUpstreamRTCP(t *testing.T) {
PacketCount: 1, PacketCount: 1,
TotalByte: 1, TotalByte: 1,
}) })
trackID := "trackID" trackID := livekit.TrackID("trackID")
fixture.sut.AddUpTrack(partSID, trackID, buf) fixture.sut.AddUpTrack(partSID, trackID, buf)
fixture.sut.HandleRTCP(livekit.StreamType_UPSTREAM, partSID, trackID, pkts) fixture.sut.HandleRTCP(livekit.StreamType_UPSTREAM, partSID, trackID, pkts)
fixture.sut.SendAnalytics() fixture.sut.SendAnalytics()
@@ -293,7 +293,7 @@ func Test_OnUpstreamRTCP(t *testing.T) {
require.Equal(t, 0, int(stats[0].Rtt)) // TODO: test for RTT require.Equal(t, 0, int(stats[0].Rtt)) // TODO: test for RTT
require.Equal(t, 5, int(stats[0].Jitter)) // max of jitter, see list of rtcp.ReceptionReport above require.Equal(t, 5, int(stats[0].Jitter)) // max of jitter, see list of rtcp.ReceptionReport above
require.Equal(t, 4, int(stats[0].PacketLost)) // last reported packets lost, see list of rtcp.ReceptionReport above require.Equal(t, 4, int(stats[0].PacketLost)) // last reported packets lost, see list of rtcp.ReceptionReport above
require.Equal(t, trackID, stats[0].TrackId) require.Equal(t, string(trackID), stats[0].TrackId)
} }
func Test_OnUpstreamRTCP_SeveralTracks(t *testing.T) { func Test_OnUpstreamRTCP_SeveralTracks(t *testing.T) {
@@ -301,8 +301,8 @@ func Test_OnUpstreamRTCP_SeveralTracks(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil)
// there should be bytes reported so that stats are sent // there should be bytes reported so that stats are sent
@@ -313,8 +313,8 @@ func Test_OnUpstreamRTCP_SeveralTracks(t *testing.T) {
PacketCount: uint32(tolalPackets), PacketCount: uint32(tolalPackets),
TotalByte: uint64(totalBytes), TotalByte: uint64(totalBytes),
}) })
trackID1 := "trackID1" trackID1 := livekit.TrackID("trackID1")
trackID2 := "trackID2" trackID2 := livekit.TrackID("trackID2")
fixture.sut.AddUpTrack(partSID, trackID1, buf) fixture.sut.AddUpTrack(partSID, trackID1, buf)
fixture.sut.AddUpTrack(partSID, trackID2, buf) //using same buffer is not correct but for test it is fine fixture.sut.AddUpTrack(partSID, trackID2, buf) //using same buffer is not correct but for test it is fine
pkts1 := []rtcp.Packet{ pkts1 := []rtcp.Packet{
@@ -336,11 +336,11 @@ func Test_OnUpstreamRTCP_SeveralTracks(t *testing.T) {
found1 := false found1 := false
found2 := false found2 := false
for _, sentStat := range stats { for _, sentStat := range stats {
if sentStat.TrackId == trackID1 { if livekit.TrackID(sentStat.TrackId) == trackID1 {
found1 = true found1 = true
require.Equal(t, livekit.StreamType_UPSTREAM, sentStat.Kind) require.Equal(t, livekit.StreamType_UPSTREAM, sentStat.Kind)
require.Equal(t, 1, int(sentStat.NackCount)) // see pkts1 above require.Equal(t, 1, int(sentStat.NackCount)) // see pkts1 above
} else if sentStat.TrackId == trackID2 { } else if livekit.TrackID(sentStat.TrackId) == trackID2 {
found2 = true found2 = true
require.Equal(t, livekit.StreamType_UPSTREAM, sentStat.Kind) require.Equal(t, livekit.StreamType_UPSTREAM, sentStat.Kind)
require.Equal(t, 1, int(sentStat.FirCount)) // see pkts2 above require.Equal(t, 1, int(sentStat.FirCount)) // see pkts2 above
@@ -352,7 +352,7 @@ func Test_OnUpstreamRTCP_SeveralTracks(t *testing.T) {
require.True(t, found2) require.True(t, found2)
//remove 1 buffer //remove 1 buffer
fixture.sut.TrackUnpublished(context.Background(), partSID, &livekit.TrackInfo{Sid: trackID2}, 0) fixture.sut.TrackUnpublished(context.Background(), partSID, &livekit.TrackInfo{Sid: string(trackID2)}, 0)
fixture.sut.SendAnalytics() fixture.sut.SendAnalytics()
require.Equal(t, 2, fixture.analytics.SendStatsCallCount()) require.Equal(t, 2, fixture.analytics.SendStatsCallCount())
_, stats = fixture.analytics.SendStatsArgsForCall(1) _, stats = fixture.analytics.SendStatsArgsForCall(1)
@@ -386,8 +386,8 @@ func Test_AddUpTrack(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil)
//do //do
@@ -399,7 +399,7 @@ func Test_AddUpTrack(t *testing.T) {
TotalByte: totalBytes, TotalByte: totalBytes,
} }
buf.SetStatsTestOnly(bufferStats) buf.SetStatsTestOnly(bufferStats)
trackID := "trackID" trackID := livekit.TrackID("trackID")
fixture.sut.AddUpTrack(partSID, trackID, buf) fixture.sut.AddUpTrack(partSID, trackID, buf)
fixture.sut.SendAnalytics() fixture.sut.SendAnalytics()
@@ -410,7 +410,7 @@ func Test_AddUpTrack(t *testing.T) {
require.Equal(t, livekit.StreamType_UPSTREAM, stats[0].Kind) require.Equal(t, livekit.StreamType_UPSTREAM, stats[0].Kind)
require.Equal(t, totalBytes, stats[0].TotalBytes) require.Equal(t, totalBytes, stats[0].TotalBytes)
require.Equal(t, totalPackets, uint32(stats[0].TotalPackets)) require.Equal(t, totalPackets, uint32(stats[0].TotalPackets))
require.Equal(t, trackID, stats[0].TrackId) require.Equal(t, string(trackID), stats[0].TrackId)
} }
func Test_AddUpTrack_SeveralBuffers_Simulcast(t *testing.T) { func Test_AddUpTrack_SeveralBuffers_Simulcast(t *testing.T) {
@@ -418,11 +418,11 @@ func Test_AddUpTrack_SeveralBuffers_Simulcast(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil)
//do //do
trackID := "trackID" trackID := livekit.TrackID("trackID")
//buffer 1 //buffer 1
buf1 := &buffer.Buffer{} buf1 := &buffer.Buffer{}
buf1.SetStatsTestOnly(buffer.Stats{ buf1.SetStatsTestOnly(buffer.Stats{
@@ -447,7 +447,7 @@ func Test_AddUpTrack_SeveralBuffers_Simulcast(t *testing.T) {
require.Equal(t, livekit.StreamType_UPSTREAM, stats[0].Kind) require.Equal(t, livekit.StreamType_UPSTREAM, stats[0].Kind)
require.Equal(t, totalBytes, stats[0].TotalBytes) require.Equal(t, totalBytes, stats[0].TotalBytes)
require.Equal(t, totalPackets, uint32(stats[0].TotalPackets)) require.Equal(t, totalPackets, uint32(stats[0].TotalPackets))
require.Equal(t, trackID, stats[0].TrackId) require.Equal(t, string(trackID), stats[0].TrackId)
} }
func Test_BothDownstreamAndUpstreamStatsAreSentTogether(t *testing.T) { func Test_BothDownstreamAndUpstreamStatsAreSentTogether(t *testing.T) {
@@ -455,8 +455,8 @@ func Test_BothDownstreamAndUpstreamStatsAreSentTogether(t *testing.T) {
//prepare //prepare
room := &livekit.Room{} room := &livekit.Room{}
partSID := "part1" partSID := livekit.ParticipantID("part1")
participantInfo := &livekit.ParticipantInfo{Sid: partSID} participantInfo := &livekit.ParticipantInfo{Sid: string(partSID)}
fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil) fixture.sut.ParticipantJoined(context.Background(), room, participantInfo, nil)
//do //do
+20 -20
View File
@@ -30,7 +30,7 @@ const (
) )
type RTCClient struct { type RTCClient struct {
id string id livekit.ParticipantID
conn *websocket.Conn conn *websocket.Conn
publisher *rtc.PCTransport publisher *rtc.PCTransport
subscriber *rtc.PCTransport subscriber *rtc.PCTransport
@@ -43,9 +43,9 @@ type RTCClient struct {
connected utils.AtomicFlag connected utils.AtomicFlag
iceConnected utils.AtomicFlag iceConnected utils.AtomicFlag
me *webrtc.MediaEngine // optional, populated only when receiving tracks me *webrtc.MediaEngine // optional, populated only when receiving tracks
subscribedTracks map[string][]*webrtc.TrackRemote subscribedTracks map[livekit.ParticipantID][]*webrtc.TrackRemote
localParticipant *livekit.ParticipantInfo localParticipant *livekit.ParticipantInfo
remoteParticipants map[string]*livekit.ParticipantInfo remoteParticipants map[livekit.ParticipantID]*livekit.ParticipantInfo
reliableDC *webrtc.DataChannel reliableDC *webrtc.DataChannel
reliableDCSub *webrtc.DataChannel reliableDCSub *webrtc.DataChannel
@@ -61,9 +61,9 @@ type RTCClient struct {
OnConnected func() OnConnected func()
OnDataReceived func(data []byte, sid string) OnDataReceived func(data []byte, sid string)
// map of track ID and last packet // map of livekit.ParticipantID and last packet
lastPackets map[string]*rtp.Packet lastPackets map[livekit.ParticipantID]*rtp.Packet
bytesReceived map[string]uint64 bytesReceived map[livekit.ParticipantID]uint64
} }
var ( var (
@@ -115,11 +115,11 @@ func NewRTCClient(conn *websocket.Conn) (*RTCClient, error) {
conn: conn, conn: conn,
localTracks: make(map[string]webrtc.TrackLocal), localTracks: make(map[string]webrtc.TrackLocal),
pendingPublishedTracks: make(map[string]*livekit.TrackInfo), pendingPublishedTracks: make(map[string]*livekit.TrackInfo),
subscribedTracks: make(map[string][]*webrtc.TrackRemote), subscribedTracks: make(map[livekit.ParticipantID][]*webrtc.TrackRemote),
remoteParticipants: make(map[string]*livekit.ParticipantInfo), remoteParticipants: make(map[livekit.ParticipantID]*livekit.ParticipantInfo),
me: &webrtc.MediaEngine{}, me: &webrtc.MediaEngine{},
lastPackets: make(map[string]*rtp.Packet), lastPackets: make(map[livekit.ParticipantID]*rtp.Packet),
bytesReceived: make(map[string]uint64), bytesReceived: make(map[livekit.ParticipantID]uint64),
} }
c.ctx, c.cancel = context.WithCancel(context.Background()) c.ctx, c.cancel = context.WithCancel(context.Background())
@@ -241,7 +241,7 @@ func NewRTCClient(conn *websocket.Conn) (*RTCClient, error) {
return c, nil return c, nil
} }
func (c *RTCClient) ID() string { func (c *RTCClient) ID() livekit.ParticipantID {
return c.id return c.id
} }
@@ -266,10 +266,10 @@ func (c *RTCClient) Run() error {
switch msg := res.Message.(type) { switch msg := res.Message.(type) {
case *livekit.SignalResponse_Join: case *livekit.SignalResponse_Join:
c.localParticipant = msg.Join.Participant c.localParticipant = msg.Join.Participant
c.id = msg.Join.Participant.Sid c.id = livekit.ParticipantID(msg.Join.Participant.Sid)
c.lock.Lock() c.lock.Lock()
for _, p := range msg.Join.OtherParticipants { for _, p := range msg.Join.OtherParticipants {
c.remoteParticipants[p.Sid] = p c.remoteParticipants[livekit.ParticipantID(p.Sid)] = p
} }
c.lock.Unlock() c.lock.Unlock()
// if publish only, negotiate // if publish only, negotiate
@@ -309,9 +309,9 @@ func (c *RTCClient) Run() error {
c.lock.Lock() c.lock.Lock()
for _, p := range msg.Update.Participants { for _, p := range msg.Update.Participants {
if p.State != livekit.ParticipantInfo_DISCONNECTED { if p.State != livekit.ParticipantInfo_DISCONNECTED {
c.remoteParticipants[p.Sid] = p c.remoteParticipants[livekit.ParticipantID(p.Sid)] = p
} else { } else {
delete(c.remoteParticipants, p.Sid) delete(c.remoteParticipants, livekit.ParticipantID(p.Sid))
} }
} }
c.lock.Unlock() c.lock.Unlock()
@@ -332,7 +332,7 @@ func (c *RTCClient) WaitUntilConnected() error {
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
id := c.ID() id := string(c.ID())
if c.localParticipant != nil { if c.localParticipant != nil {
id = c.localParticipant.Identity id = c.localParticipant.Identity
} }
@@ -372,11 +372,11 @@ func (c *RTCClient) ReadResponse() (*livekit.SignalResponse, error) {
} }
} }
func (c *RTCClient) SubscribedTracks() map[string][]*webrtc.TrackRemote { func (c *RTCClient) SubscribedTracks() map[livekit.ParticipantID][]*webrtc.TrackRemote {
// create a copy of this // create a copy of this
c.lock.Lock() c.lock.Lock()
defer c.lock.Unlock() defer c.lock.Unlock()
tracks := make(map[string][]*webrtc.TrackRemote, len(c.subscribedTracks)) tracks := make(map[livekit.ParticipantID][]*webrtc.TrackRemote, len(c.subscribedTracks))
for key, val := range c.subscribedTracks { for key, val := range c.subscribedTracks {
tracks[key] = val tracks[key] = val
} }
@@ -389,7 +389,7 @@ func (c *RTCClient) RemoteParticipants() []*livekit.ParticipantInfo {
return funk.Values(c.remoteParticipants).([]*livekit.ParticipantInfo) return funk.Values(c.remoteParticipants).([]*livekit.ParticipantInfo)
} }
func (c *RTCClient) GetRemoteParticipant(sid string) *livekit.ParticipantInfo { func (c *RTCClient) GetRemoteParticipant(sid livekit.ParticipantID) *livekit.ParticipantInfo {
c.lock.Lock() c.lock.Lock()
defer c.lock.Unlock() defer c.lock.Unlock()
return c.remoteParticipants[sid] return c.remoteParticipants[sid]
@@ -659,7 +659,7 @@ func (c *RTCClient) processTrack(track *webrtc.TrackRemote) {
lastUpdate := time.Time{} lastUpdate := time.Time{}
pId, trackId := rtc.UnpackStreamID(track.StreamID()) pId, trackId := rtc.UnpackStreamID(track.StreamID())
if trackId == "" { if trackId == "" {
trackId = track.ID() trackId = livekit.TrackID(track.ID())
} }
c.lock.Lock() c.lock.Lock()
c.subscribedTracks[pId] = append(c.subscribedTracks[pId], track) c.subscribedTracks[pId] = append(c.subscribedTracks[pId], track)
+1 -1
View File
@@ -129,7 +129,7 @@ func scenarioDataPublish(t *testing.T) {
received := utils.AtomicFlag{} received := utils.AtomicFlag{}
c2.OnDataReceived = func(data []byte, sid string) { c2.OnDataReceived = func(data []byte, sid string) {
if string(data) == payload && sid == c1.ID() { if string(data) == payload && livekit.ParticipantID(sid) == c1.ID() {
received.TrySet(true) received.TrySet(true)
} }
} }