diff --git a/cmd/cli/commands/room.go b/cmd/cli/commands/room.go index 5c725630..cff5d8b8 100644 --- a/cmd/cli/commands/room.go +++ b/cmd/cli/commands/room.go @@ -52,6 +52,63 @@ var ( secretFlag, }, }, + { + Name: "list-participants", + Before: createClient, + Action: listParticipants, + Flags: []cli.Flag{ + roomFlag, + roomHostFlag, + apiKeyFlag, + secretFlag, + }, + }, + { + Name: "get-participant", + Before: createClient, + Action: getParticipant, + Flags: []cli.Flag{ + roomFlag, + identityFlag, + roomHostFlag, + apiKeyFlag, + secretFlag, + }, + }, + { + Name: "remove-participant", + Before: createClient, + Action: removeParticipant, + Flags: []cli.Flag{ + roomFlag, + identityFlag, + roomHostFlag, + apiKeyFlag, + secretFlag, + }, + }, + { + Name: "mute-track", + Before: createClient, + Action: muteTrack, + Flags: []cli.Flag{ + roomFlag, + identityFlag, + &cli.StringFlag{ + Name: "track", + Usage: "track sid to mute", + Required: true, + }, + &cli.BoolFlag{ + Name: "muted", + Usage: "set to true to mute, false to unmute", + Required: true, + }, + roomHostFlag, + apiKeyFlag, + secretFlag, + }, + }, } roomClient livekit.RoomService @@ -102,6 +159,75 @@ func deleteRoom(c *cli.Context) error { return nil } +func listParticipants(c *cli.Context) error { + roomName := c.String("room") + ctx := contextWithAccessToken(c, &auth.VideoGrant{RoomAdmin: true, Room: roomName}) + res, err := roomClient.ListParticipants(ctx, &livekit.ListParticipantsRequest{ + Room: roomName, + }) + if err != nil { + return err + } + + for _, p := range res.Participants { + fmt.Printf("%s (%s)\t tracks: %d\n", p.Identity, p.State.String(), len(p.Tracks)) + } + return nil +} + +func getParticipant(c *cli.Context) error { + roomName := c.String("room") + identity := c.String("identity") + ctx := contextWithAccessToken(c, &auth.VideoGrant{RoomAdmin: true, Room: roomName}) + res, err := roomClient.GetParticipant(ctx, &livekit.RoomParticipantIdentity{ + Room: roomName, + Identity: identity, + }) + if err != nil { + return err + } + + PrintJSON(res) + + return nil +} + +func removeParticipant(c *cli.Context) error { + roomName := c.String("room") + identity := c.String("identity") + ctx := contextWithAccessToken(c, &auth.VideoGrant{RoomAdmin: true, Room: roomName}) + _, err := roomClient.RemoveParticipant(ctx, &livekit.RoomParticipantIdentity{ + Room: roomName, + Identity: identity, + }) + if err != nil { + return err + } + + fmt.Println("successfully removed participant", identity) + + return nil +} + +func muteTrack(c *cli.Context) error { + roomName := c.String("room") + identity := c.String("identity") + trackSid := c.String("track") + ctx := contextWithAccessToken(c, &auth.VideoGrant{RoomAdmin: true, Room: roomName}) + _, err := roomClient.MutePublishedTrack(ctx, &livekit.MuteRoomTrackRequest{ + Room: roomName, + Identity: identity, + TrackSid: trackSid, + Muted: c.Bool("muted"), + }) + if err != nil { + return err + } + + fmt.Println("muted track", trackSid) + return nil +} + func contextWithAccessToken(c *cli.Context, grant *auth.VideoGrant) context.Context { ctx := context.Background() token, err := accessToken(c, grant, "") diff --git a/cmd/cli/commands/rtc.go b/cmd/cli/commands/rtc.go index 3551bfd4..3d26637b 100644 --- a/cmd/cli/commands/rtc.go +++ b/cmd/cli/commands/rtc.go @@ -20,15 +20,14 @@ var ( Name: "join", Action: joinRoom, Flags: []cli.Flag{ - roomFlag, rtcHostFlag, &cli.StringFlag{ Name: "token", - Usage: "access token, not required in dev mode. if passed in, ignores --api-key, --api-secret, and --name", + Usage: "access token, not required in dev mode. if passed in, ignores --api-key, --api-secret, and --identity", }, &cli.StringFlag{ - Name: "name", - Usage: "name of participant", + Name: "identity", + Usage: "identity of the participant, required if token isn't passed in", }, &cli.StringFlag{ Name: "audio", @@ -46,7 +45,7 @@ var ( ) func joinRoom(c *cli.Context) error { - name := c.String("name") + identity := c.String("identity") roomId := c.String("room") token := c.String("token") @@ -56,15 +55,15 @@ func joinRoom(c *cli.Context) error { if roomId == "" { return fmt.Errorf("--room is required") } - if name == "" { - return fmt.Errorf("--name is required") + if identity == "" { + return fmt.Errorf("--identity is required") } // token may be nil in dev mode var err error token, err = accessToken(c, &auth.VideoGrant{ RoomJoin: true, Room: roomId, - }, name) + }, identity) if err != nil { return err } diff --git a/cmd/cli/commands/utils.go b/cmd/cli/commands/utils.go index 5e48e2ad..3e6b04d9 100644 --- a/cmd/cli/commands/utils.go +++ b/cmd/cli/commands/utils.go @@ -15,8 +15,9 @@ import ( var ( roomFlag = &cli.StringFlag{ - Name: "room", - Usage: "name or id of the room", + Name: "room", + Usage: "name or id of the room", + Required: true, } roomHostFlag = &cli.StringFlag{ Name: "host", @@ -36,6 +37,11 @@ var ( EnvVars: []string{"LIVEKIT_API_SECRET"}, Required: true, } + identityFlag = &cli.StringFlag{ + Name: "identity", + Usage: "identity of participant", + Required: true, + } devFlag = &cli.BoolFlag{ Name: "dev", Usage: "enables dev mode, longer expiration for tokens", diff --git a/pkg/auth/grants.go b/pkg/auth/grants.go index 1e1f0ebc..22b1c5a7 100644 --- a/pkg/auth/grants.go +++ b/pkg/auth/grants.go @@ -1,10 +1,14 @@ package auth type VideoGrant struct { - RoomCreate bool `json:"roomCreate,omitempty"` - RoomJoin bool `json:"roomJoin,omitempty"` - RoomList bool `json:"roomList,omitempty"` - Room string `json:"room,omitempty"` + // actions on rooms + RoomCreate bool `json:"roomCreate,omitempty"` + RoomList bool `json:"roomList,omitempty"` + + // actions on a particular room + RoomAdmin bool `json:"roomAdmin,omitempty"` + RoomJoin bool `json:"roomJoin,omitempty"` + Room string `json:"room,omitempty"` } type ClaimGrants struct { diff --git a/pkg/routing/interfaces.go b/pkg/routing/interfaces.go index 04640d11..5c78ad54 100644 --- a/pkg/routing/interfaces.go +++ b/pkg/routing/interfaces.go @@ -23,7 +23,8 @@ type MessageSource interface { ReadChan() <-chan proto.Message } -type ParticipantCallback func(roomName, identity string, reconnect bool, requestSource MessageSource, responseSink MessageSink) +type NewParticipantCallback func(roomName, identity string, reconnect bool, requestSource MessageSource, responseSink MessageSink) +type RTCMessageCallback func(roomName, identity string, msg *livekit.RTCNodeMessage) // Router allows multiple nodes to coordinate the participant session //counterfeiter:generate . Router @@ -39,9 +40,13 @@ type Router interface { // participant signal connection is ready to start StartParticipantSignal(roomName, identity string, reconnect bool) (reqSink MessageSink, resSource MessageSource, err error) + // sends a message to RTC node + SendRTCMessage(roomName, identity string, msg *livekit.RTCNodeMessage) error // when a new participant's RTC connection is ready to start - OnNewParticipantRTC(callback ParticipantCallback) + OnNewParticipantRTC(callback NewParticipantCallback) + // messages to be delivered to RTC node + OnRTCMessage(callback RTCMessageCallback) Start() error Stop() } diff --git a/pkg/routing/localrouter.go b/pkg/routing/localrouter.go index 476fa792..fc3fcf3c 100644 --- a/pkg/routing/localrouter.go +++ b/pkg/routing/localrouter.go @@ -14,7 +14,9 @@ type LocalRouter struct { // channels for each participant requestChannels map[string]*MessageChannel responseChannels map[string]*MessageChannel - onNewParticipant ParticipantCallback + + onNewParticipant NewParticipantCallback + onRTCMessage RTCMessageCallback } func NewLocalRouter(currentNode LocalNode) *LocalRouter { @@ -86,10 +88,22 @@ func (r *LocalRouter) StartParticipantSignal(roomName, identity string, reconnec return reqChan, resChan, nil } -func (r *LocalRouter) OnNewParticipantRTC(callback ParticipantCallback) { +func (r *LocalRouter) SendRTCMessage(roomName, identity string, msg *livekit.RTCNodeMessage) error { + if r.onRTCMessage == nil { + return nil + } + go r.onRTCMessage(roomName, identity, msg) + return nil +} + +func (r *LocalRouter) OnNewParticipantRTC(callback NewParticipantCallback) { r.onNewParticipant = callback } +func (r *LocalRouter) OnRTCMessage(callback RTCMessageCallback) { + r.onRTCMessage = callback +} + func (r *LocalRouter) Start() error { go r.statsWorker() // on local routers, Start doesn't do anything, websocket connections initiate the connections diff --git a/pkg/routing/redis.go b/pkg/routing/redis.go index fca335db..3b93be5a 100644 --- a/pkg/routing/redis.go +++ b/pkg/routing/redis.go @@ -51,6 +51,9 @@ func publishRTCMessage(rc *redis.Client, nodeId string, participantKey string, m rm.Message = &livekit.RTCNodeMessage_Request{ Request: o, } + case *livekit.RTCNodeMessage: + rm = o + rm.ParticipantKey = participantKey default: return errInvalidRouterMessage } diff --git a/pkg/routing/redisrouter.go b/pkg/routing/redisrouter.go index 118703b1..ee87c2ad 100644 --- a/pkg/routing/redisrouter.go +++ b/pkg/routing/redisrouter.go @@ -162,6 +162,18 @@ func (r *RedisRouter) StartParticipantSignal(roomName, identity string, reconnec return sink, resChan, nil } +func (r *RedisRouter) SendRTCMessage(roomName, identity string, msg *livekit.RTCNodeMessage) error { + pkey := participantKey(roomName, identity) + rtcNode, err := r.getParticipantRTCNode(pkey) + if err != nil { + return err + } + + rtcSink := r.getOrCreateRTCSink(rtcNode, pkey) + + return rtcSink.WriteMessage(msg) +} + func (r *RedisRouter) startParticipantRTC(ss *livekit.StartSession, participantKey string) error { // find the node where the room is hosted at rtcNode, err := r.GetNodeForRoom(ss.RoomName) @@ -394,6 +406,16 @@ func (r *RedisRouter) handleRTCMessage(rm *livekit.RTCNodeMessage) error { if err := requestChan.WriteMessage(rmb.Request); err != nil { return err } + + default: + // route it to handler + if r.onRTCMessage != nil { + roomName, identity, err := parseParticipantKey(pKey) + if err != nil { + return err + } + r.onRTCMessage(roomName, identity, rm) + } } return nil } diff --git a/pkg/routing/routingfakes/fake_router.go b/pkg/routing/routingfakes/fake_router.go index afd88bb5..61aa0451 100644 --- a/pkg/routing/routingfakes/fake_router.go +++ b/pkg/routing/routingfakes/fake_router.go @@ -58,10 +58,15 @@ type FakeRouter struct { result1 []*livekit.Node result2 error } - OnNewParticipantRTCStub func(routing.ParticipantCallback) + OnNewParticipantRTCStub func(routing.NewParticipantCallback) onNewParticipantRTCMutex sync.RWMutex onNewParticipantRTCArgsForCall []struct { - arg1 routing.ParticipantCallback + arg1 routing.NewParticipantCallback + } + OnRTCMessageStub func(routing.RTCMessageCallback) + onRTCMessageMutex sync.RWMutex + onRTCMessageArgsForCall []struct { + arg1 routing.RTCMessageCallback } RegisterNodeStub func() error registerNodeMutex sync.RWMutex @@ -83,6 +88,19 @@ type FakeRouter struct { removeDeadNodesReturnsOnCall map[int]struct { result1 error } + SendRTCMessageStub func(string, string, *livekit.RTCNodeMessage) error + sendRTCMessageMutex sync.RWMutex + sendRTCMessageArgsForCall []struct { + arg1 string + arg2 string + arg3 *livekit.RTCNodeMessage + } + sendRTCMessageReturns struct { + result1 error + } + sendRTCMessageReturnsOnCall map[int]struct { + result1 error + } SetNodeForRoomStub func(string, string) error setNodeForRoomMutex sync.RWMutex setNodeForRoomArgsForCall []struct { @@ -385,10 +403,10 @@ func (fake *FakeRouter) ListNodesReturnsOnCall(i int, result1 []*livekit.Node, r }{result1, result2} } -func (fake *FakeRouter) OnNewParticipantRTC(arg1 routing.ParticipantCallback) { +func (fake *FakeRouter) OnNewParticipantRTC(arg1 routing.NewParticipantCallback) { fake.onNewParticipantRTCMutex.Lock() fake.onNewParticipantRTCArgsForCall = append(fake.onNewParticipantRTCArgsForCall, struct { - arg1 routing.ParticipantCallback + arg1 routing.NewParticipantCallback }{arg1}) stub := fake.OnNewParticipantRTCStub fake.recordInvocation("OnNewParticipantRTC", []interface{}{arg1}) @@ -404,19 +422,51 @@ func (fake *FakeRouter) OnNewParticipantRTCCallCount() int { return len(fake.onNewParticipantRTCArgsForCall) } -func (fake *FakeRouter) OnNewParticipantRTCCalls(stub func(routing.ParticipantCallback)) { +func (fake *FakeRouter) OnNewParticipantRTCCalls(stub func(routing.NewParticipantCallback)) { fake.onNewParticipantRTCMutex.Lock() defer fake.onNewParticipantRTCMutex.Unlock() fake.OnNewParticipantRTCStub = stub } -func (fake *FakeRouter) OnNewParticipantRTCArgsForCall(i int) routing.ParticipantCallback { +func (fake *FakeRouter) OnNewParticipantRTCArgsForCall(i int) routing.NewParticipantCallback { fake.onNewParticipantRTCMutex.RLock() defer fake.onNewParticipantRTCMutex.RUnlock() argsForCall := fake.onNewParticipantRTCArgsForCall[i] return argsForCall.arg1 } +func (fake *FakeRouter) OnRTCMessage(arg1 routing.RTCMessageCallback) { + fake.onRTCMessageMutex.Lock() + fake.onRTCMessageArgsForCall = append(fake.onRTCMessageArgsForCall, struct { + arg1 routing.RTCMessageCallback + }{arg1}) + stub := fake.OnRTCMessageStub + fake.recordInvocation("OnRTCMessage", []interface{}{arg1}) + fake.onRTCMessageMutex.Unlock() + if stub != nil { + fake.OnRTCMessageStub(arg1) + } +} + +func (fake *FakeRouter) OnRTCMessageCallCount() int { + fake.onRTCMessageMutex.RLock() + defer fake.onRTCMessageMutex.RUnlock() + return len(fake.onRTCMessageArgsForCall) +} + +func (fake *FakeRouter) OnRTCMessageCalls(stub func(routing.RTCMessageCallback)) { + fake.onRTCMessageMutex.Lock() + defer fake.onRTCMessageMutex.Unlock() + fake.OnRTCMessageStub = stub +} + +func (fake *FakeRouter) OnRTCMessageArgsForCall(i int) routing.RTCMessageCallback { + fake.onRTCMessageMutex.RLock() + defer fake.onRTCMessageMutex.RUnlock() + argsForCall := fake.onRTCMessageArgsForCall[i] + return argsForCall.arg1 +} + func (fake *FakeRouter) RegisterNode() error { fake.registerNodeMutex.Lock() ret, specificReturn := fake.registerNodeReturnsOnCall[len(fake.registerNodeArgsForCall)] @@ -523,6 +573,69 @@ func (fake *FakeRouter) RemoveDeadNodesReturnsOnCall(i int, result1 error) { }{result1} } +func (fake *FakeRouter) SendRTCMessage(arg1 string, arg2 string, arg3 *livekit.RTCNodeMessage) error { + fake.sendRTCMessageMutex.Lock() + ret, specificReturn := fake.sendRTCMessageReturnsOnCall[len(fake.sendRTCMessageArgsForCall)] + fake.sendRTCMessageArgsForCall = append(fake.sendRTCMessageArgsForCall, struct { + arg1 string + arg2 string + arg3 *livekit.RTCNodeMessage + }{arg1, arg2, arg3}) + stub := fake.SendRTCMessageStub + fakeReturns := fake.sendRTCMessageReturns + fake.recordInvocation("SendRTCMessage", []interface{}{arg1, arg2, arg3}) + fake.sendRTCMessageMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeRouter) SendRTCMessageCallCount() int { + fake.sendRTCMessageMutex.RLock() + defer fake.sendRTCMessageMutex.RUnlock() + return len(fake.sendRTCMessageArgsForCall) +} + +func (fake *FakeRouter) SendRTCMessageCalls(stub func(string, string, *livekit.RTCNodeMessage) error) { + fake.sendRTCMessageMutex.Lock() + defer fake.sendRTCMessageMutex.Unlock() + fake.SendRTCMessageStub = stub +} + +func (fake *FakeRouter) SendRTCMessageArgsForCall(i int) (string, string, *livekit.RTCNodeMessage) { + fake.sendRTCMessageMutex.RLock() + defer fake.sendRTCMessageMutex.RUnlock() + argsForCall := fake.sendRTCMessageArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeRouter) SendRTCMessageReturns(result1 error) { + fake.sendRTCMessageMutex.Lock() + defer fake.sendRTCMessageMutex.Unlock() + fake.SendRTCMessageStub = nil + fake.sendRTCMessageReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeRouter) SendRTCMessageReturnsOnCall(i int, result1 error) { + fake.sendRTCMessageMutex.Lock() + defer fake.sendRTCMessageMutex.Unlock() + fake.SendRTCMessageStub = nil + if fake.sendRTCMessageReturnsOnCall == nil { + fake.sendRTCMessageReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendRTCMessageReturnsOnCall[i] = struct { + result1 error + }{result1} +} + func (fake *FakeRouter) SetNodeForRoom(arg1 string, arg2 string) error { fake.setNodeForRoomMutex.Lock() ret, specificReturn := fake.setNodeForRoomReturnsOnCall[len(fake.setNodeForRoomArgsForCall)] @@ -797,10 +910,14 @@ func (fake *FakeRouter) Invocations() map[string][][]interface{} { defer fake.listNodesMutex.RUnlock() fake.onNewParticipantRTCMutex.RLock() defer fake.onNewParticipantRTCMutex.RUnlock() + fake.onRTCMessageMutex.RLock() + defer fake.onRTCMessageMutex.RUnlock() fake.registerNodeMutex.RLock() defer fake.registerNodeMutex.RUnlock() fake.removeDeadNodesMutex.RLock() defer fake.removeDeadNodesMutex.RUnlock() + fake.sendRTCMessageMutex.RLock() + defer fake.sendRTCMessageMutex.RUnlock() fake.setNodeForRoomMutex.RLock() defer fake.setNodeForRoomMutex.RUnlock() fake.startMutex.RLock() diff --git a/pkg/routing/utils.go b/pkg/routing/utils.go index a820f5b1..113df077 100644 --- a/pkg/routing/utils.go +++ b/pkg/routing/utils.go @@ -1,6 +1,8 @@ package routing import ( + "errors" + "strings" "time" "github.com/thoas/go-funk" @@ -24,3 +26,13 @@ func GetAvailableNodes(nodes []*livekit.Node) []*livekit.Node { func participantKey(roomName, identity string) string { return roomName + "|" + identity } + +func parseParticipantKey(pkey string) (roomName string, identity string, err error) { + parts := strings.Split(pkey, "|") + if len(parts) != 2 { + err = errors.New("invalid participant key") + return + } + + return parts[0], parts[1], nil +} diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index e814896c..0afc5b6a 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -358,6 +358,16 @@ func (p *ParticipantImpl) Close() error { // already closed return nil } + + // remove all downtracks + p.lock.Lock() + for _, t := range p.publishedTracks { + // skip updates + t.OnClose(nil) + t.RemoveAllSubscribers() + } + p.lock.Unlock() + p.updateState(livekit.ParticipantInfo_DISCONNECTED) p.onICECandidate = nil p.peerConn.OnDataChannel(nil) @@ -437,16 +447,17 @@ func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool) { defer p.lock.RUnlock() track := p.publishedTracks[trackId] if track == nil { + logger.Warnw("could not locate track", "track", trackId) return } - updated := false + currentMuted := track.IsMuted() + track.SetMuted(muted) - switch t := track.(type) { - case *MediaTrack: - updated = t.muted.TrySet(muted) - } - - if updated && p.onTrackUpdated != nil { + if currentMuted != track.IsMuted() && p.onTrackUpdated != nil { + logger.Debugw("mute status changed", + "participant", p.identity, + "track", trackId, + "muted", track.IsMuted()) p.onTrackUpdated(p, track) } } diff --git a/pkg/rtc/room.go b/pkg/rtc/room.go index dcac475e..4f5ae63f 100644 --- a/pkg/rtc/room.go +++ b/pkg/rtc/room.go @@ -28,7 +28,9 @@ type Room struct { // time that the last participant left the room leftAt atomic.Value isClosed utils.AtomicFlag - onClose func() + + onParticipantChanged func(p types.Participant) + onClose func() } func NewRoom(room *livekit.Room, config WebRTCConfig) *Room { @@ -100,6 +102,9 @@ func (r *Room) Join(participant types.Participant) error { participant.OnStateChange(func(p types.Participant, oldState livekit.ParticipantInfo_State) { logger.Debugw("participant state changed", "state", p.State(), "participant", p.Identity(), "oldState", oldState) + if r.onParticipantChanged != nil { + r.onParticipantChanged(participant) + } r.broadcastParticipantState(p) if p.State() == livekit.ParticipantInfo_ACTIVE { @@ -140,28 +145,44 @@ func (r *Room) Join(participant types.Participant) error { } } + if r.onParticipantChanged != nil { + r.onParticipantChanged(participant) + } + return participant.SendJoinResponse(&r.Room, otherParticipants) } func (r *Room) RemoveParticipant(identity string) { r.lock.Lock() - defer r.lock.Unlock() p, ok := r.participants[identity] + if ok { + delete(r.participants, identity) + } + r.lock.Unlock() if !ok { return } - delete(r.participants, identity) + + // send broadcast only if it's not already closed + sendUpdates := p.State() != livekit.ParticipantInfo_DISCONNECTED p.OnTrackUpdated(nil) p.OnTrackPublished(nil) p.OnStateChange(nil) // close participant as well - go p.Close() + p.Close() if len(r.participants) == 0 { r.leftAt.Store(time.Now().Unix()) } + + if sendUpdates { + if r.onParticipantChanged != nil { + r.onParticipantChanged(p) + } + go r.broadcastParticipantState(p) + } } // Close the room if all participants had left, or it's still empty past timeout @@ -201,6 +222,10 @@ func (r *Room) OnClose(f func()) { r.onClose = f } +func (r *Room) OnParticipantChanged(f func(participant types.Participant)) { + r.onParticipantChanged = f +} + // a ParticipantImpl in the room added a new remoteTrack, subscribe other participants to it func (r *Room) onTrackAdded(participant types.Participant, track types.PublishedTrack) { // publish participant update, since track state is changed @@ -231,10 +256,17 @@ func (r *Room) onTrackAdded(participant types.Participant, track types.Published "dest", existingParticipant.Identity()) } } + + if r.onParticipantChanged != nil { + r.onParticipantChanged(participant) + } } func (r *Room) onTrackUpdated(p types.Participant, track types.PublishedTrack) { r.broadcastParticipantState(p) + if r.onParticipantChanged != nil { + r.onParticipantChanged(p) + } } // broadcast an update about participant p diff --git a/pkg/service/auth.go b/pkg/service/auth.go index 5845eb79..15c2ca81 100644 --- a/pkg/service/auth.go +++ b/pkg/service/auth.go @@ -103,6 +103,19 @@ func EnsureJoinPermission(ctx context.Context) (name string, err error) { return } +func EnsureAdminPermission(ctx context.Context, room string) error { + claims := GetGrants(ctx) + if claims == nil || claims.Video == nil { + return ErrPermissionDenied + } + + if !claims.Video.RoomAdmin || room != claims.Video.Room { + return ErrPermissionDenied + } + + return nil +} + func EnsureCreatePermission(ctx context.Context) error { claims := GetGrants(ctx) if claims == nil { diff --git a/pkg/service/errors.go b/pkg/service/errors.go index eb5fdecf..bfd5de8c 100644 --- a/pkg/service/errors.go +++ b/pkg/service/errors.go @@ -3,5 +3,7 @@ package service import "errors" var ( - ErrRoomNotFound = errors.New("requested room does not exist") + ErrRoomNotFound = errors.New("requested room does not exist") + ErrParticipantNotFound = errors.New("participant does not exist") + ErrTrackNotFound = errors.New("track is not found") ) diff --git a/pkg/service/localroomstore.go b/pkg/service/localroomstore.go index f0b786be..96193e74 100644 --- a/pkg/service/localroomstore.go +++ b/pkg/service/localroomstore.go @@ -15,14 +15,17 @@ type LocalRoomStore struct { rooms map[string]*livekit.Room // map of roomName => roomId roomIds map[string]string - lock sync.RWMutex + // map of roomName => { identity: participant } + participants map[string]map[string]*livekit.ParticipantInfo + lock sync.RWMutex } func NewLocalRoomStore() *LocalRoomStore { return &LocalRoomStore{ - rooms: make(map[string]*livekit.Room), - roomIds: make(map[string]string), - lock: sync.RWMutex{}, + rooms: make(map[string]*livekit.Room), + roomIds: make(map[string]string), + participants: make(map[string]map[string]*livekit.ParticipantInfo), + lock: sync.RWMutex{}, } } @@ -69,7 +72,62 @@ func (p *LocalRoomStore) DeleteRoom(idOrName string) error { p.lock.Lock() defer p.lock.Unlock() - delete(p.rooms, room.Sid) + delete(p.participants, room.Name) delete(p.roomIds, room.Name) + delete(p.rooms, room.Sid) + return nil +} + +func (p *LocalRoomStore) PersistParticipant(roomName string, participant *livekit.ParticipantInfo) error { + p.lock.Lock() + defer p.lock.Unlock() + roomParticipants := p.participants[roomName] + if roomParticipants == nil { + roomParticipants = make(map[string]*livekit.ParticipantInfo) + p.participants[roomName] = roomParticipants + } + roomParticipants[participant.Identity] = participant + return nil +} + +func (p *LocalRoomStore) GetParticipant(roomName, identity string) (*livekit.ParticipantInfo, error) { + p.lock.RLock() + defer p.lock.RUnlock() + + roomParticipants := p.participants[roomName] + if roomParticipants == nil { + return nil, ErrParticipantNotFound + } + participant := roomParticipants[identity] + if participant == nil { + return nil, ErrParticipantNotFound + } + return participant, nil +} + +func (p *LocalRoomStore) ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error) { + p.lock.RLock() + defer p.lock.RUnlock() + + roomParticipants := p.participants[roomName] + if roomParticipants == nil { + // empty array + return nil, nil + } + + items := funk.Values(roomParticipants).([]*livekit.ParticipantInfo) + // TODO: should short this to something reasonable + + return items, nil +} + +func (p *LocalRoomStore) DeleteParticipant(roomName, identity string) error { + p.lock.Lock() + defer p.lock.Unlock() + + roomParticipants := p.participants[roomName] + if roomParticipants != nil { + delete(roomParticipants, identity) + } return nil } diff --git a/pkg/service/redisroomstore.go b/pkg/service/redisroomstore.go index 1d2f4067..9406dc31 100644 --- a/pkg/service/redisroomstore.go +++ b/pkg/service/redisroomstore.go @@ -17,12 +17,12 @@ const ( // hash of room_id => room name RoomIdMap = "room_id_map" - // - //// hash of participant_name => participant_id - //// a key for each room, with expiration - //RoomParticipantMapPrefix = "participant_map:room:" - // - //participantMappingTTL = 24 * time.Hour + + // hash of participant_name => ParticipantInfo + // a key for each room, with expiration + RoomParticipantsPrefix = "room_participants:" + + participantMappingTTL = 24 * time.Hour ) type RedisRoomStore struct { @@ -102,16 +102,77 @@ func (p *RedisRoomStore) ListRooms() ([]*livekit.Room, error) { func (p *RedisRoomStore) DeleteRoom(idOrName string) error { room, err := p.GetRoom(idOrName) + var sid, name string + if err == ErrRoomNotFound { - return nil - } else if err != nil { + // try to clean up as best as we could + sid = idOrName + name = idOrName + } else if err == nil { + sid = room.Sid + name = room.Name + } else { return err } pp := p.rc.Pipeline() - pp.HDel(p.ctx, RoomIdMap, room.Sid) - pp.HDel(p.ctx, RoomsKey, room.Name) + pp.HDel(p.ctx, RoomIdMap, sid) + pp.HDel(p.ctx, RoomsKey, name) + pp.Del(p.ctx, RoomParticipantsPrefix+name) _, err = pp.Exec(p.ctx) return err } + +func (p *RedisRoomStore) PersistParticipant(roomName string, participant *livekit.ParticipantInfo) error { + key := RoomParticipantsPrefix + roomName + + data, err := proto.Marshal(participant) + if err != nil { + return err + } + + return p.rc.HSet(p.ctx, key, participant.Identity, data).Err() +} + +func (p *RedisRoomStore) GetParticipant(roomName, identity string) (*livekit.ParticipantInfo, error) { + key := RoomParticipantsPrefix + roomName + data, err := p.rc.HGet(p.ctx, key, identity).Result() + if err == redis.Nil { + return nil, ErrParticipantNotFound + } else if err != nil { + return nil, err + } + + pi := livekit.ParticipantInfo{} + if err := proto.Unmarshal([]byte(data), &pi); err != nil { + return nil, err + } + return &pi, nil +} + +func (p *RedisRoomStore) ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error) { + key := RoomParticipantsPrefix + roomName + items, err := p.rc.HVals(p.ctx, key).Result() + if err == redis.Nil { + return nil, nil + } else if err != nil { + return nil, err + } + + participants := make([]*livekit.ParticipantInfo, 0, len(items)) + for _, item := range items { + pi := livekit.ParticipantInfo{} + if err := proto.Unmarshal([]byte(item), &pi); err != nil { + return nil, err + } + participants = append(participants, &pi) + } + return participants, nil +} + +func (p *RedisRoomStore) DeleteParticipant(roomName, identity string) error { + key := RoomParticipantsPrefix + roomName + + return p.rc.HDel(p.ctx, key, identity).Err() +} diff --git a/pkg/service/redisroomstore_test.go b/pkg/service/redisroomstore_test.go new file mode 100644 index 00000000..0c9d85c5 --- /dev/null +++ b/pkg/service/redisroomstore_test.go @@ -0,0 +1,60 @@ +package service_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/livekit/livekit-server/pkg/service" + "github.com/livekit/livekit-server/proto/livekit" +) + +func TestParticipantPersisence(t *testing.T) { + if testing.Short() { + t.SkipNow() + return + } + rs := service.NewRedisRoomStore(redisClient()) + + roomName := "room1" + rs.DeleteRoom(roomName) + + p := &livekit.ParticipantInfo{ + Sid: "PA_test", + Identity: "test", + State: livekit.ParticipantInfo_ACTIVE, + Tracks: []*livekit.TrackInfo{ + { + Sid: "track1", + Type: livekit.TrackType_AUDIO, + Name: "audio", + }, + }, + } + + // create the participant + assert.NoError(t, rs.PersistParticipant(roomName, p)) + + // result should match + pGet, err := rs.GetParticipant(roomName, p.Identity) + assert.NoError(t, err) + assert.Equal(t, p.Identity, pGet.Identity) + assert.Equal(t, len(p.Tracks), len(pGet.Tracks)) + assert.Equal(t, p.Tracks[0].Sid, pGet.Tracks[0].Sid) + + // list should return one participant + participants, err := rs.ListParticipants(roomName) + assert.NoError(t, err) + assert.Len(t, participants, 1) + + // deleting participant should return back to normal + assert.NoError(t, rs.DeleteParticipant(roomName, p.Identity)) + + participants, err = rs.ListParticipants(roomName) + assert.NoError(t, err) + assert.Len(t, participants, 0) + + // shouldn't be able to get it + _, err = rs.GetParticipant(roomName, p.Identity) + assert.Equal(t, err, service.ErrParticipantNotFound) +} diff --git a/pkg/service/roommanager.go b/pkg/service/roommanager.go index 500ad078..9910eb4c 100644 --- a/pkg/service/roommanager.go +++ b/pkg/service/roommanager.go @@ -218,6 +218,13 @@ func (r *RoomManager) getOrCreateRoom(roomName string) (*rtc.Room, error) { logger.Errorw("could not delete room", "error", err) } }) + room.OnParticipantChanged(func(p types.Participant) { + if p.State() == livekit.ParticipantInfo_DISCONNECTED { + r.roomStore.DeleteParticipant(roomName, p.Identity()) + } else { + r.roomStore.PersistParticipant(roomName, p.ToProto()) + } + }) r.lock.Lock() r.rooms[roomName] = room r.lock.Unlock() @@ -296,3 +303,29 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.Partici } } } + +func (r *RoomManager) handleRTCMessage(roomName, identity string, msg *livekit.RTCNodeMessage) { + r.lock.RLock() + room := r.rooms[roomName] + r.lock.RUnlock() + + if room == nil { + logger.Warnw("Could not find room", "room", roomName) + return + } + + participant := room.GetParticipant(identity) + if participant == nil { + return + } + + switch rm := msg.Message.(type) { + case *livekit.RTCNodeMessage_RemoveParticipant: + logger.Infow("removing participant", "room", roomName, "participant", identity) + room.RemoveParticipant(identity) + case *livekit.RTCNodeMessage_MuteTrack: + logger.Debugw("setting track muted", "room", roomName, "participant", identity, + "track", rm.MuteTrack.TrackSid, "muted", rm.MuteTrack.Muted) + participant.SetTrackMuted(rm.MuteTrack.TrackSid, rm.MuteTrack.Muted) + } +} diff --git a/pkg/service/roomservice.go b/pkg/service/roomservice.go index 4e72442d..2e5aeb63 100644 --- a/pkg/service/roomservice.go +++ b/pkg/service/roomservice.go @@ -4,6 +4,7 @@ import ( "context" "github.com/pkg/errors" + "github.com/thoas/go-funk" "github.com/twitchtv/twirp" "github.com/livekit/livekit-server/proto/livekit" @@ -64,3 +65,86 @@ func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomReq res = &livekit.DeleteRoomResponse{} return } + +func (s *RoomService) ListParticipants(ctx context.Context, req *livekit.ListParticipantsRequest) (res *livekit.ListParticipantsResponse, err error) { + if err = EnsureAdminPermission(ctx, req.Room); err != nil { + return nil, twirpAuthError(err) + } + + participants, err := s.roomManager.roomStore.ListParticipants(req.Room) + if err != nil { + return + } + + res = &livekit.ListParticipantsResponse{ + Participants: participants, + } + return +} + +func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.ParticipantInfo, err error) { + if err = EnsureAdminPermission(ctx, req.Room); err != nil { + return nil, twirpAuthError(err) + } + + participant, err := s.roomManager.roomStore.GetParticipant(req.Room, req.Identity) + if err != nil { + return + } + + res = participant + return +} + +func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.RemoveParticipantResponse, err error) { + if err = EnsureAdminPermission(ctx, req.Room); err != nil { + return nil, twirpAuthError(err) + } + + participant, err := s.roomManager.roomStore.GetParticipant(req.Room, req.Identity) + if err != nil { + return + } + + err = s.roomManager.router.SendRTCMessage(req.Room, participant.Identity, &livekit.RTCNodeMessage{ + Message: &livekit.RTCNodeMessage_RemoveParticipant{ + RemoveParticipant: req, + }, + }) + + res = &livekit.RemoveParticipantResponse{} + return +} + +func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (res *livekit.MuteRoomTrackResponse, err error) { + if err = EnsureAdminPermission(ctx, req.Room); err != nil { + return nil, twirpAuthError(err) + } + + participant, err := s.roomManager.roomStore.GetParticipant(req.Room, req.Identity) + if err != nil { + return + } + + err = s.roomManager.router.SendRTCMessage(req.Room, participant.Identity, &livekit.RTCNodeMessage{ + Message: &livekit.RTCNodeMessage_MuteTrack{ + MuteTrack: req, + }, + }) + + if err != nil { + return + } + + // find the track + track := funk.Find(participant.Tracks, func(t *livekit.TrackInfo) bool { + return t.Sid == req.TrackSid + }) + if track == nil { + return nil, twirp.NotFoundError(ErrTrackNotFound.Error()) + } + res = &livekit.MuteRoomTrackResponse{ + Track: track.(*livekit.TrackInfo), + } + return +} diff --git a/pkg/service/roomstore.go b/pkg/service/roomstore.go index b21d0bb7..32525850 100644 --- a/pkg/service/roomstore.go +++ b/pkg/service/roomstore.go @@ -14,4 +14,9 @@ type RoomStore interface { GetRoom(idOrName string) (*livekit.Room, error) ListRooms() ([]*livekit.Room, error) DeleteRoom(idOrName string) error + + PersistParticipant(roomName string, participant *livekit.ParticipantInfo) error + GetParticipant(roomName, identity string) (*livekit.ParticipantInfo, error) + ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error) + DeleteParticipant(roomName, identity string) error } diff --git a/pkg/service/server.go b/pkg/service/server.go index 5e2fc1c5..233ed885 100644 --- a/pkg/service/server.go +++ b/pkg/service/server.go @@ -67,6 +67,7 @@ func NewLivekitServer(conf *config.Config, // hook up router to the RoomManager router.OnNewParticipantRTC(roomManager.StartSession) + router.OnRTCMessage(roomManager.handleRTCMessage) // clean up old rooms on startup if err = roomManager.CleanupRooms(); err != nil { diff --git a/pkg/service/servicefakes/fake_room_store.go b/pkg/service/servicefakes/fake_room_store.go index 8cd943b1..207df875 100644 --- a/pkg/service/servicefakes/fake_room_store.go +++ b/pkg/service/servicefakes/fake_room_store.go @@ -20,6 +20,18 @@ type FakeRoomStore struct { createRoomReturnsOnCall map[int]struct { result1 error } + DeleteParticipantStub func(string, string) error + deleteParticipantMutex sync.RWMutex + deleteParticipantArgsForCall []struct { + arg1 string + arg2 string + } + deleteParticipantReturns struct { + result1 error + } + deleteParticipantReturnsOnCall map[int]struct { + result1 error + } DeleteRoomStub func(string) error deleteRoomMutex sync.RWMutex deleteRoomArgsForCall []struct { @@ -31,6 +43,20 @@ type FakeRoomStore struct { deleteRoomReturnsOnCall map[int]struct { result1 error } + GetParticipantStub func(string, string) (*livekit.ParticipantInfo, error) + getParticipantMutex sync.RWMutex + getParticipantArgsForCall []struct { + arg1 string + arg2 string + } + getParticipantReturns struct { + result1 *livekit.ParticipantInfo + result2 error + } + getParticipantReturnsOnCall map[int]struct { + result1 *livekit.ParticipantInfo + result2 error + } GetRoomStub func(string) (*livekit.Room, error) getRoomMutex sync.RWMutex getRoomArgsForCall []struct { @@ -44,6 +70,19 @@ type FakeRoomStore struct { result1 *livekit.Room result2 error } + ListParticipantsStub func(string) ([]*livekit.ParticipantInfo, error) + listParticipantsMutex sync.RWMutex + listParticipantsArgsForCall []struct { + arg1 string + } + listParticipantsReturns struct { + result1 []*livekit.ParticipantInfo + result2 error + } + listParticipantsReturnsOnCall map[int]struct { + result1 []*livekit.ParticipantInfo + result2 error + } ListRoomsStub func() ([]*livekit.Room, error) listRoomsMutex sync.RWMutex listRoomsArgsForCall []struct { @@ -56,6 +95,18 @@ type FakeRoomStore struct { result1 []*livekit.Room result2 error } + PersistParticipantStub func(string, *livekit.ParticipantInfo) error + persistParticipantMutex sync.RWMutex + persistParticipantArgsForCall []struct { + arg1 string + arg2 *livekit.ParticipantInfo + } + persistParticipantReturns struct { + result1 error + } + persistParticipantReturnsOnCall map[int]struct { + result1 error + } invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -121,6 +172,68 @@ func (fake *FakeRoomStore) CreateRoomReturnsOnCall(i int, result1 error) { }{result1} } +func (fake *FakeRoomStore) DeleteParticipant(arg1 string, arg2 string) error { + fake.deleteParticipantMutex.Lock() + ret, specificReturn := fake.deleteParticipantReturnsOnCall[len(fake.deleteParticipantArgsForCall)] + fake.deleteParticipantArgsForCall = append(fake.deleteParticipantArgsForCall, struct { + arg1 string + arg2 string + }{arg1, arg2}) + stub := fake.DeleteParticipantStub + fakeReturns := fake.deleteParticipantReturns + fake.recordInvocation("DeleteParticipant", []interface{}{arg1, arg2}) + fake.deleteParticipantMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeRoomStore) DeleteParticipantCallCount() int { + fake.deleteParticipantMutex.RLock() + defer fake.deleteParticipantMutex.RUnlock() + return len(fake.deleteParticipantArgsForCall) +} + +func (fake *FakeRoomStore) DeleteParticipantCalls(stub func(string, string) error) { + fake.deleteParticipantMutex.Lock() + defer fake.deleteParticipantMutex.Unlock() + fake.DeleteParticipantStub = stub +} + +func (fake *FakeRoomStore) DeleteParticipantArgsForCall(i int) (string, string) { + fake.deleteParticipantMutex.RLock() + defer fake.deleteParticipantMutex.RUnlock() + argsForCall := fake.deleteParticipantArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeRoomStore) DeleteParticipantReturns(result1 error) { + fake.deleteParticipantMutex.Lock() + defer fake.deleteParticipantMutex.Unlock() + fake.DeleteParticipantStub = nil + fake.deleteParticipantReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeRoomStore) DeleteParticipantReturnsOnCall(i int, result1 error) { + fake.deleteParticipantMutex.Lock() + defer fake.deleteParticipantMutex.Unlock() + fake.DeleteParticipantStub = nil + if fake.deleteParticipantReturnsOnCall == nil { + fake.deleteParticipantReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.deleteParticipantReturnsOnCall[i] = struct { + result1 error + }{result1} +} + func (fake *FakeRoomStore) DeleteRoom(arg1 string) error { fake.deleteRoomMutex.Lock() ret, specificReturn := fake.deleteRoomReturnsOnCall[len(fake.deleteRoomArgsForCall)] @@ -182,6 +295,71 @@ func (fake *FakeRoomStore) DeleteRoomReturnsOnCall(i int, result1 error) { }{result1} } +func (fake *FakeRoomStore) GetParticipant(arg1 string, arg2 string) (*livekit.ParticipantInfo, error) { + fake.getParticipantMutex.Lock() + ret, specificReturn := fake.getParticipantReturnsOnCall[len(fake.getParticipantArgsForCall)] + fake.getParticipantArgsForCall = append(fake.getParticipantArgsForCall, struct { + arg1 string + arg2 string + }{arg1, arg2}) + stub := fake.GetParticipantStub + fakeReturns := fake.getParticipantReturns + fake.recordInvocation("GetParticipant", []interface{}{arg1, arg2}) + fake.getParticipantMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeRoomStore) GetParticipantCallCount() int { + fake.getParticipantMutex.RLock() + defer fake.getParticipantMutex.RUnlock() + return len(fake.getParticipantArgsForCall) +} + +func (fake *FakeRoomStore) GetParticipantCalls(stub func(string, string) (*livekit.ParticipantInfo, error)) { + fake.getParticipantMutex.Lock() + defer fake.getParticipantMutex.Unlock() + fake.GetParticipantStub = stub +} + +func (fake *FakeRoomStore) GetParticipantArgsForCall(i int) (string, string) { + fake.getParticipantMutex.RLock() + defer fake.getParticipantMutex.RUnlock() + argsForCall := fake.getParticipantArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeRoomStore) GetParticipantReturns(result1 *livekit.ParticipantInfo, result2 error) { + fake.getParticipantMutex.Lock() + defer fake.getParticipantMutex.Unlock() + fake.GetParticipantStub = nil + fake.getParticipantReturns = struct { + result1 *livekit.ParticipantInfo + result2 error + }{result1, result2} +} + +func (fake *FakeRoomStore) GetParticipantReturnsOnCall(i int, result1 *livekit.ParticipantInfo, result2 error) { + fake.getParticipantMutex.Lock() + defer fake.getParticipantMutex.Unlock() + fake.GetParticipantStub = nil + if fake.getParticipantReturnsOnCall == nil { + fake.getParticipantReturnsOnCall = make(map[int]struct { + result1 *livekit.ParticipantInfo + result2 error + }) + } + fake.getParticipantReturnsOnCall[i] = struct { + result1 *livekit.ParticipantInfo + result2 error + }{result1, result2} +} + func (fake *FakeRoomStore) GetRoom(arg1 string) (*livekit.Room, error) { fake.getRoomMutex.Lock() ret, specificReturn := fake.getRoomReturnsOnCall[len(fake.getRoomArgsForCall)] @@ -246,6 +424,70 @@ func (fake *FakeRoomStore) GetRoomReturnsOnCall(i int, result1 *livekit.Room, re }{result1, result2} } +func (fake *FakeRoomStore) ListParticipants(arg1 string) ([]*livekit.ParticipantInfo, error) { + fake.listParticipantsMutex.Lock() + ret, specificReturn := fake.listParticipantsReturnsOnCall[len(fake.listParticipantsArgsForCall)] + fake.listParticipantsArgsForCall = append(fake.listParticipantsArgsForCall, struct { + arg1 string + }{arg1}) + stub := fake.ListParticipantsStub + fakeReturns := fake.listParticipantsReturns + fake.recordInvocation("ListParticipants", []interface{}{arg1}) + fake.listParticipantsMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeRoomStore) ListParticipantsCallCount() int { + fake.listParticipantsMutex.RLock() + defer fake.listParticipantsMutex.RUnlock() + return len(fake.listParticipantsArgsForCall) +} + +func (fake *FakeRoomStore) ListParticipantsCalls(stub func(string) ([]*livekit.ParticipantInfo, error)) { + fake.listParticipantsMutex.Lock() + defer fake.listParticipantsMutex.Unlock() + fake.ListParticipantsStub = stub +} + +func (fake *FakeRoomStore) ListParticipantsArgsForCall(i int) string { + fake.listParticipantsMutex.RLock() + defer fake.listParticipantsMutex.RUnlock() + argsForCall := fake.listParticipantsArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeRoomStore) ListParticipantsReturns(result1 []*livekit.ParticipantInfo, result2 error) { + fake.listParticipantsMutex.Lock() + defer fake.listParticipantsMutex.Unlock() + fake.ListParticipantsStub = nil + fake.listParticipantsReturns = struct { + result1 []*livekit.ParticipantInfo + result2 error + }{result1, result2} +} + +func (fake *FakeRoomStore) ListParticipantsReturnsOnCall(i int, result1 []*livekit.ParticipantInfo, result2 error) { + fake.listParticipantsMutex.Lock() + defer fake.listParticipantsMutex.Unlock() + fake.ListParticipantsStub = nil + if fake.listParticipantsReturnsOnCall == nil { + fake.listParticipantsReturnsOnCall = make(map[int]struct { + result1 []*livekit.ParticipantInfo + result2 error + }) + } + fake.listParticipantsReturnsOnCall[i] = struct { + result1 []*livekit.ParticipantInfo + result2 error + }{result1, result2} +} + func (fake *FakeRoomStore) ListRooms() ([]*livekit.Room, error) { fake.listRoomsMutex.Lock() ret, specificReturn := fake.listRoomsReturnsOnCall[len(fake.listRoomsArgsForCall)] @@ -302,17 +544,87 @@ func (fake *FakeRoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Room }{result1, result2} } +func (fake *FakeRoomStore) PersistParticipant(arg1 string, arg2 *livekit.ParticipantInfo) error { + fake.persistParticipantMutex.Lock() + ret, specificReturn := fake.persistParticipantReturnsOnCall[len(fake.persistParticipantArgsForCall)] + fake.persistParticipantArgsForCall = append(fake.persistParticipantArgsForCall, struct { + arg1 string + arg2 *livekit.ParticipantInfo + }{arg1, arg2}) + stub := fake.PersistParticipantStub + fakeReturns := fake.persistParticipantReturns + fake.recordInvocation("PersistParticipant", []interface{}{arg1, arg2}) + fake.persistParticipantMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeRoomStore) PersistParticipantCallCount() int { + fake.persistParticipantMutex.RLock() + defer fake.persistParticipantMutex.RUnlock() + return len(fake.persistParticipantArgsForCall) +} + +func (fake *FakeRoomStore) PersistParticipantCalls(stub func(string, *livekit.ParticipantInfo) error) { + fake.persistParticipantMutex.Lock() + defer fake.persistParticipantMutex.Unlock() + fake.PersistParticipantStub = stub +} + +func (fake *FakeRoomStore) PersistParticipantArgsForCall(i int) (string, *livekit.ParticipantInfo) { + fake.persistParticipantMutex.RLock() + defer fake.persistParticipantMutex.RUnlock() + argsForCall := fake.persistParticipantArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeRoomStore) PersistParticipantReturns(result1 error) { + fake.persistParticipantMutex.Lock() + defer fake.persistParticipantMutex.Unlock() + fake.PersistParticipantStub = nil + fake.persistParticipantReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeRoomStore) PersistParticipantReturnsOnCall(i int, result1 error) { + fake.persistParticipantMutex.Lock() + defer fake.persistParticipantMutex.Unlock() + fake.PersistParticipantStub = nil + if fake.persistParticipantReturnsOnCall == nil { + fake.persistParticipantReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.persistParticipantReturnsOnCall[i] = struct { + result1 error + }{result1} +} + func (fake *FakeRoomStore) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.createRoomMutex.RLock() defer fake.createRoomMutex.RUnlock() + fake.deleteParticipantMutex.RLock() + defer fake.deleteParticipantMutex.RUnlock() fake.deleteRoomMutex.RLock() defer fake.deleteRoomMutex.RUnlock() + fake.getParticipantMutex.RLock() + defer fake.getParticipantMutex.RUnlock() fake.getRoomMutex.RLock() defer fake.getRoomMutex.RUnlock() + fake.listParticipantsMutex.RLock() + defer fake.listParticipantsMutex.RUnlock() fake.listRoomsMutex.RLock() defer fake.listRoomsMutex.RUnlock() + fake.persistParticipantMutex.RLock() + defer fake.persistParticipantMutex.RUnlock() copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value diff --git a/pkg/service/utils_test.go b/pkg/service/utils_test.go new file mode 100644 index 00000000..08ac2f33 --- /dev/null +++ b/pkg/service/utils_test.go @@ -0,0 +1,11 @@ +package service_test + +import ( + "github.com/go-redis/redis/v8" +) + +func redisClient() *redis.Client { + return redis.NewClient(&redis.Options{ + Addr: "localhost:6379", + }) +} diff --git a/proto/internal.proto b/proto/internal.proto index c9ec4a7a..2c6385d7 100644 --- a/proto/internal.proto +++ b/proto/internal.proto @@ -5,6 +5,7 @@ option go_package = "github.com/livekit/livekit-server/proto/livekit"; // internal protos, not exposed to clients import "rtc.proto"; +import "room.proto"; message Node { string id = 1; @@ -30,6 +31,9 @@ message RTCNodeMessage { oneof message { StartSession start_session = 2; SignalRequest request = 3; + // internal messages + RoomParticipantIdentity remove_participant = 4; + MuteRoomTrackRequest mute_track = 5; } } @@ -51,4 +55,8 @@ message StartSession { } message EndSession { +} + +message RemoveParticipant { + string participant_id = 1; } \ No newline at end of file diff --git a/proto/livekit/internal.pb.go b/proto/livekit/internal.pb.go index a80a23d0..61c95636 100644 --- a/proto/livekit/internal.pb.go +++ b/proto/livekit/internal.pb.go @@ -195,6 +195,8 @@ type RTCNodeMessage struct { // Types that are assignable to Message: // *RTCNodeMessage_StartSession // *RTCNodeMessage_Request + // *RTCNodeMessage_RemoveParticipant + // *RTCNodeMessage_MuteTrack Message isRTCNodeMessage_Message `protobuf_oneof:"message"` } @@ -258,6 +260,20 @@ func (x *RTCNodeMessage) GetRequest() *SignalRequest { return nil } +func (x *RTCNodeMessage) GetRemoveParticipant() *RoomParticipantIdentity { + if x, ok := x.GetMessage().(*RTCNodeMessage_RemoveParticipant); ok { + return x.RemoveParticipant + } + return nil +} + +func (x *RTCNodeMessage) GetMuteTrack() *MuteRoomTrackRequest { + if x, ok := x.GetMessage().(*RTCNodeMessage_MuteTrack); ok { + return x.MuteTrack + } + return nil +} + type isRTCNodeMessage_Message interface { isRTCNodeMessage_Message() } @@ -270,10 +286,23 @@ type RTCNodeMessage_Request struct { Request *SignalRequest `protobuf:"bytes,3,opt,name=request,proto3,oneof"` } +type RTCNodeMessage_RemoveParticipant struct { + // internal messages + RemoveParticipant *RoomParticipantIdentity `protobuf:"bytes,4,opt,name=remove_participant,json=removeParticipant,proto3,oneof"` +} + +type RTCNodeMessage_MuteTrack struct { + MuteTrack *MuteRoomTrackRequest `protobuf:"bytes,5,opt,name=mute_track,json=muteTrack,proto3,oneof"` +} + func (*RTCNodeMessage_StartSession) isRTCNodeMessage_Message() {} func (*RTCNodeMessage_Request) isRTCNodeMessage_Message() {} +func (*RTCNodeMessage_RemoveParticipant) isRTCNodeMessage_Message() {} + +func (*RTCNodeMessage_MuteTrack) isRTCNodeMessage_Message() {} + // message to Signal nodes type SignalNodeMessage struct { state protoimpl.MessageState @@ -473,68 +502,129 @@ func (*EndSession) Descriptor() ([]byte, []int) { return file_internal_proto_rawDescGZIP(), []int{5} } +type RemoveParticipant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ParticipantId string `protobuf:"bytes,1,opt,name=participant_id,json=participantId,proto3" json:"participant_id,omitempty"` +} + +func (x *RemoveParticipant) Reset() { + *x = RemoveParticipant{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveParticipant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveParticipant) ProtoMessage() {} + +func (x *RemoveParticipant) ProtoReflect() protoreflect.Message { + mi := &file_internal_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveParticipant.ProtoReflect.Descriptor instead. +func (*RemoveParticipant) Descriptor() ([]byte, []int) { + return file_internal_proto_rawDescGZIP(), []int{6} +} + +func (x *RemoveParticipant) GetParticipantId() string { + if x != nil { + return x.ParticipantId + } + return "" +} + var File_internal_proto protoreflect.FileDescriptor var file_internal_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x1a, 0x09, 0x72, 0x74, 0x63, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6b, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x19, 0x0a, 0x08, - 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, - 0x6e, 0x75, 0x6d, 0x43, 0x70, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x09, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, - 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, - 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1b, 0x0a, - 0x09, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x6f, 0x6f, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x75, - 0x6d, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x0a, 0x6e, 0x75, 0x6d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x22, 0x0a, 0x0d, 0x6e, - 0x75, 0x6d, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x49, 0x6e, 0x12, - 0x24, 0x0a, 0x0e, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x5f, 0x6f, 0x75, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6e, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x63, - 0x6b, 0x73, 0x4f, 0x75, 0x74, 0x22, 0xb6, 0x01, 0x0a, 0x0e, 0x52, 0x54, 0x43, 0x4e, 0x6f, 0x64, - 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x61, 0x72, 0x74, - 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0e, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4b, 0x65, - 0x79, 0x12, 0x3c, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, - 0x69, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, - 0x00, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x32, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xb2, - 0x01, 0x0a, 0x11, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x69, - 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x36, 0x0a, 0x0b, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, - 0x45, 0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x6e, - 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, - 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x22, 0x0c, 0x0a, 0x0a, 0x45, 0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x31, - 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, - 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, - 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x72, 0x6f, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x6b, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x5f, + 0x63, 0x70, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x43, + 0x70, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x22, 0xd1, 0x01, + 0x0a, 0x09, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x75, 0x6d, + 0x5f, 0x72, 0x6f, 0x6f, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6e, 0x75, + 0x6d, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6e, 0x75, 0x6d, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x75, 0x6d, 0x5f, 0x74, + 0x72, 0x61, 0x63, 0x6b, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, + 0x6e, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x49, 0x6e, 0x12, 0x24, 0x0a, 0x0e, 0x6e, + 0x75, 0x6d, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6e, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x4f, 0x75, + 0x74, 0x22, 0xc9, 0x02, 0x0a, 0x0e, 0x52, 0x54, 0x43, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x3c, 0x0a, + 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0c, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x07, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x51, 0x0a, 0x12, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, + 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x0a, 0x6d, 0x75, 0x74, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, + 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x6d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, + 0x63, 0x6b, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xb2, 0x01, + 0x0a, 0x11, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x76, + 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x36, 0x0a, 0x0b, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x45, + 0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x6e, 0x64, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, + 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x22, + 0x0c, 0x0a, 0x0a, 0x45, 0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, + 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, + 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -549,28 +639,33 @@ func file_internal_proto_rawDescGZIP() []byte { return file_internal_proto_rawDescData } -var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_internal_proto_goTypes = []interface{}{ - (*Node)(nil), // 0: livekit.Node - (*NodeStats)(nil), // 1: livekit.NodeStats - (*RTCNodeMessage)(nil), // 2: livekit.RTCNodeMessage - (*SignalNodeMessage)(nil), // 3: livekit.SignalNodeMessage - (*StartSession)(nil), // 4: livekit.StartSession - (*EndSession)(nil), // 5: livekit.EndSession - (*SignalRequest)(nil), // 6: livekit.SignalRequest - (*SignalResponse)(nil), // 7: livekit.SignalResponse + (*Node)(nil), // 0: livekit.Node + (*NodeStats)(nil), // 1: livekit.NodeStats + (*RTCNodeMessage)(nil), // 2: livekit.RTCNodeMessage + (*SignalNodeMessage)(nil), // 3: livekit.SignalNodeMessage + (*StartSession)(nil), // 4: livekit.StartSession + (*EndSession)(nil), // 5: livekit.EndSession + (*RemoveParticipant)(nil), // 6: livekit.RemoveParticipant + (*SignalRequest)(nil), // 7: livekit.SignalRequest + (*RoomParticipantIdentity)(nil), // 8: livekit.RoomParticipantIdentity + (*MuteRoomTrackRequest)(nil), // 9: livekit.MuteRoomTrackRequest + (*SignalResponse)(nil), // 10: livekit.SignalResponse } var file_internal_proto_depIdxs = []int32{ - 1, // 0: livekit.Node.stats:type_name -> livekit.NodeStats - 4, // 1: livekit.RTCNodeMessage.start_session:type_name -> livekit.StartSession - 6, // 2: livekit.RTCNodeMessage.request:type_name -> livekit.SignalRequest - 7, // 3: livekit.SignalNodeMessage.response:type_name -> livekit.SignalResponse - 5, // 4: livekit.SignalNodeMessage.end_session:type_name -> livekit.EndSession - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 1, // 0: livekit.Node.stats:type_name -> livekit.NodeStats + 4, // 1: livekit.RTCNodeMessage.start_session:type_name -> livekit.StartSession + 7, // 2: livekit.RTCNodeMessage.request:type_name -> livekit.SignalRequest + 8, // 3: livekit.RTCNodeMessage.remove_participant:type_name -> livekit.RoomParticipantIdentity + 9, // 4: livekit.RTCNodeMessage.mute_track:type_name -> livekit.MuteRoomTrackRequest + 10, // 5: livekit.SignalNodeMessage.response:type_name -> livekit.SignalResponse + 5, // 6: livekit.SignalNodeMessage.end_session:type_name -> livekit.EndSession + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_internal_proto_init() } @@ -579,6 +674,7 @@ func file_internal_proto_init() { return } file_rtc_proto_init() + file_room_proto_init() if !protoimpl.UnsafeEnabled { file_internal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Node); i { @@ -652,10 +748,24 @@ func file_internal_proto_init() { return nil } } + file_internal_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveParticipant); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_internal_proto_msgTypes[2].OneofWrappers = []interface{}{ (*RTCNodeMessage_StartSession)(nil), (*RTCNodeMessage_Request)(nil), + (*RTCNodeMessage_RemoveParticipant)(nil), + (*RTCNodeMessage_MuteTrack)(nil), } file_internal_proto_msgTypes[3].OneofWrappers = []interface{}{ (*SignalNodeMessage_Response)(nil), @@ -667,7 +777,7 @@ func file_internal_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_internal_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/livekit/room.pb.go b/proto/livekit/room.pb.go index 1bf695f8..89867400 100644 --- a/proto/livekit/room.pb.go +++ b/proto/livekit/room.pb.go @@ -268,6 +268,311 @@ func (*DeleteRoomResponse) Descriptor() ([]byte, []int) { return file_room_proto_rawDescGZIP(), []int{4} } +type ListParticipantsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` +} + +func (x *ListParticipantsRequest) Reset() { + *x = ListParticipantsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_room_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListParticipantsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListParticipantsRequest) ProtoMessage() {} + +func (x *ListParticipantsRequest) ProtoReflect() protoreflect.Message { + mi := &file_room_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListParticipantsRequest.ProtoReflect.Descriptor instead. +func (*ListParticipantsRequest) Descriptor() ([]byte, []int) { + return file_room_proto_rawDescGZIP(), []int{5} +} + +func (x *ListParticipantsRequest) GetRoom() string { + if x != nil { + return x.Room + } + return "" +} + +type ListParticipantsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Participants []*ParticipantInfo `protobuf:"bytes,1,rep,name=participants,proto3" json:"participants,omitempty"` +} + +func (x *ListParticipantsResponse) Reset() { + *x = ListParticipantsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_room_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListParticipantsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListParticipantsResponse) ProtoMessage() {} + +func (x *ListParticipantsResponse) ProtoReflect() protoreflect.Message { + mi := &file_room_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListParticipantsResponse.ProtoReflect.Descriptor instead. +func (*ListParticipantsResponse) Descriptor() ([]byte, []int) { + return file_room_proto_rawDescGZIP(), []int{6} +} + +func (x *ListParticipantsResponse) GetParticipants() []*ParticipantInfo { + if x != nil { + return x.Participants + } + return nil +} + +type RoomParticipantIdentity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` +} + +func (x *RoomParticipantIdentity) Reset() { + *x = RoomParticipantIdentity{} + if protoimpl.UnsafeEnabled { + mi := &file_room_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RoomParticipantIdentity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoomParticipantIdentity) ProtoMessage() {} + +func (x *RoomParticipantIdentity) ProtoReflect() protoreflect.Message { + mi := &file_room_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RoomParticipantIdentity.ProtoReflect.Descriptor instead. +func (*RoomParticipantIdentity) Descriptor() ([]byte, []int) { + return file_room_proto_rawDescGZIP(), []int{7} +} + +func (x *RoomParticipantIdentity) GetRoom() string { + if x != nil { + return x.Room + } + return "" +} + +func (x *RoomParticipantIdentity) GetIdentity() string { + if x != nil { + return x.Identity + } + return "" +} + +type RemoveParticipantResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveParticipantResponse) Reset() { + *x = RemoveParticipantResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_room_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveParticipantResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveParticipantResponse) ProtoMessage() {} + +func (x *RemoveParticipantResponse) ProtoReflect() protoreflect.Message { + mi := &file_room_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveParticipantResponse.ProtoReflect.Descriptor instead. +func (*RemoveParticipantResponse) Descriptor() ([]byte, []int) { + return file_room_proto_rawDescGZIP(), []int{8} +} + +type MuteRoomTrackRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + TrackSid string `protobuf:"bytes,3,opt,name=track_sid,json=trackSid,proto3" json:"track_sid,omitempty"` + Muted bool `protobuf:"varint,4,opt,name=muted,proto3" json:"muted,omitempty"` +} + +func (x *MuteRoomTrackRequest) Reset() { + *x = MuteRoomTrackRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_room_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MuteRoomTrackRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MuteRoomTrackRequest) ProtoMessage() {} + +func (x *MuteRoomTrackRequest) ProtoReflect() protoreflect.Message { + mi := &file_room_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MuteRoomTrackRequest.ProtoReflect.Descriptor instead. +func (*MuteRoomTrackRequest) Descriptor() ([]byte, []int) { + return file_room_proto_rawDescGZIP(), []int{9} +} + +func (x *MuteRoomTrackRequest) GetRoom() string { + if x != nil { + return x.Room + } + return "" +} + +func (x *MuteRoomTrackRequest) GetIdentity() string { + if x != nil { + return x.Identity + } + return "" +} + +func (x *MuteRoomTrackRequest) GetTrackSid() string { + if x != nil { + return x.TrackSid + } + return "" +} + +func (x *MuteRoomTrackRequest) GetMuted() bool { + if x != nil { + return x.Muted + } + return false +} + +type MuteRoomTrackResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Track *TrackInfo `protobuf:"bytes,1,opt,name=track,proto3" json:"track,omitempty"` +} + +func (x *MuteRoomTrackResponse) Reset() { + *x = MuteRoomTrackResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_room_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MuteRoomTrackResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MuteRoomTrackResponse) ProtoMessage() {} + +func (x *MuteRoomTrackResponse) ProtoReflect() protoreflect.Message { + mi := &file_room_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MuteRoomTrackResponse.ProtoReflect.Descriptor instead. +func (*MuteRoomTrackResponse) Descriptor() ([]byte, []int) { + return file_room_proto_rawDescGZIP(), []int{10} +} + +func (x *MuteRoomTrackResponse) GetTrack() *TrackInfo { + if x != nil { + return x.Track + } + return nil +} + var File_room_proto protoreflect.FileDescriptor var file_room_proto_rawDesc = []byte{ @@ -291,24 +596,72 @@ var file_room_proto_rawDesc = []byte{ 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x32, 0xd1, 0x01, 0x0a, 0x0b, 0x52, 0x6f, 0x6f, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, - 0x12, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x6c, - 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x42, 0x0a, 0x09, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x12, 0x19, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, - 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x45, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x1a, 0x2e, - 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, - 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, - 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, - 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x73, 0x65, 0x22, 0x2d, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, + 0x6d, 0x22, 0x58, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, + 0x70, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, + 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, + 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x70, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x49, 0x0a, 0x17, 0x52, + 0x6f, 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0x1b, 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x79, 0x0a, 0x14, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x54, + 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, + 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, + 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x74, + 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x73, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x74, 0x72, 0x61, 0x63, 0x6b, 0x53, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x22, 0x41, + 0x0a, 0x15, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, + 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, + 0x6b, 0x32, 0xa8, 0x04, 0x0a, 0x0b, 0x52, 0x6f, 0x6f, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, + 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x42, 0x0a, 0x09, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x12, 0x19, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, + 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, + 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x1a, 0x2e, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, + 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, + 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, + 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, + 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, + 0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x1a, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x59, 0x0a, 0x11, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x1a, 0x22, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x4d, 0x75, 0x74, 0x65, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x1d, 0x2e, + 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, + 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x54, + 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x31, 0x5a, 0x2f, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, + 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -323,28 +676,46 @@ func file_room_proto_rawDescGZIP() []byte { return file_room_proto_rawDescData } -var file_room_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_room_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_room_proto_goTypes = []interface{}{ - (*CreateRoomRequest)(nil), // 0: livekit.CreateRoomRequest - (*ListRoomsRequest)(nil), // 1: livekit.ListRoomsRequest - (*ListRoomsResponse)(nil), // 2: livekit.ListRoomsResponse - (*DeleteRoomRequest)(nil), // 3: livekit.DeleteRoomRequest - (*DeleteRoomResponse)(nil), // 4: livekit.DeleteRoomResponse - (*Room)(nil), // 5: livekit.Room + (*CreateRoomRequest)(nil), // 0: livekit.CreateRoomRequest + (*ListRoomsRequest)(nil), // 1: livekit.ListRoomsRequest + (*ListRoomsResponse)(nil), // 2: livekit.ListRoomsResponse + (*DeleteRoomRequest)(nil), // 3: livekit.DeleteRoomRequest + (*DeleteRoomResponse)(nil), // 4: livekit.DeleteRoomResponse + (*ListParticipantsRequest)(nil), // 5: livekit.ListParticipantsRequest + (*ListParticipantsResponse)(nil), // 6: livekit.ListParticipantsResponse + (*RoomParticipantIdentity)(nil), // 7: livekit.RoomParticipantIdentity + (*RemoveParticipantResponse)(nil), // 8: livekit.RemoveParticipantResponse + (*MuteRoomTrackRequest)(nil), // 9: livekit.MuteRoomTrackRequest + (*MuteRoomTrackResponse)(nil), // 10: livekit.MuteRoomTrackResponse + (*Room)(nil), // 11: livekit.Room + (*ParticipantInfo)(nil), // 12: livekit.ParticipantInfo + (*TrackInfo)(nil), // 13: livekit.TrackInfo } var file_room_proto_depIdxs = []int32{ - 5, // 0: livekit.ListRoomsResponse.rooms:type_name -> livekit.Room - 0, // 1: livekit.RoomService.CreateRoom:input_type -> livekit.CreateRoomRequest - 1, // 2: livekit.RoomService.ListRooms:input_type -> livekit.ListRoomsRequest - 3, // 3: livekit.RoomService.DeleteRoom:input_type -> livekit.DeleteRoomRequest - 5, // 4: livekit.RoomService.CreateRoom:output_type -> livekit.Room - 2, // 5: livekit.RoomService.ListRooms:output_type -> livekit.ListRoomsResponse - 4, // 6: livekit.RoomService.DeleteRoom:output_type -> livekit.DeleteRoomResponse - 4, // [4:7] is the sub-list for method output_type - 1, // [1:4] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 11, // 0: livekit.ListRoomsResponse.rooms:type_name -> livekit.Room + 12, // 1: livekit.ListParticipantsResponse.participants:type_name -> livekit.ParticipantInfo + 13, // 2: livekit.MuteRoomTrackResponse.track:type_name -> livekit.TrackInfo + 0, // 3: livekit.RoomService.CreateRoom:input_type -> livekit.CreateRoomRequest + 1, // 4: livekit.RoomService.ListRooms:input_type -> livekit.ListRoomsRequest + 3, // 5: livekit.RoomService.DeleteRoom:input_type -> livekit.DeleteRoomRequest + 5, // 6: livekit.RoomService.ListParticipants:input_type -> livekit.ListParticipantsRequest + 7, // 7: livekit.RoomService.GetParticipant:input_type -> livekit.RoomParticipantIdentity + 7, // 8: livekit.RoomService.RemoveParticipant:input_type -> livekit.RoomParticipantIdentity + 9, // 9: livekit.RoomService.MutePublishedTrack:input_type -> livekit.MuteRoomTrackRequest + 11, // 10: livekit.RoomService.CreateRoom:output_type -> livekit.Room + 2, // 11: livekit.RoomService.ListRooms:output_type -> livekit.ListRoomsResponse + 4, // 12: livekit.RoomService.DeleteRoom:output_type -> livekit.DeleteRoomResponse + 6, // 13: livekit.RoomService.ListParticipants:output_type -> livekit.ListParticipantsResponse + 12, // 14: livekit.RoomService.GetParticipant:output_type -> livekit.ParticipantInfo + 8, // 15: livekit.RoomService.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse + 10, // 16: livekit.RoomService.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse + 10, // [10:17] is the sub-list for method output_type + 3, // [3:10] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_room_proto_init() } @@ -414,6 +785,78 @@ func file_room_proto_init() { return nil } } + file_room_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListParticipantsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListParticipantsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RoomParticipantIdentity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveParticipantResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MuteRoomTrackRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MuteRoomTrackResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -421,7 +864,7 @@ func file_room_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_room_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 11, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/livekit/room.twirp.go b/proto/livekit/room.twirp.go index cf846a30..db78a4fc 100644 --- a/proto/livekit/room.twirp.go +++ b/proto/livekit/room.twirp.go @@ -40,15 +40,26 @@ const _ = twirp.TwirpPackageIsVersion7 // ===================== // Room service that can be performed on any node -// they are simple HTTP req/responses +// they are Twirp-based HTTP req/responses type RoomService interface { - // TODO: how do we secure room service? // should be accessible to only internal servers, not external CreateRoom(context.Context, *CreateRoomRequest) (*Room, error) ListRooms(context.Context, *ListRoomsRequest) (*ListRoomsResponse, error) DeleteRoom(context.Context, *DeleteRoomRequest) (*DeleteRoomResponse, error) + + // lists participants in a room, requires RoomAdmin + ListParticipants(context.Context, *ListParticipantsRequest) (*ListParticipantsResponse, error) + + // get information on a specific participant, requires RoomAdmin + GetParticipant(context.Context, *RoomParticipantIdentity) (*ParticipantInfo, error) + + // removes a participant from room, requires RoomAdmin + RemoveParticipant(context.Context, *RoomParticipantIdentity) (*RemoveParticipantResponse, error) + + // mute/unmute a participant, requires RoomAdmin + MutePublishedTrack(context.Context, *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) } // =========================== @@ -57,7 +68,7 @@ type RoomService interface { type roomServiceProtobufClient struct { client HTTPClient - urls [3]string + urls [7]string interceptor twirp.Interceptor opts twirp.ClientOptions } @@ -77,10 +88,14 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService") - urls := [3]string{ + urls := [7]string{ serviceURL + "CreateRoom", serviceURL + "ListRooms", serviceURL + "DeleteRoom", + serviceURL + "ListParticipants", + serviceURL + "GetParticipant", + serviceURL + "RemoveParticipant", + serviceURL + "MutePublishedTrack", } return &roomServiceProtobufClient{ @@ -229,13 +244,197 @@ func (c *roomServiceProtobufClient) callDeleteRoom(ctx context.Context, in *Dele return out, nil } +func (c *roomServiceProtobufClient) ListParticipants(ctx context.Context, in *ListParticipantsRequest) (*ListParticipantsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "ListParticipants") + caller := c.callListParticipants + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListParticipantsRequest) (*ListParticipantsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListParticipantsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListParticipantsRequest) when calling interceptor") + } + return c.callListParticipants(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListParticipantsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListParticipantsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceProtobufClient) callListParticipants(ctx context.Context, in *ListParticipantsRequest) (*ListParticipantsResponse, error) { + out := new(ListParticipantsResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *roomServiceProtobufClient) GetParticipant(ctx context.Context, in *RoomParticipantIdentity) (*ParticipantInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "GetParticipant") + caller := c.callGetParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *RoomParticipantIdentity) (*ParticipantInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RoomParticipantIdentity) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RoomParticipantIdentity) when calling interceptor") + } + return c.callGetParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceProtobufClient) callGetParticipant(ctx context.Context, in *RoomParticipantIdentity) (*ParticipantInfo, error) { + out := new(ParticipantInfo) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *roomServiceProtobufClient) RemoveParticipant(ctx context.Context, in *RoomParticipantIdentity) (*RemoveParticipantResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "RemoveParticipant") + caller := c.callRemoveParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *RoomParticipantIdentity) (*RemoveParticipantResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RoomParticipantIdentity) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RoomParticipantIdentity) when calling interceptor") + } + return c.callRemoveParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*RemoveParticipantResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*RemoveParticipantResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceProtobufClient) callRemoveParticipant(ctx context.Context, in *RoomParticipantIdentity) (*RemoveParticipantResponse, error) { + out := new(RemoveParticipantResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[5], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *roomServiceProtobufClient) MutePublishedTrack(ctx context.Context, in *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "MutePublishedTrack") + caller := c.callMutePublishedTrack + if c.interceptor != nil { + caller = func(ctx context.Context, req *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*MuteRoomTrackRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*MuteRoomTrackRequest) when calling interceptor") + } + return c.callMutePublishedTrack(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*MuteRoomTrackResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*MuteRoomTrackResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceProtobufClient) callMutePublishedTrack(ctx context.Context, in *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) { + out := new(MuteRoomTrackResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[6], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + // ======================= // RoomService JSON Client // ======================= type roomServiceJSONClient struct { client HTTPClient - urls [3]string + urls [7]string interceptor twirp.Interceptor opts twirp.ClientOptions } @@ -255,10 +454,14 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService") - urls := [3]string{ + urls := [7]string{ serviceURL + "CreateRoom", serviceURL + "ListRooms", serviceURL + "DeleteRoom", + serviceURL + "ListParticipants", + serviceURL + "GetParticipant", + serviceURL + "RemoveParticipant", + serviceURL + "MutePublishedTrack", } return &roomServiceJSONClient{ @@ -407,6 +610,190 @@ func (c *roomServiceJSONClient) callDeleteRoom(ctx context.Context, in *DeleteRo return out, nil } +func (c *roomServiceJSONClient) ListParticipants(ctx context.Context, in *ListParticipantsRequest) (*ListParticipantsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "ListParticipants") + caller := c.callListParticipants + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListParticipantsRequest) (*ListParticipantsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListParticipantsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListParticipantsRequest) when calling interceptor") + } + return c.callListParticipants(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListParticipantsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListParticipantsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceJSONClient) callListParticipants(ctx context.Context, in *ListParticipantsRequest) (*ListParticipantsResponse, error) { + out := new(ListParticipantsResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *roomServiceJSONClient) GetParticipant(ctx context.Context, in *RoomParticipantIdentity) (*ParticipantInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "GetParticipant") + caller := c.callGetParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *RoomParticipantIdentity) (*ParticipantInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RoomParticipantIdentity) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RoomParticipantIdentity) when calling interceptor") + } + return c.callGetParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceJSONClient) callGetParticipant(ctx context.Context, in *RoomParticipantIdentity) (*ParticipantInfo, error) { + out := new(ParticipantInfo) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *roomServiceJSONClient) RemoveParticipant(ctx context.Context, in *RoomParticipantIdentity) (*RemoveParticipantResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "RemoveParticipant") + caller := c.callRemoveParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *RoomParticipantIdentity) (*RemoveParticipantResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RoomParticipantIdentity) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RoomParticipantIdentity) when calling interceptor") + } + return c.callRemoveParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*RemoveParticipantResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*RemoveParticipantResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceJSONClient) callRemoveParticipant(ctx context.Context, in *RoomParticipantIdentity) (*RemoveParticipantResponse, error) { + out := new(RemoveParticipantResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[5], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *roomServiceJSONClient) MutePublishedTrack(ctx context.Context, in *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "MutePublishedTrack") + caller := c.callMutePublishedTrack + if c.interceptor != nil { + caller = func(ctx context.Context, req *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*MuteRoomTrackRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*MuteRoomTrackRequest) when calling interceptor") + } + return c.callMutePublishedTrack(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*MuteRoomTrackResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*MuteRoomTrackResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceJSONClient) callMutePublishedTrack(ctx context.Context, in *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) { + out := new(MuteRoomTrackResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[6], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + // ========================== // RoomService Server Handler // ========================== @@ -500,6 +887,18 @@ func (s *roomServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Reques case "DeleteRoom": s.serveDeleteRoom(ctx, resp, req) return + case "ListParticipants": + s.serveListParticipants(ctx, resp, req) + return + case "GetParticipant": + s.serveGetParticipant(ctx, resp, req) + return + case "RemoveParticipant": + s.serveRemoveParticipant(ctx, resp, req) + return + case "MutePublishedTrack": + s.serveMutePublishedTrack(ctx, resp, req) + return default: msg := fmt.Sprintf("no handler for path %q", req.URL.Path) s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) @@ -1032,6 +1431,706 @@ func (s *roomServiceServer) serveDeleteRoomProtobuf(ctx context.Context, resp ht callResponseSent(ctx, s.hooks) } +func (s *roomServiceServer) serveListParticipants(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveListParticipantsJSON(ctx, resp, req) + case "application/protobuf": + s.serveListParticipantsProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *roomServiceServer) serveListParticipantsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListParticipants") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + reqContent := new(ListParticipantsRequest) + unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} + if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + return + } + + handler := s.RoomService.ListParticipants + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListParticipantsRequest) (*ListParticipantsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListParticipantsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListParticipantsRequest) when calling interceptor") + } + return s.RoomService.ListParticipants(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListParticipantsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListParticipantsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListParticipantsResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListParticipantsResponse and nil error while calling ListParticipants. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + var buf bytes.Buffer + marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} + if err = marshaler.Marshal(&buf, respContent); err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + respBytes := buf.Bytes() + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *roomServiceServer) serveListParticipantsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListParticipants") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + return + } + reqContent := new(ListParticipantsRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.RoomService.ListParticipants + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListParticipantsRequest) (*ListParticipantsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListParticipantsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListParticipantsRequest) when calling interceptor") + } + return s.RoomService.ListParticipants(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListParticipantsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListParticipantsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListParticipantsResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListParticipantsResponse and nil error while calling ListParticipants. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *roomServiceServer) serveGetParticipant(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveGetParticipantJSON(ctx, resp, req) + case "application/protobuf": + s.serveGetParticipantProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *roomServiceServer) serveGetParticipantJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + reqContent := new(RoomParticipantIdentity) + unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} + if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + return + } + + handler := s.RoomService.GetParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *RoomParticipantIdentity) (*ParticipantInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RoomParticipantIdentity) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RoomParticipantIdentity) when calling interceptor") + } + return s.RoomService.GetParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ParticipantInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ParticipantInfo and nil error while calling GetParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + var buf bytes.Buffer + marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} + if err = marshaler.Marshal(&buf, respContent); err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + respBytes := buf.Bytes() + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *roomServiceServer) serveGetParticipantProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + return + } + reqContent := new(RoomParticipantIdentity) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.RoomService.GetParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *RoomParticipantIdentity) (*ParticipantInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RoomParticipantIdentity) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RoomParticipantIdentity) when calling interceptor") + } + return s.RoomService.GetParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ParticipantInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ParticipantInfo and nil error while calling GetParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *roomServiceServer) serveRemoveParticipant(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveRemoveParticipantJSON(ctx, resp, req) + case "application/protobuf": + s.serveRemoveParticipantProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *roomServiceServer) serveRemoveParticipantJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "RemoveParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + reqContent := new(RoomParticipantIdentity) + unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} + if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + return + } + + handler := s.RoomService.RemoveParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *RoomParticipantIdentity) (*RemoveParticipantResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RoomParticipantIdentity) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RoomParticipantIdentity) when calling interceptor") + } + return s.RoomService.RemoveParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*RemoveParticipantResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*RemoveParticipantResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *RemoveParticipantResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *RemoveParticipantResponse and nil error while calling RemoveParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + var buf bytes.Buffer + marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} + if err = marshaler.Marshal(&buf, respContent); err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + respBytes := buf.Bytes() + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *roomServiceServer) serveRemoveParticipantProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "RemoveParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + return + } + reqContent := new(RoomParticipantIdentity) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.RoomService.RemoveParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *RoomParticipantIdentity) (*RemoveParticipantResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*RoomParticipantIdentity) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*RoomParticipantIdentity) when calling interceptor") + } + return s.RoomService.RemoveParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*RemoveParticipantResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*RemoveParticipantResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *RemoveParticipantResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *RemoveParticipantResponse and nil error while calling RemoveParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *roomServiceServer) serveMutePublishedTrack(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveMutePublishedTrackJSON(ctx, resp, req) + case "application/protobuf": + s.serveMutePublishedTrackProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *roomServiceServer) serveMutePublishedTrackJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "MutePublishedTrack") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + reqContent := new(MuteRoomTrackRequest) + unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} + if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + return + } + + handler := s.RoomService.MutePublishedTrack + if s.interceptor != nil { + handler = func(ctx context.Context, req *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*MuteRoomTrackRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*MuteRoomTrackRequest) when calling interceptor") + } + return s.RoomService.MutePublishedTrack(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*MuteRoomTrackResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*MuteRoomTrackResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *MuteRoomTrackResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *MuteRoomTrackResponse and nil error while calling MutePublishedTrack. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + var buf bytes.Buffer + marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} + if err = marshaler.Marshal(&buf, respContent); err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + respBytes := buf.Bytes() + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *roomServiceServer) serveMutePublishedTrackProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "MutePublishedTrack") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + return + } + reqContent := new(MuteRoomTrackRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.RoomService.MutePublishedTrack + if s.interceptor != nil { + handler = func(ctx context.Context, req *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*MuteRoomTrackRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*MuteRoomTrackRequest) when calling interceptor") + } + return s.RoomService.MutePublishedTrack(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*MuteRoomTrackResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*MuteRoomTrackResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *MuteRoomTrackResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *MuteRoomTrackResponse and nil error while calling MutePublishedTrack. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + func (s *roomServiceServer) ServiceDescriptor() ([]byte, int) { return twirpFileDescriptor0, 0 } @@ -1594,26 +2693,40 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) } var twirpFileDescriptor0 = []byte{ - // 331 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x4e, 0xf2, 0x40, - 0x14, 0x85, 0xd3, 0x1f, 0x7e, 0x08, 0x17, 0x89, 0x70, 0x63, 0x62, 0xad, 0x1b, 0x52, 0x17, 0xe2, - 0xc2, 0x12, 0x71, 0xa1, 0x6b, 0xd4, 0x85, 0x89, 0x0b, 0x53, 0x5d, 0xb9, 0x21, 0x03, 0xbd, 0xd1, - 0x89, 0x4c, 0xa7, 0xce, 0x0c, 0x04, 0xdf, 0xc2, 0x57, 0xf3, 0x8d, 0xcc, 0x4c, 0x0b, 0x54, 0xcb, - 0xaa, 0x33, 0xe7, 0xdc, 0xf4, 0x9c, 0xef, 0x66, 0x00, 0x94, 0x94, 0x22, 0xca, 0x94, 0x34, 0x12, - 0x9b, 0x73, 0xbe, 0xa4, 0x77, 0x6e, 0x82, 0xb6, 0x90, 0x09, 0xcd, 0x73, 0x35, 0xfc, 0xf2, 0xa0, - 0x77, 0xa3, 0x88, 0x19, 0x8a, 0xa5, 0x14, 0x31, 0x7d, 0x2c, 0x48, 0x1b, 0x44, 0xa8, 0xa7, 0x4c, - 0x90, 0xef, 0xf5, 0xbd, 0x41, 0x2b, 0x76, 0x67, 0x3c, 0x81, 0x0e, 0x89, 0xcc, 0x7c, 0x4e, 0x0c, - 0x17, 0x24, 0x17, 0xc6, 0xff, 0xd7, 0xf7, 0x06, 0x9d, 0x78, 0xcf, 0x89, 0xcf, 0xb9, 0x86, 0x67, - 0xd0, 0x15, 0x6c, 0x35, 0xc9, 0x98, 0x32, 0x7c, 0xc6, 0x33, 0x96, 0x1a, 0xed, 0xd7, 0xdc, 0xdc, - 0xbe, 0x60, 0xab, 0xc7, 0x92, 0x8c, 0x87, 0xd0, 0x4c, 0x65, 0x42, 0x13, 0x9e, 0xf8, 0x75, 0x17, - 0xd3, 0xb0, 0xd7, 0xfb, 0x24, 0x44, 0xe8, 0x3e, 0x70, 0x6d, 0x6c, 0x1f, 0x5d, 0x14, 0x0a, 0xaf, - 0xa1, 0x57, 0xd2, 0x74, 0x26, 0x53, 0x6d, 0x1b, 0xfd, 0xb7, 0x7c, 0xda, 0xf7, 0xfa, 0xb5, 0x41, - 0x7b, 0xd4, 0x89, 0x0a, 0xc2, 0xc8, 0xa1, 0xe4, 0x5e, 0x78, 0x0a, 0xbd, 0x5b, 0x9a, 0x53, 0x85, - 0xcf, 0xba, 0x6b, 0x3e, 0x7b, 0x0e, 0x0f, 0x00, 0xcb, 0x83, 0x79, 0xc6, 0xe8, 0xdb, 0x83, 0xb6, - 0x15, 0x9e, 0x48, 0x2d, 0xf9, 0x8c, 0xf0, 0x0a, 0x60, 0xbb, 0x2e, 0x0c, 0x36, 0x91, 0x95, 0x1d, - 0x06, 0xbf, 0xeb, 0xe0, 0x18, 0x5a, 0x1b, 0x02, 0x3c, 0xda, 0x78, 0x7f, 0x49, 0x83, 0x60, 0x97, - 0x55, 0x00, 0xdf, 0x01, 0x6c, 0x2b, 0x96, 0xc2, 0x2b, 0x80, 0xc1, 0xf1, 0x4e, 0x2f, 0xff, 0xcd, - 0xf8, 0xe2, 0x65, 0xf8, 0xca, 0xcd, 0xdb, 0x62, 0x1a, 0xcd, 0xa4, 0x18, 0x16, 0x83, 0xeb, 0xef, - 0xb9, 0x26, 0xb5, 0x24, 0x35, 0x74, 0xcf, 0x63, 0x2d, 0x4e, 0x1b, 0xee, 0x7a, 0xf9, 0x13, 0x00, - 0x00, 0xff, 0xff, 0x7a, 0x20, 0xfb, 0xae, 0x51, 0x02, 0x00, 0x00, + // 549 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdf, 0x6f, 0x12, 0x41, + 0x10, 0x0e, 0xb6, 0xb4, 0x30, 0x14, 0x2d, 0x13, 0x0c, 0xd7, 0x23, 0x1a, 0x3c, 0x1f, 0xc4, 0x87, + 0x42, 0xc4, 0x07, 0x7d, 0xf0, 0xc5, 0xaa, 0x31, 0x24, 0x35, 0x69, 0x8e, 0x26, 0xfe, 0x78, 0x21, + 0x07, 0x37, 0xda, 0x4d, 0xd9, 0x5b, 0xbc, 0xdb, 0x23, 0xe5, 0xbf, 0xf0, 0xcf, 0xf0, 0xcf, 0x34, + 0xbb, 0x7b, 0x1c, 0x4b, 0x39, 0x88, 0x4f, 0xdc, 0xce, 0x7c, 0x33, 0xdf, 0x37, 0xb3, 0xdf, 0x02, + 0x10, 0x0b, 0xc1, 0x7b, 0xf3, 0x58, 0x48, 0x81, 0xc7, 0x33, 0xb6, 0xa0, 0x5b, 0x26, 0xdd, 0x1a, + 0x17, 0x21, 0xcd, 0x4c, 0xd4, 0xfb, 0x53, 0x82, 0xc6, 0x87, 0x98, 0x02, 0x49, 0xbe, 0x10, 0xdc, + 0xa7, 0xdf, 0x29, 0x25, 0x12, 0x11, 0x0e, 0xa3, 0x80, 0x93, 0x53, 0xea, 0x94, 0xba, 0x55, 0x5f, + 0x7f, 0xe3, 0x73, 0xa8, 0x13, 0x9f, 0xcb, 0xe5, 0x58, 0x32, 0x4e, 0x22, 0x95, 0xce, 0x83, 0x4e, + 0xa9, 0x5b, 0xf7, 0x4f, 0x74, 0xf0, 0xda, 0xc4, 0xf0, 0x25, 0x9c, 0xf2, 0xe0, 0x6e, 0x3c, 0x0f, + 0x62, 0xc9, 0xa6, 0x6c, 0x1e, 0x44, 0x32, 0x71, 0x0e, 0x34, 0xee, 0x11, 0x0f, 0xee, 0xae, 0xac, + 0x30, 0xb6, 0xe0, 0x38, 0x12, 0x21, 0x8d, 0x59, 0xe8, 0x1c, 0x6a, 0x9a, 0x23, 0x75, 0x1c, 0x86, + 0x1e, 0xc2, 0xe9, 0x25, 0x4b, 0xa4, 0xd2, 0x93, 0x64, 0x82, 0xbc, 0xb7, 0xd0, 0xb0, 0x62, 0xc9, + 0x5c, 0x44, 0x89, 0x52, 0x54, 0x56, 0xf3, 0x25, 0x4e, 0xa9, 0x73, 0xd0, 0xad, 0x0d, 0xea, 0xbd, + 0x6c, 0xc2, 0x9e, 0x1e, 0xc5, 0xe4, 0xbc, 0x17, 0xd0, 0xf8, 0x48, 0x33, 0xda, 0x9a, 0x4f, 0x65, + 0x57, 0xf3, 0xa9, 0x6f, 0xaf, 0x09, 0x68, 0x03, 0x0d, 0x87, 0x77, 0x0e, 0x2d, 0x45, 0x6c, 0x2b, + 0xdf, 0xd7, 0xe4, 0x1b, 0x38, 0xdb, 0xf0, 0x4c, 0xee, 0x3b, 0x38, 0xd9, 0xd8, 0x8b, 0x51, 0xed, + 0xe4, 0xaa, 0xad, 0xa2, 0x61, 0xf4, 0x53, 0xf8, 0x1b, 0x68, 0x6f, 0x08, 0x2d, 0x25, 0xcc, 0x06, + 0x85, 0x14, 0x49, 0x26, 0x97, 0x45, 0x42, 0xd0, 0x85, 0x0a, 0xcb, 0xf2, 0xfa, 0xa2, 0xaa, 0x7e, + 0x7e, 0xf6, 0xda, 0x70, 0xe6, 0x13, 0x17, 0x0b, 0xb2, 0x9a, 0xe5, 0x03, 0x2f, 0xa1, 0xf9, 0x25, + 0x35, 0x4b, 0xb8, 0x8e, 0x83, 0xe9, 0xed, 0x9e, 0x69, 0xf7, 0x91, 0x60, 0x1b, 0xaa, 0x52, 0xd5, + 0x8f, 0x13, 0x16, 0x6a, 0x0b, 0x54, 0xfd, 0x8a, 0x0e, 0x8c, 0x58, 0x88, 0x4d, 0x28, 0xf3, 0x54, + 0x92, 0xb9, 0xf9, 0x8a, 0x6f, 0x0e, 0xde, 0x7b, 0x78, 0x7c, 0x8f, 0x3a, 0xdb, 0x5c, 0x17, 0xca, + 0xba, 0x54, 0x93, 0xd7, 0x06, 0x98, 0xaf, 0x4c, 0xc3, 0xf4, 0xb2, 0x0c, 0x60, 0xf0, 0xf7, 0x10, + 0x6a, 0xaa, 0x7e, 0x44, 0xf1, 0x82, 0x4d, 0x09, 0xdf, 0x00, 0xac, 0xdd, 0x8d, 0x6e, 0x5e, 0xb8, + 0x65, 0x79, 0x77, 0xd3, 0x3d, 0x78, 0x01, 0xd5, 0xdc, 0x70, 0x78, 0x96, 0xe7, 0xee, 0x1b, 0xd3, + 0x75, 0x8b, 0x52, 0x99, 0xec, 0x4f, 0x00, 0x6b, 0x47, 0x59, 0xe4, 0x5b, 0x7e, 0x74, 0xdb, 0x85, + 0xb9, 0xac, 0xcd, 0x57, 0xf3, 0x1e, 0x36, 0x1e, 0x4f, 0x67, 0x83, 0xb6, 0xc0, 0x9d, 0xee, 0xb3, + 0x3d, 0x88, 0xac, 0xf1, 0x25, 0x3c, 0xfc, 0x4c, 0x76, 0xca, 0x6a, 0xbb, 0xc3, 0x6b, 0xee, 0x4e, + 0xbb, 0xe2, 0x77, 0x68, 0x6c, 0xb9, 0xea, 0x3f, 0x1a, 0x7a, 0x6b, 0xc4, 0x2e, 0x4f, 0xe2, 0x08, + 0x50, 0x19, 0xe3, 0x2a, 0x9d, 0xcc, 0x58, 0x72, 0x43, 0xa1, 0xbe, 0x76, 0x7c, 0x92, 0x57, 0x16, + 0x19, 0xd6, 0x7d, 0xba, 0x2b, 0x6d, 0x9a, 0x5e, 0xbc, 0xfa, 0xd1, 0xff, 0xc5, 0xe4, 0x4d, 0x3a, + 0xe9, 0x4d, 0x05, 0xef, 0x67, 0xd8, 0xd5, 0xef, 0x79, 0x42, 0xf1, 0x82, 0xe2, 0xbe, 0xfe, 0x93, + 0x5c, 0x05, 0x27, 0x47, 0xfa, 0xf8, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0x66, 0x2b, + 0xf4, 0x57, 0x05, 0x00, 0x00, } diff --git a/proto/livekit/rtc.pb.go b/proto/livekit/rtc.pb.go index 9cb2169d..1ccc27ab 100644 --- a/proto/livekit/rtc.pb.go +++ b/proto/livekit/rtc.pb.go @@ -37,6 +37,7 @@ type SignalRequest struct { // *SignalRequest_AddTrack // *SignalRequest_Mute // *SignalRequest_Negotiate + // *SignalRequest_MuteSubscribed Message isSignalRequest_Message `protobuf_oneof:"message"` } @@ -121,6 +122,13 @@ func (x *SignalRequest) GetNegotiate() *NegotiationRequest { return nil } +func (x *SignalRequest) GetMuteSubscribed() *MuteTrackRequest { + if x, ok := x.GetMessage().(*SignalRequest_MuteSubscribed); ok { + return x.MuteSubscribed + } + return nil +} + type isSignalRequest_Message interface { isSignalRequest_Message() } @@ -144,6 +152,7 @@ type SignalRequest_AddTrack struct { } type SignalRequest_Mute struct { + // mute the participant's own tracks Mute *MuteTrackRequest `protobuf:"bytes,5,opt,name=mute,proto3,oneof"` } @@ -152,6 +161,11 @@ type SignalRequest_Negotiate struct { Negotiate *NegotiationRequest `protobuf:"bytes,7,opt,name=negotiate,proto3,oneof"` } +type SignalRequest_MuteSubscribed struct { + // mute a track client is subscribed to + MuteSubscribed *MuteTrackRequest `protobuf:"bytes,8,opt,name=mute_subscribed,json=muteSubscribed,proto3,oneof"` +} + func (*SignalRequest_Offer) isSignalRequest_Message() {} func (*SignalRequest_Answer) isSignalRequest_Message() {} @@ -164,6 +178,8 @@ func (*SignalRequest_Mute) isSignalRequest_Message() {} func (*SignalRequest_Negotiate) isSignalRequest_Message() {} +func (*SignalRequest_MuteSubscribed) isSignalRequest_Message() {} + type SignalResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -788,7 +804,7 @@ var File_rtc_proto protoreflect.FileDescriptor var file_rtc_proto_rawDesc = []byte{ 0x0a, 0x09, 0x72, 0x74, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x1a, 0x0b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xe2, 0x02, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, + 0x6f, 0x22, 0xa8, 0x03, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, @@ -809,80 +825,85 @@ var file_rtc_proto_rawDesc = []byte{ 0x0a, 0x09, 0x6e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, - 0x52, 0x09, 0x6e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xa9, 0x03, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x6a, 0x6f, 0x69, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, - 0x74, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, - 0x52, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x12, 0x35, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, - 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x33, 0x0a, - 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, + 0x52, 0x09, 0x6e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x0f, 0x6d, + 0x75, 0x74, 0x65, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, + 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, + 0x00, 0x52, 0x0e, 0x6d, 0x75, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x64, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xa9, 0x03, 0x0a, + 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2b, 0x0a, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x12, 0x35, 0x0a, 0x06, + 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x66, 0x66, - 0x65, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, - 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x07, - 0x74, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, - 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x4a, 0x0a, - 0x0f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, - 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x63, 0x6b, - 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x09, 0x6e, 0x65, 0x67, - 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6c, - 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x65, - 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x22, 0x5f, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, - 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x22, 0x36, 0x0a, 0x0e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x61, - 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x22, 0x3a, 0x0a, 0x10, 0x4d, - 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, - 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x4e, 0x65, 0x67, 0x6f, 0x74, - 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xb6, 0x01, - 0x0a, 0x0c, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, - 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, - 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x04, 0x72, 0x6f, 0x6f, - 0x6d, 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, - 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x47, 0x0a, - 0x12, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, - 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, - 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x11, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x54, 0x0a, 0x16, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x50, - 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, - 0x69, 0x64, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, - 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x22, 0x15, 0x0a, 0x13, - 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x12, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x73, 0x64, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x64, 0x70, 0x22, - 0x51, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, - 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, - 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, - 0x74, 0x73, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, - 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, - 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x6e, 0x73, + 0x77, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x00, 0x52, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x63, + 0x6b, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x76, 0x65, + 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x48, 0x00, 0x52, 0x07, 0x74, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x12, 0x34, 0x0a, + 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x06, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, + 0x0e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, + 0x3c, 0x0a, 0x09, 0x6e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4e, 0x65, 0x67, + 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x48, 0x00, 0x52, 0x09, 0x6e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x42, 0x09, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x5f, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x54, + 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x36, 0x0a, 0x0e, 0x54, 0x72, 0x69, + 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x63, + 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x69, + 0x74, 0x22, 0x3a, 0x0a, 0x10, 0x4d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x22, 0x14, 0x0a, + 0x12, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0xb6, 0x01, 0x0a, 0x0c, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, + 0x6d, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, + 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x12, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x11, 0x6f, 0x74, 0x68, 0x65, 0x72, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x54, 0x0a, 0x16, + 0x54, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, + 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, + 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x74, 0x72, 0x61, + 0x63, 0x6b, 0x22, 0x15, 0x0a, 0x13, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x12, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x64, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x73, 0x64, 0x70, 0x22, 0x51, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, + 0x70, 0x61, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x70, 0x61, + 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, + 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, + 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -922,24 +943,25 @@ var file_rtc_proto_depIdxs = []int32{ 2, // 3: livekit.SignalRequest.add_track:type_name -> livekit.AddTrackRequest 4, // 4: livekit.SignalRequest.mute:type_name -> livekit.MuteTrackRequest 5, // 5: livekit.SignalRequest.negotiate:type_name -> livekit.NegotiationRequest - 6, // 6: livekit.SignalResponse.join:type_name -> livekit.JoinResponse - 9, // 7: livekit.SignalResponse.answer:type_name -> livekit.SessionDescription - 9, // 8: livekit.SignalResponse.offer:type_name -> livekit.SessionDescription - 3, // 9: livekit.SignalResponse.trickle:type_name -> livekit.TrickleRequest - 10, // 10: livekit.SignalResponse.update:type_name -> livekit.ParticipantUpdate - 7, // 11: livekit.SignalResponse.track_published:type_name -> livekit.TrackPublishedResponse - 8, // 12: livekit.SignalResponse.negotiate:type_name -> livekit.NegotiationResponse - 11, // 13: livekit.AddTrackRequest.type:type_name -> livekit.TrackType - 12, // 14: livekit.JoinResponse.room:type_name -> livekit.Room - 13, // 15: livekit.JoinResponse.participant:type_name -> livekit.ParticipantInfo - 13, // 16: livekit.JoinResponse.other_participants:type_name -> livekit.ParticipantInfo - 14, // 17: livekit.TrackPublishedResponse.track:type_name -> livekit.TrackInfo - 13, // 18: livekit.ParticipantUpdate.participants:type_name -> livekit.ParticipantInfo - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 4, // 6: livekit.SignalRequest.mute_subscribed:type_name -> livekit.MuteTrackRequest + 6, // 7: livekit.SignalResponse.join:type_name -> livekit.JoinResponse + 9, // 8: livekit.SignalResponse.answer:type_name -> livekit.SessionDescription + 9, // 9: livekit.SignalResponse.offer:type_name -> livekit.SessionDescription + 3, // 10: livekit.SignalResponse.trickle:type_name -> livekit.TrickleRequest + 10, // 11: livekit.SignalResponse.update:type_name -> livekit.ParticipantUpdate + 7, // 12: livekit.SignalResponse.track_published:type_name -> livekit.TrackPublishedResponse + 8, // 13: livekit.SignalResponse.negotiate:type_name -> livekit.NegotiationResponse + 11, // 14: livekit.AddTrackRequest.type:type_name -> livekit.TrackType + 12, // 15: livekit.JoinResponse.room:type_name -> livekit.Room + 13, // 16: livekit.JoinResponse.participant:type_name -> livekit.ParticipantInfo + 13, // 17: livekit.JoinResponse.other_participants:type_name -> livekit.ParticipantInfo + 14, // 18: livekit.TrackPublishedResponse.track:type_name -> livekit.TrackInfo + 13, // 19: livekit.ParticipantUpdate.participants:type_name -> livekit.ParticipantInfo + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_rtc_proto_init() } @@ -1089,6 +1111,7 @@ func file_rtc_proto_init() { (*SignalRequest_AddTrack)(nil), (*SignalRequest_Mute)(nil), (*SignalRequest_Negotiate)(nil), + (*SignalRequest_MuteSubscribed)(nil), } file_rtc_proto_msgTypes[1].OneofWrappers = []interface{}{ (*SignalResponse_Join)(nil), diff --git a/proto/room.proto b/proto/room.proto index fee5408a..2dae20f5 100644 --- a/proto/room.proto +++ b/proto/room.proto @@ -6,13 +6,23 @@ option go_package = "github.com/livekit/livekit-server/proto/livekit"; import "model.proto"; // Room service that can be performed on any node -// they are simple HTTP req/responses +// they are Twirp-based HTTP req/responses service RoomService { - // TODO: how do we secure room service? + // should be accessible to only internal servers, not external rpc CreateRoom(CreateRoomRequest) returns (Room); rpc ListRooms(ListRoomsRequest) returns (ListRoomsResponse); rpc DeleteRoom(DeleteRoomRequest) returns (DeleteRoomResponse); + + // lists participants in a room, requires RoomAdmin + rpc ListParticipants(ListParticipantsRequest) returns (ListParticipantsResponse); + // get information on a specific participant, requires RoomAdmin + rpc GetParticipant(RoomParticipantIdentity) returns (ParticipantInfo); + // removes a participant from room, requires RoomAdmin + rpc RemoveParticipant(RoomParticipantIdentity) returns (RemoveParticipantResponse); + + // mute/unmute a participant, requires RoomAdmin + rpc MutePublishedTrack(MuteRoomTrackRequest) returns (MuteRoomTrackResponse); } message CreateRoomRequest { @@ -37,3 +47,30 @@ message DeleteRoomRequest { message DeleteRoomResponse { } + +message ListParticipantsRequest { + string room = 1; +} + +message ListParticipantsResponse { + repeated ParticipantInfo participants = 1; +} + +message RoomParticipantIdentity { + string room = 1; + string identity = 2; +} + +message RemoveParticipantResponse { +} + +message MuteRoomTrackRequest { + string room = 1; + string identity = 2; + string track_sid = 3; + bool muted = 4; +} + +message MuteRoomTrackResponse { + TrackInfo track = 1; +} \ No newline at end of file diff --git a/proto/rtc.proto b/proto/rtc.proto index 4d3e26ae..8495719b 100644 --- a/proto/rtc.proto +++ b/proto/rtc.proto @@ -13,9 +13,12 @@ message SignalRequest { SessionDescription answer = 2; TrickleRequest trickle = 3; AddTrackRequest add_track = 4; + // mute the participant's own tracks MuteTrackRequest mute = 5; // when client needs to negotiate NegotiationRequest negotiate = 7; + // mute a track client is subscribed to + MuteTrackRequest mute_subscribed = 8; } } @@ -78,7 +81,6 @@ message SessionDescription { string sdp = 2; } - message ParticipantUpdate { repeated ParticipantInfo participants = 1; }