RoomService.updateParticipantMetadata, participant permissions

This commit is contained in:
David Zhao
2021-03-16 01:22:21 -07:00
parent e04eaeb480
commit f7ed2cee60
19 changed files with 1113 additions and 325 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ require (
github.com/google/wire v0.5.0 github.com/google/wire v0.5.0
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.4.2
github.com/jxskiss/base62 v0.0.0-20191017122030-4f11678b909b github.com/jxskiss/base62 v0.0.0-20191017122030-4f11678b909b
github.com/livekit/protocol v0.1.1 github.com/livekit/protocol v0.2.2
github.com/magefile/mage v1.11.0 github.com/magefile/mage v1.11.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0 github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-homedir v1.1.0
+4
View File
@@ -232,6 +232,10 @@ github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts= github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
github.com/livekit/protocol v0.1.1 h1:usRLnWYFsPK7GDii6bI7E/z510LMKAHkyaasOHKR/Z0= github.com/livekit/protocol v0.1.1 h1:usRLnWYFsPK7GDii6bI7E/z510LMKAHkyaasOHKR/Z0=
github.com/livekit/protocol v0.1.1/go.mod h1:CP+5gHoKelqXgYLSVUGB8QFYUKIqB26EXKbb/89Wofg= github.com/livekit/protocol v0.1.1/go.mod h1:CP+5gHoKelqXgYLSVUGB8QFYUKIqB26EXKbb/89Wofg=
github.com/livekit/protocol v0.2.1 h1:kWZlkMxkuEfvrZa8NFqOCulybEL3eJr2lrq8OfrTLPg=
github.com/livekit/protocol v0.2.1/go.mod h1:wo3CGfYB7XMF8GoVJAfTARrYSP/ombi+sbLl6AYdKP0=
github.com/livekit/protocol v0.2.2 h1:XRcbreNYi8ReAICSsJ3QXzGKSNOz0LxnimAwz5hVSHQ=
github.com/livekit/protocol v0.2.2/go.mod h1:wo3CGfYB7XMF8GoVJAfTARrYSP/ombi+sbLl6AYdKP0=
github.com/lucsky/cuid v1.0.2 h1:z4XlExeoderxoPj2/dxKOyPxe9RCOu7yNq9/XWxIUMQ= github.com/lucsky/cuid v1.0.2 h1:z4XlExeoderxoPj2/dxKOyPxe9RCOu7yNq9/XWxIUMQ=
github.com/lucsky/cuid v1.0.2/go.mod h1:QaaJqckboimOmhRSJXSx/+IT+VTfxfPGSo/6mfgUfmE= github.com/lucsky/cuid v1.0.2/go.mod h1:QaaJqckboimOmhRSJXSx/+IT+VTfxfPGSo/6mfgUfmE=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
+11 -10
View File
@@ -43,11 +43,12 @@ func Deps() error {
// regenerate protobuf // regenerate protobuf
func Proto() error { func Proto() error {
protoDir := "../protocol"
updated, err := target.Path("proto/model.pb.go", updated, err := target.Path("proto/model.pb.go",
"../protocol/model.proto", protoDir+"/model.proto",
"../protocol/room.proto", protoDir+"/room.proto",
"../protocol/rtc.proto", protoDir+"/rtc.proto",
"../protocol/internal.proto", protoDir+"/internal.proto",
) )
if err != nil { if err != nil {
return err return err
@@ -83,8 +84,8 @@ func Proto() error {
"--twirp_opt=paths=source_relative", "--twirp_opt=paths=source_relative",
"--plugin=go="+protoc_go_path, "--plugin=go="+protoc_go_path,
"--plugin=twirp="+twirp_path, "--plugin=twirp="+twirp_path,
"-I=../protocol", "-I="+protoDir,
"../protocol/room.proto", protoDir+"/room.proto",
) )
connectStd(cmd) connectStd(cmd)
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
@@ -96,10 +97,10 @@ func Proto() error {
"--go_out", target, "--go_out", target,
"--go_opt=paths=source_relative", "--go_opt=paths=source_relative",
"--plugin=go="+protoc_go_path, "--plugin=go="+protoc_go_path,
"-I=../protocol", "-I="+protoDir,
"../protocol/rtc.proto", protoDir+"/rtc.proto",
"../protocol/internal.proto", protoDir+"/internal.proto",
"../protocol/model.proto", protoDir+"/model.proto",
) )
connectStd(cmd) connectStd(cmd)
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
+9 -2
View File
@@ -23,7 +23,14 @@ type MessageSource interface {
ReadChan() <-chan proto.Message ReadChan() <-chan proto.Message
} }
type NewParticipantCallback func(roomName, identity, metadata string, reconnect bool, requestSource MessageSource, responseSink MessageSink) type ParticipantInit struct {
Identity string
Metadata string
Reconnect bool
Permission *livekit.ParticipantPermission
}
type NewParticipantCallback func(roomName string, pi ParticipantInit, requestSource MessageSource, responseSink MessageSink)
type RTCMessageCallback func(roomName, identity string, msg *livekit.RTCNodeMessage) type RTCMessageCallback func(roomName, identity string, msg *livekit.RTCNodeMessage)
// Router allows multiple nodes to coordinate the participant session // Router allows multiple nodes to coordinate the participant session
@@ -39,7 +46,7 @@ type Router interface {
ListNodes() ([]*livekit.Node, error) ListNodes() ([]*livekit.Node, error)
// participant signal connection is ready to start // participant signal connection is ready to start
StartParticipantSignal(roomName, identity, metadata string, reconnect bool) (connectionId string, reqSink MessageSink, resSource MessageSource, err error) StartParticipantSignal(roomName string, pi ParticipantInit) (connectionId string, reqSink MessageSink, resSource MessageSource, err error)
// sends a message to RTC node // sends a message to RTC node
CreateRTCSink(roomName, identity string) (MessageSink, error) CreateRTCSink(roomName, identity string) (MessageSink, error)
+4 -6
View File
@@ -71,7 +71,7 @@ func (r *LocalRouter) ListNodes() ([]*livekit.Node, error) {
}, nil }, nil
} }
func (r *LocalRouter) StartParticipantSignal(roomName, identity, metadata string, reconnect bool) (connectionId string, reqSink MessageSink, resSource MessageSource, err error) { func (r *LocalRouter) StartParticipantSignal(roomName string, pi ParticipantInit) (connectionId string, reqSink MessageSink, resSource MessageSource, err error) {
// treat it as a new participant connecting // treat it as a new participant connecting
if r.onNewParticipant == nil { if r.onNewParticipant == nil {
err = ErrHandlerNotDefined err = ErrHandlerNotDefined
@@ -79,21 +79,19 @@ func (r *LocalRouter) StartParticipantSignal(roomName, identity, metadata string
} }
// index channels by roomName | identity // index channels by roomName | identity
key := participantKey(roomName, identity) key := participantKey(roomName, pi.Identity)
reqChan := r.getOrCreateMessageChannel(r.requestChannels, key) reqChan := r.getOrCreateMessageChannel(r.requestChannels, key)
resChan := r.getOrCreateMessageChannel(r.responseChannels, key) resChan := r.getOrCreateMessageChannel(r.responseChannels, key)
r.onNewParticipant( r.onNewParticipant(
roomName, roomName,
identity, pi,
metadata,
reconnect,
// request source // request source
reqChan, reqChan,
// response sink // response sink
resChan, resChan,
) )
return identity, reqChan, resChan, nil return pi.Identity, reqChan, resChan, nil
} }
func (r *LocalRouter) CreateRTCSink(roomName, identity string) (MessageSink, error) { func (r *LocalRouter) CreateRTCSink(roomName, identity string) (MessageSink, error) {
+14 -8
View File
@@ -129,7 +129,7 @@ func (r *RedisRouter) ListNodes() ([]*livekit.Node, error) {
} }
// signal connection sets up paths to the RTC node, and starts to route messages to that message queue // signal connection sets up paths to the RTC node, and starts to route messages to that message queue
func (r *RedisRouter) StartParticipantSignal(roomName, identity, metadata string, reconnect bool) (connectionId string, reqSink MessageSink, resSource MessageSource, err error) { func (r *RedisRouter) StartParticipantSignal(roomName string, pi ParticipantInit) (connectionId string, reqSink MessageSink, resSource MessageSource, err error) {
// find the node where the room is hosted at // find the node where the room is hosted at
rtcNode, err := r.GetNodeForRoom(roomName) rtcNode, err := r.GetNodeForRoom(roomName)
if err != nil { if err != nil {
@@ -138,7 +138,7 @@ func (r *RedisRouter) StartParticipantSignal(roomName, identity, metadata string
// create a new connection id // create a new connection id
connectionId = utils.NewGuid("CO_") connectionId = utils.NewGuid("CO_")
pKey := participantKey(roomName, identity) pKey := participantKey(roomName, pi.Identity)
// map signal & rtc nodes // map signal & rtc nodes
if err = r.setParticipantSignalNode(connectionId, r.currentNode.Id); err != nil { if err = r.setParticipantSignalNode(connectionId, r.currentNode.Id); err != nil {
@@ -150,11 +150,12 @@ func (r *RedisRouter) StartParticipantSignal(roomName, identity, metadata string
// sends a message to start session // sends a message to start session
err = sink.WriteMessage(&livekit.StartSession{ err = sink.WriteMessage(&livekit.StartSession{
RoomName: roomName, RoomName: roomName,
Identity: identity, Identity: pi.Identity,
Metadata: metadata, Metadata: pi.Metadata,
// connection id is to allow the RTC node to identify where to route the message back to // connection id is to allow the RTC node to identify where to route the message back to
ConnectionId: connectionId, ConnectionId: connectionId,
Reconnect: reconnect, Reconnect: pi.Reconnect,
Permission: pi.Permission,
}) })
if err != nil { if err != nil {
return return
@@ -215,13 +216,18 @@ func (r *RedisRouter) startParticipantRTC(ss *livekit.StartSession, participantK
} }
} }
pi := ParticipantInit{
Identity: ss.Identity,
Metadata: ss.Metadata,
Reconnect: ss.Reconnect,
Permission: ss.Permission,
}
reqChan := r.getOrCreateMessageChannel(r.requestChannels, participantKey) reqChan := r.getOrCreateMessageChannel(r.requestChannels, participantKey)
resSink := NewSignalNodeSink(r.rc, signalNode, ss.ConnectionId) resSink := NewSignalNodeSink(r.rc, signalNode, ss.ConnectionId)
r.onNewParticipant( r.onNewParticipant(
ss.RoomName, ss.RoomName,
ss.Identity, pi,
ss.Metadata,
ss.Reconnect,
reqChan, reqChan,
resSink, resSink,
) )
+10 -14
View File
@@ -124,13 +124,11 @@ type FakeRouter struct {
startReturnsOnCall map[int]struct { startReturnsOnCall map[int]struct {
result1 error result1 error
} }
StartParticipantSignalStub func(string, string, string, bool) (string, routing.MessageSink, routing.MessageSource, error) StartParticipantSignalStub func(string, routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error)
startParticipantSignalMutex sync.RWMutex startParticipantSignalMutex sync.RWMutex
startParticipantSignalArgsForCall []struct { startParticipantSignalArgsForCall []struct {
arg1 string arg1 string
arg2 string arg2 routing.ParticipantInit
arg3 string
arg4 bool
} }
startParticipantSignalReturns struct { startParticipantSignalReturns struct {
result1 string result1 string
@@ -757,21 +755,19 @@ func (fake *FakeRouter) StartReturnsOnCall(i int, result1 error) {
}{result1} }{result1}
} }
func (fake *FakeRouter) StartParticipantSignal(arg1 string, arg2 string, arg3 string, arg4 bool) (string, routing.MessageSink, routing.MessageSource, error) { func (fake *FakeRouter) StartParticipantSignal(arg1 string, arg2 routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error) {
fake.startParticipantSignalMutex.Lock() fake.startParticipantSignalMutex.Lock()
ret, specificReturn := fake.startParticipantSignalReturnsOnCall[len(fake.startParticipantSignalArgsForCall)] ret, specificReturn := fake.startParticipantSignalReturnsOnCall[len(fake.startParticipantSignalArgsForCall)]
fake.startParticipantSignalArgsForCall = append(fake.startParticipantSignalArgsForCall, struct { fake.startParticipantSignalArgsForCall = append(fake.startParticipantSignalArgsForCall, struct {
arg1 string arg1 string
arg2 string arg2 routing.ParticipantInit
arg3 string }{arg1, arg2})
arg4 bool
}{arg1, arg2, arg3, arg4})
stub := fake.StartParticipantSignalStub stub := fake.StartParticipantSignalStub
fakeReturns := fake.startParticipantSignalReturns fakeReturns := fake.startParticipantSignalReturns
fake.recordInvocation("StartParticipantSignal", []interface{}{arg1, arg2, arg3, arg4}) fake.recordInvocation("StartParticipantSignal", []interface{}{arg1, arg2})
fake.startParticipantSignalMutex.Unlock() fake.startParticipantSignalMutex.Unlock()
if stub != nil { if stub != nil {
return stub(arg1, arg2, arg3, arg4) return stub(arg1, arg2)
} }
if specificReturn { if specificReturn {
return ret.result1, ret.result2, ret.result3, ret.result4 return ret.result1, ret.result2, ret.result3, ret.result4
@@ -785,17 +781,17 @@ func (fake *FakeRouter) StartParticipantSignalCallCount() int {
return len(fake.startParticipantSignalArgsForCall) return len(fake.startParticipantSignalArgsForCall)
} }
func (fake *FakeRouter) StartParticipantSignalCalls(stub func(string, string, string, bool) (string, routing.MessageSink, routing.MessageSource, error)) { func (fake *FakeRouter) StartParticipantSignalCalls(stub func(string, routing.ParticipantInit) (string, routing.MessageSink, routing.MessageSource, error)) {
fake.startParticipantSignalMutex.Lock() fake.startParticipantSignalMutex.Lock()
defer fake.startParticipantSignalMutex.Unlock() defer fake.startParticipantSignalMutex.Unlock()
fake.StartParticipantSignalStub = stub fake.StartParticipantSignalStub = stub
} }
func (fake *FakeRouter) StartParticipantSignalArgsForCall(i int) (string, string, string, bool) { func (fake *FakeRouter) StartParticipantSignalArgsForCall(i int) (string, routing.ParticipantInit) {
fake.startParticipantSignalMutex.RLock() fake.startParticipantSignalMutex.RLock()
defer fake.startParticipantSignalMutex.RUnlock() defer fake.startParticipantSignalMutex.RUnlock()
argsForCall := fake.startParticipantSignalArgsForCall[i] argsForCall := fake.startParticipantSignalArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 return argsForCall.arg1, argsForCall.arg2
} }
func (fake *FakeRouter) StartParticipantSignalReturns(result1 string, result2 routing.MessageSink, result3 routing.MessageSource, result4 error) { func (fake *FakeRouter) StartParticipantSignalReturns(result1 string, result2 routing.MessageSink, result3 routing.MessageSource, result4 error) {
+41 -9
View File
@@ -38,9 +38,10 @@ type ParticipantImpl struct {
conf *WebRTCConfig conf *WebRTCConfig
identity string identity string
// JSON encoded metadata to pass to clients // JSON encoded metadata to pass to clients
metadata string metadata string
state atomic.Value // livekit.ParticipantInfo_State permission *livekit.ParticipantPermission
rtcpCh chan []rtcp.Packet state atomic.Value // livekit.ParticipantInfo_State
rtcpCh chan []rtcp.Packet
// hold reference for MediaTrack // hold reference for MediaTrack
twcc *twcc.Responder twcc *twcc.Responder
@@ -59,6 +60,7 @@ type ParticipantImpl struct {
onTrackPublished func(types.Participant, types.PublishedTrack) onTrackPublished func(types.Participant, types.PublishedTrack)
onTrackUpdated func(types.Participant, types.PublishedTrack) onTrackUpdated func(types.Participant, types.PublishedTrack)
onStateChange func(p types.Participant, oldState livekit.ParticipantInfo_State) onStateChange func(p types.Participant, oldState livekit.ParticipantInfo_State)
onMetadataUpdate func(types.Participant)
onClose func(types.Participant) onClose func(types.Participant)
} }
@@ -140,18 +142,24 @@ func (p *ParticipantImpl) IsReady() bool {
func (p *ParticipantImpl) SetMetadata(metadata map[string]interface{}) error { func (p *ParticipantImpl) SetMetadata(metadata map[string]interface{}) error {
if metadata == nil { if metadata == nil {
p.metadata = "" p.metadata = ""
return nil
}
if data, err := json.Marshal(metadata); err != nil {
return err
} else { } else {
p.metadata = string(data) if data, err := json.Marshal(metadata); err != nil {
return err
} else {
p.metadata = string(data)
}
} }
if p.onMetadataUpdate != nil {
p.onMetadataUpdate(p)
}
return nil return nil
} }
func (p *ParticipantImpl) SetPermission(permission *livekit.ParticipantPermission) {
p.permission = permission
}
func (p *ParticipantImpl) RTCPChan() chan []rtcp.Packet { func (p *ParticipantImpl) RTCPChan() chan []rtcp.Packet {
return p.rtcpCh return p.rtcpCh
} }
@@ -197,6 +205,10 @@ func (p *ParticipantImpl) OnTrackUpdated(callback func(types.Participant, types.
p.onTrackUpdated = callback p.onTrackUpdated = callback
} }
func (p *ParticipantImpl) OnMetadataUpdate(callback func(types.Participant)) {
p.onMetadataUpdate = callback
}
func (p *ParticipantImpl) OnClose(callback func(types.Participant)) { func (p *ParticipantImpl) OnClose(callback func(types.Participant)) {
p.onClose = callback p.onClose = callback
} }
@@ -459,6 +471,14 @@ func (p *ParticipantImpl) GetAudioLevel() (level uint8, noisy bool) {
return return
} }
func (p *ParticipantImpl) CanPublish() bool {
return p.permission == nil || p.permission.CanPublish
}
func (p *ParticipantImpl) CanSubscribe() bool {
return p.permission == nil || p.permission.CanSubscribe
}
func (p *ParticipantImpl) SubscriberPC() *webrtc.PeerConnection { func (p *ParticipantImpl) SubscriberPC() *webrtc.PeerConnection {
return p.subscriber.pc return p.subscriber.pc
} }
@@ -580,6 +600,12 @@ func (p *ParticipantImpl) onMediaTrack(track *webrtc.TrackRemote, rtpReceiver *w
"remoteTrack", track.ID(), "remoteTrack", track.ID(),
"rid", track.RID()) "rid", track.RID())
if !p.CanPublish() {
logger.Warnw("no permission to publish mediaTrack",
"participant", p.Identity())
return
}
// delete pending track if it's not simulcasting // delete pending track if it's not simulcasting
ti := p.getPendingTrack(track.ID(), ToProtoTrackKind(track.Kind()), track.RID() == "") ti := p.getPendingTrack(track.ID(), ToProtoTrackKind(track.Kind()), track.RID() == "")
if ti == nil { if ti == nil {
@@ -620,6 +646,12 @@ func (p *ParticipantImpl) onDataChannel(dc *webrtc.DataChannel) {
} }
logger.Debugw("dataChannel added", "participant", p.Identity(), "label", dc.Label()) logger.Debugw("dataChannel added", "participant", p.Identity(), "label", dc.Label())
if !p.CanPublish() {
logger.Warnw("no permission to publish dataTrack",
"participant", p.Identity())
return
}
// data channels have numeric ids, so we use its label to identify // data channels have numeric ids, so we use its label to identify
ti := p.getPendingTrack(dc.Label(), livekit.TrackType_DATA, true) ti := p.getPendingTrack(dc.Label(), livekit.TrackType_DATA, true)
if ti == nil { if ti == nil {
+15 -7
View File
@@ -137,7 +137,7 @@ func (r *Room) Join(participant types.Participant) error {
if r.onParticipantChanged != nil { if r.onParticipantChanged != nil {
r.onParticipantChanged(participant) r.onParticipantChanged(participant)
} }
r.broadcastParticipantState(p) r.broadcastParticipantState(p, true)
if p.State() == livekit.ParticipantInfo_ACTIVE { if p.State() == livekit.ParticipantInfo_ACTIVE {
// subscribe participant to existing publishedTracks // subscribe participant to existing publishedTracks
@@ -161,7 +161,7 @@ func (r *Room) Join(participant types.Participant) error {
} }
}) })
participant.OnTrackUpdated(r.onTrackUpdated) participant.OnTrackUpdated(r.onTrackUpdated)
participant.OnMetadataUpdate(r.onParticipantMetadataUpdate)
logger.Infow("new participant joined", logger.Infow("new participant joined",
"id", participant.ID(), "id", participant.ID(),
"identity", participant.Identity(), "identity", participant.Identity(),
@@ -213,7 +213,7 @@ func (r *Room) RemoveParticipant(identity string) {
if r.onParticipantChanged != nil { if r.onParticipantChanged != nil {
r.onParticipantChanged(p) r.onParticipantChanged(p)
} }
r.broadcastParticipantState(p) r.broadcastParticipantState(p, true)
} }
} }
@@ -288,7 +288,7 @@ func (r *Room) OnParticipantChanged(f func(participant types.Participant)) {
// a ParticipantImpl in the room added a new remoteTrack, subscribe other participants to it // a ParticipantImpl in the room added a new remoteTrack, subscribe other participants to it
func (r *Room) onTrackAdded(participant types.Participant, track types.PublishedTrack) { func (r *Room) onTrackAdded(participant types.Participant, track types.PublishedTrack) {
// publish participant update, since track state is changed // publish participant update, since track state is changed
r.broadcastParticipantState(participant) r.broadcastParticipantState(participant, true)
r.lock.RLock() r.lock.RLock()
defer r.lock.RUnlock() defer r.lock.RUnlock()
@@ -322,19 +322,27 @@ func (r *Room) onTrackAdded(participant types.Participant, track types.Published
} }
func (r *Room) onTrackUpdated(p types.Participant, track types.PublishedTrack) { func (r *Room) onTrackUpdated(p types.Participant, track types.PublishedTrack) {
r.broadcastParticipantState(p) // send track updates to everyone, especially if track was updated by admin
r.broadcastParticipantState(p, false)
if r.onParticipantChanged != nil {
r.onParticipantChanged(p)
}
}
func (r *Room) onParticipantMetadataUpdate(p types.Participant) {
r.broadcastParticipantState(p, false)
if r.onParticipantChanged != nil { if r.onParticipantChanged != nil {
r.onParticipantChanged(p) r.onParticipantChanged(p)
} }
} }
// broadcast an update about participant p // broadcast an update about participant p
func (r *Room) broadcastParticipantState(p types.Participant) { func (r *Room) broadcastParticipantState(p types.Participant, skipSource bool) {
updates := ToProtoParticipants([]types.Participant{p}) updates := ToProtoParticipants([]types.Participant{p})
participants := r.GetParticipants() participants := r.GetParticipants()
for _, op := range participants { for _, op := range participants {
// skip itself && closed participants // skip itself && closed participants
if p.ID() == op.ID() || op.State() == livekit.ParticipantInfo_DISCONNECTED { if (skipSource && p.ID() == op.ID()) || op.State() == livekit.ParticipantInfo_DISCONNECTED {
continue continue
} }
+6
View File
@@ -29,6 +29,7 @@ type Participant interface {
ToProto() *livekit.ParticipantInfo ToProto() *livekit.ParticipantInfo
RTCPChan() chan []rtcp.Packet RTCPChan() chan []rtcp.Packet
SetMetadata(metadata map[string]interface{}) error SetMetadata(metadata map[string]interface{}) error
SetPermission(permission *livekit.ParticipantPermission)
GetResponseSink() routing.MessageSink GetResponseSink() routing.MessageSink
SetResponseSink(sink routing.MessageSink) SetResponseSink(sink routing.MessageSink)
SubscriberMediaEngine() *webrtc.MediaEngine SubscriberMediaEngine() *webrtc.MediaEngine
@@ -47,6 +48,10 @@ type Participant interface {
SetTrackMuted(trackId string, muted bool) SetTrackMuted(trackId string, muted bool)
GetAudioLevel() (level uint8, noisy bool) GetAudioLevel() (level uint8, noisy bool)
// permissions
CanPublish() bool
CanSubscribe() bool
Start() Start()
Close() error Close() error
@@ -56,6 +61,7 @@ type Participant interface {
OnTrackPublished(func(Participant, PublishedTrack)) OnTrackPublished(func(Participant, PublishedTrack))
// OnTrackUpdated - one of its publishedTracks changed in status // OnTrackUpdated - one of its publishedTracks changed in status
OnTrackUpdated(callback func(Participant, PublishedTrack)) OnTrackUpdated(callback func(Participant, PublishedTrack))
OnMetadataUpdate(callback func(Participant))
OnClose(func(Participant)) OnClose(func(Participant))
// package methods // package methods
@@ -48,6 +48,26 @@ type FakeParticipant struct {
arg2 string arg2 string
arg3 livekit.TrackType arg3 livekit.TrackType
} }
CanPublishStub func() bool
canPublishMutex sync.RWMutex
canPublishArgsForCall []struct {
}
canPublishReturns struct {
result1 bool
}
canPublishReturnsOnCall map[int]struct {
result1 bool
}
CanSubscribeStub func() bool
canSubscribeMutex sync.RWMutex
canSubscribeArgsForCall []struct {
}
canSubscribeReturns struct {
result1 bool
}
canSubscribeReturnsOnCall map[int]struct {
result1 bool
}
CloseStub func() error CloseStub func() error
closeMutex sync.RWMutex closeMutex sync.RWMutex
closeArgsForCall []struct { closeArgsForCall []struct {
@@ -159,6 +179,11 @@ type FakeParticipant struct {
onCloseArgsForCall []struct { onCloseArgsForCall []struct {
arg1 func(types.Participant) arg1 func(types.Participant)
} }
OnMetadataUpdateStub func(func(types.Participant))
onMetadataUpdateMutex sync.RWMutex
onMetadataUpdateArgsForCall []struct {
arg1 func(types.Participant)
}
OnStateChangeStub func(func(p types.Participant, oldState livekit.ParticipantInfo_State)) OnStateChangeStub func(func(p types.Participant, oldState livekit.ParticipantInfo_State))
onStateChangeMutex sync.RWMutex onStateChangeMutex sync.RWMutex
onStateChangeArgsForCall []struct { onStateChangeArgsForCall []struct {
@@ -241,6 +266,11 @@ type FakeParticipant struct {
setMetadataReturnsOnCall map[int]struct { setMetadataReturnsOnCall map[int]struct {
result1 error result1 error
} }
SetPermissionStub func(*livekit.ParticipantPermission)
setPermissionMutex sync.RWMutex
setPermissionArgsForCall []struct {
arg1 *livekit.ParticipantPermission
}
SetResponseSinkStub func(routing.MessageSink) SetResponseSinkStub func(routing.MessageSink)
setResponseSinkMutex sync.RWMutex setResponseSinkMutex sync.RWMutex
setResponseSinkArgsForCall []struct { setResponseSinkArgsForCall []struct {
@@ -490,6 +520,112 @@ func (fake *FakeParticipant) AddTrackArgsForCall(i int) (string, string, livekit
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
} }
func (fake *FakeParticipant) CanPublish() bool {
fake.canPublishMutex.Lock()
ret, specificReturn := fake.canPublishReturnsOnCall[len(fake.canPublishArgsForCall)]
fake.canPublishArgsForCall = append(fake.canPublishArgsForCall, struct {
}{})
stub := fake.CanPublishStub
fakeReturns := fake.canPublishReturns
fake.recordInvocation("CanPublish", []interface{}{})
fake.canPublishMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeParticipant) CanPublishCallCount() int {
fake.canPublishMutex.RLock()
defer fake.canPublishMutex.RUnlock()
return len(fake.canPublishArgsForCall)
}
func (fake *FakeParticipant) CanPublishCalls(stub func() bool) {
fake.canPublishMutex.Lock()
defer fake.canPublishMutex.Unlock()
fake.CanPublishStub = stub
}
func (fake *FakeParticipant) CanPublishReturns(result1 bool) {
fake.canPublishMutex.Lock()
defer fake.canPublishMutex.Unlock()
fake.CanPublishStub = nil
fake.canPublishReturns = struct {
result1 bool
}{result1}
}
func (fake *FakeParticipant) CanPublishReturnsOnCall(i int, result1 bool) {
fake.canPublishMutex.Lock()
defer fake.canPublishMutex.Unlock()
fake.CanPublishStub = nil
if fake.canPublishReturnsOnCall == nil {
fake.canPublishReturnsOnCall = make(map[int]struct {
result1 bool
})
}
fake.canPublishReturnsOnCall[i] = struct {
result1 bool
}{result1}
}
func (fake *FakeParticipant) CanSubscribe() bool {
fake.canSubscribeMutex.Lock()
ret, specificReturn := fake.canSubscribeReturnsOnCall[len(fake.canSubscribeArgsForCall)]
fake.canSubscribeArgsForCall = append(fake.canSubscribeArgsForCall, struct {
}{})
stub := fake.CanSubscribeStub
fakeReturns := fake.canSubscribeReturns
fake.recordInvocation("CanSubscribe", []interface{}{})
fake.canSubscribeMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeParticipant) CanSubscribeCallCount() int {
fake.canSubscribeMutex.RLock()
defer fake.canSubscribeMutex.RUnlock()
return len(fake.canSubscribeArgsForCall)
}
func (fake *FakeParticipant) CanSubscribeCalls(stub func() bool) {
fake.canSubscribeMutex.Lock()
defer fake.canSubscribeMutex.Unlock()
fake.CanSubscribeStub = stub
}
func (fake *FakeParticipant) CanSubscribeReturns(result1 bool) {
fake.canSubscribeMutex.Lock()
defer fake.canSubscribeMutex.Unlock()
fake.CanSubscribeStub = nil
fake.canSubscribeReturns = struct {
result1 bool
}{result1}
}
func (fake *FakeParticipant) CanSubscribeReturnsOnCall(i int, result1 bool) {
fake.canSubscribeMutex.Lock()
defer fake.canSubscribeMutex.Unlock()
fake.CanSubscribeStub = nil
if fake.canSubscribeReturnsOnCall == nil {
fake.canSubscribeReturnsOnCall = make(map[int]struct {
result1 bool
})
}
fake.canSubscribeReturnsOnCall[i] = struct {
result1 bool
}{result1}
}
func (fake *FakeParticipant) Close() error { func (fake *FakeParticipant) Close() error {
fake.closeMutex.Lock() fake.closeMutex.Lock()
ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)] ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)]
@@ -1074,6 +1210,38 @@ func (fake *FakeParticipant) OnCloseArgsForCall(i int) func(types.Participant) {
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeParticipant) OnMetadataUpdate(arg1 func(types.Participant)) {
fake.onMetadataUpdateMutex.Lock()
fake.onMetadataUpdateArgsForCall = append(fake.onMetadataUpdateArgsForCall, struct {
arg1 func(types.Participant)
}{arg1})
stub := fake.OnMetadataUpdateStub
fake.recordInvocation("OnMetadataUpdate", []interface{}{arg1})
fake.onMetadataUpdateMutex.Unlock()
if stub != nil {
fake.OnMetadataUpdateStub(arg1)
}
}
func (fake *FakeParticipant) OnMetadataUpdateCallCount() int {
fake.onMetadataUpdateMutex.RLock()
defer fake.onMetadataUpdateMutex.RUnlock()
return len(fake.onMetadataUpdateArgsForCall)
}
func (fake *FakeParticipant) OnMetadataUpdateCalls(stub func(func(types.Participant))) {
fake.onMetadataUpdateMutex.Lock()
defer fake.onMetadataUpdateMutex.Unlock()
fake.OnMetadataUpdateStub = stub
}
func (fake *FakeParticipant) OnMetadataUpdateArgsForCall(i int) func(types.Participant) {
fake.onMetadataUpdateMutex.RLock()
defer fake.onMetadataUpdateMutex.RUnlock()
argsForCall := fake.onMetadataUpdateArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeParticipant) OnStateChange(arg1 func(p types.Participant, oldState livekit.ParticipantInfo_State)) { func (fake *FakeParticipant) OnStateChange(arg1 func(p types.Participant, oldState livekit.ParticipantInfo_State)) {
fake.onStateChangeMutex.Lock() fake.onStateChangeMutex.Lock()
fake.onStateChangeArgsForCall = append(fake.onStateChangeArgsForCall, struct { fake.onStateChangeArgsForCall = append(fake.onStateChangeArgsForCall, struct {
@@ -1554,6 +1722,38 @@ func (fake *FakeParticipant) SetMetadataReturnsOnCall(i int, result1 error) {
}{result1} }{result1}
} }
func (fake *FakeParticipant) SetPermission(arg1 *livekit.ParticipantPermission) {
fake.setPermissionMutex.Lock()
fake.setPermissionArgsForCall = append(fake.setPermissionArgsForCall, struct {
arg1 *livekit.ParticipantPermission
}{arg1})
stub := fake.SetPermissionStub
fake.recordInvocation("SetPermission", []interface{}{arg1})
fake.setPermissionMutex.Unlock()
if stub != nil {
fake.SetPermissionStub(arg1)
}
}
func (fake *FakeParticipant) SetPermissionCallCount() int {
fake.setPermissionMutex.RLock()
defer fake.setPermissionMutex.RUnlock()
return len(fake.setPermissionArgsForCall)
}
func (fake *FakeParticipant) SetPermissionCalls(stub func(*livekit.ParticipantPermission)) {
fake.setPermissionMutex.Lock()
defer fake.setPermissionMutex.Unlock()
fake.SetPermissionStub = stub
}
func (fake *FakeParticipant) SetPermissionArgsForCall(i int) *livekit.ParticipantPermission {
fake.setPermissionMutex.RLock()
defer fake.setPermissionMutex.RUnlock()
argsForCall := fake.setPermissionArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeParticipant) SetResponseSink(arg1 routing.MessageSink) { func (fake *FakeParticipant) SetResponseSink(arg1 routing.MessageSink) {
fake.setResponseSinkMutex.Lock() fake.setResponseSinkMutex.Lock()
fake.setResponseSinkArgsForCall = append(fake.setResponseSinkArgsForCall, struct { fake.setResponseSinkArgsForCall = append(fake.setResponseSinkArgsForCall, struct {
@@ -1866,6 +2066,10 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
defer fake.addSubscriberMutex.RUnlock() defer fake.addSubscriberMutex.RUnlock()
fake.addTrackMutex.RLock() fake.addTrackMutex.RLock()
defer fake.addTrackMutex.RUnlock() defer fake.addTrackMutex.RUnlock()
fake.canPublishMutex.RLock()
defer fake.canPublishMutex.RUnlock()
fake.canSubscribeMutex.RLock()
defer fake.canSubscribeMutex.RUnlock()
fake.closeMutex.RLock() fake.closeMutex.RLock()
defer fake.closeMutex.RUnlock() defer fake.closeMutex.RUnlock()
fake.getAudioLevelMutex.RLock() fake.getAudioLevelMutex.RLock()
@@ -1888,6 +2092,8 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
defer fake.isReadyMutex.RUnlock() defer fake.isReadyMutex.RUnlock()
fake.onCloseMutex.RLock() fake.onCloseMutex.RLock()
defer fake.onCloseMutex.RUnlock() defer fake.onCloseMutex.RUnlock()
fake.onMetadataUpdateMutex.RLock()
defer fake.onMetadataUpdateMutex.RUnlock()
fake.onStateChangeMutex.RLock() fake.onStateChangeMutex.RLock()
defer fake.onStateChangeMutex.RUnlock() defer fake.onStateChangeMutex.RUnlock()
fake.onTrackPublishedMutex.RLock() fake.onTrackPublishedMutex.RLock()
@@ -1908,6 +2114,8 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
defer fake.sendParticipantUpdateMutex.RUnlock() defer fake.sendParticipantUpdateMutex.RUnlock()
fake.setMetadataMutex.RLock() fake.setMetadataMutex.RLock()
defer fake.setMetadataMutex.RUnlock() defer fake.setMetadataMutex.RUnlock()
fake.setPermissionMutex.RLock()
defer fake.setPermissionMutex.RUnlock()
fake.setResponseSinkMutex.RLock() fake.setResponseSinkMutex.RLock()
defer fake.setResponseSinkMutex.RUnlock() defer fake.setResponseSinkMutex.RUnlock()
fake.setTrackMutedMutex.RLock() fake.setTrackMutedMutex.RLock()
+29 -9
View File
@@ -172,22 +172,22 @@ func (r *RoomManager) CloseIdleRooms() {
} }
// starts WebRTC session when a new participant is connected, takes place on RTC node // starts WebRTC session when a new participant is connected, takes place on RTC node
func (r *RoomManager) StartSession(roomName, identity, metadata string, reconnect bool, requestSource routing.MessageSource, responseSink routing.MessageSink) { func (r *RoomManager) StartSession(roomName string, pi routing.ParticipantInit, requestSource routing.MessageSource, responseSink routing.MessageSink) {
room, err := r.getOrCreateRoom(roomName) room, err := r.getOrCreateRoom(roomName)
if err != nil { if err != nil {
logger.Errorw("could not create room", "error", err) logger.Errorw("could not create room", "error", err)
return return
} }
participant := room.GetParticipant(identity) participant := room.GetParticipant(pi.Identity)
if participant != nil { if participant != nil {
// When reconnecting, it means WS has interrupted by underlying peer connection is still ok // When reconnecting, it means WS has interrupted by underlying peer connection is still ok
// in this mode, we'll keep the participant SID, and just swap the sink for the underlying connection // in this mode, we'll keep the participant SID, and just swap the sink for the underlying connection
if reconnect { if pi.Reconnect {
logger.Debugw("resuming RTC session", logger.Debugw("resuming RTC session",
"room", roomName, "room", roomName,
"node", r.currentNode.Id, "node", r.currentNode.Id,
"participant", identity, "participant", pi.Identity,
) )
// close previous sink, and link to new one // close previous sink, and link to new one
prevSink := participant.GetResponseSink() prevSink := participant.GetResponseSink()
@@ -206,22 +206,26 @@ func (r *RoomManager) StartSession(roomName, identity, metadata string, reconnec
logger.Debugw("starting RTC session", logger.Debugw("starting RTC session",
"room", roomName, "room", roomName,
"node", r.currentNode.Id, "node", r.currentNode.Id,
"participant", identity, "participant", pi.Identity,
"num_participants", len(room.GetParticipants()), "num_participants", len(room.GetParticipants()),
) )
participant, err = rtc.NewParticipant(identity, r.rtcConfig, responseSink, r.config.Audio) participant, err = rtc.NewParticipant(pi.Identity, r.rtcConfig, responseSink, r.config.Audio)
if err != nil { if err != nil {
logger.Errorw("could not create participant", "error", err) logger.Errorw("could not create participant", "error", err)
return return
} }
if metadata != "" { if pi.Metadata != "" {
var md map[string]interface{} var md map[string]interface{}
if err := json.Unmarshal([]byte(metadata), &md); err == nil { if err := json.Unmarshal([]byte(pi.Metadata), &md); err == nil {
participant.SetMetadata(md) participant.SetMetadata(md)
} }
} }
if pi.Permission != nil {
participant.SetPermission(pi.Permission)
}
// join room // join room
if err := room.Join(participant); err != nil { if err := room.Join(participant); err != nil {
logger.Errorw("could not join room", "error", err) logger.Errorw("could not join room", "error", err)
@@ -334,7 +338,13 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.Partici
case *livekit.SignalRequest_Mute: case *livekit.SignalRequest_Mute:
participant.SetTrackMuted(msg.Mute.Sid, msg.Mute.Muted) participant.SetTrackMuted(msg.Mute.Sid, msg.Mute.Muted)
case *livekit.SignalRequest_Subscription: case *livekit.SignalRequest_Subscription:
room.UpdateSubscriptions(participant, msg.Subscription) if participant.CanSubscribe() {
room.UpdateSubscriptions(participant, msg.Subscription)
} else {
logger.Warnw("rejected participant subscription",
"participant", participant.Identity(),
"tracks", msg.Subscription.TrackSids)
}
case *livekit.SignalRequest_TrackSetting: case *livekit.SignalRequest_TrackSetting:
for _, subTrack := range participant.GetSubscribedTracks() { for _, subTrack := range participant.GetSubscribedTracks() {
for _, sid := range msg.TrackSetting.TrackSids { for _, sid := range msg.TrackSetting.TrackSids {
@@ -373,6 +383,16 @@ func (r *RoomManager) handleRTCMessage(roomName, identity string, msg *livekit.R
logger.Debugw("setting track muted", "room", roomName, "participant", identity, logger.Debugw("setting track muted", "room", roomName, "participant", identity,
"track", rm.MuteTrack.TrackSid, "muted", rm.MuteTrack.Muted) "track", rm.MuteTrack.TrackSid, "muted", rm.MuteTrack.Muted)
participant.SetTrackMuted(rm.MuteTrack.TrackSid, rm.MuteTrack.Muted) participant.SetTrackMuted(rm.MuteTrack.TrackSid, rm.MuteTrack.Muted)
case *livekit.RTCNodeMessage_UpdateMetadata:
logger.Debugw("updating metadata", "room", roomName, "participant", identity)
var md map[string]interface{}
if rm.UpdateMetadata.Metadata != "" {
if err := json.Unmarshal([]byte(rm.UpdateMetadata.Metadata), &md); err != nil {
logger.Errorw("could not update metadata", "error", err)
return
}
}
participant.SetMetadata(md)
} }
} }
+52 -26
View File
@@ -7,6 +7,7 @@ import (
"github.com/thoas/go-funk" "github.com/thoas/go-funk"
"github.com/twitchtv/twirp" "github.com/twitchtv/twirp"
"github.com/livekit/livekit-server/pkg/routing"
livekit "github.com/livekit/livekit-server/proto" livekit "github.com/livekit/livekit-server/proto"
) )
@@ -97,16 +98,8 @@ func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParti
} }
func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.RemoveParticipantResponse, err error) { func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.RemoveParticipantResponse, err error) {
if err = EnsureAdminPermission(ctx, req.Room); err != nil { rtcSink, err := s.createRTCSink(ctx, req.Room, req.Identity)
return nil, twirpAuthError(err)
}
participant, err := s.roomManager.roomStore.GetParticipant(req.Room, req.Identity)
if err != nil {
return
}
rtcSink, err := s.roomManager.router.CreateRTCSink(req.Room, participant.Identity)
if err != nil { if err != nil {
return return
} }
@@ -122,30 +115,16 @@ func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomPa
} }
func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (res *livekit.MuteRoomTrackResponse, err error) { func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (res *livekit.MuteRoomTrackResponse, err error) {
if err = EnsureAdminPermission(ctx, req.Room); err != nil { rtcSink, err := s.createRTCSink(ctx, req.Room, req.Identity)
return nil, twirpAuthError(err)
}
participant, err := s.roomManager.roomStore.GetParticipant(req.Room, req.Identity)
if err != nil {
return
}
rtcSink, err := s.roomManager.router.CreateRTCSink(req.Room, participant.Identity)
if err != nil { if err != nil {
return return
} }
defer rtcSink.Close() defer rtcSink.Close()
err = rtcSink.WriteMessage(&livekit.RTCNodeMessage{
Message: &livekit.RTCNodeMessage_MuteTrack{
MuteTrack: req,
},
})
participant, err := s.roomManager.roomStore.GetParticipant(req.Room, req.Identity)
if err != nil { if err != nil {
return return nil, err
} }
// find the track // find the track
track := funk.Find(participant.Tracks, func(t *livekit.TrackInfo) bool { track := funk.Find(participant.Tracks, func(t *livekit.TrackInfo) bool {
return t.Sid == req.TrackSid return t.Sid == req.TrackSid
@@ -153,8 +132,55 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
if track == nil { if track == nil {
return nil, twirp.NotFoundError(ErrTrackNotFound.Error()) return nil, twirp.NotFoundError(ErrTrackNotFound.Error())
} }
err = rtcSink.WriteMessage(&livekit.RTCNodeMessage{
Message: &livekit.RTCNodeMessage_MuteTrack{
MuteTrack: req,
},
})
if err != nil {
return
}
res = &livekit.MuteRoomTrackResponse{ res = &livekit.MuteRoomTrackResponse{
Track: track.(*livekit.TrackInfo), Track: track.(*livekit.TrackInfo),
} }
// mute might not have happened, reflect desired state
res.Track.Muted = req.Muted
return return
} }
func (s *RoomService) UpdateParticipantMetadata(ctx context.Context, req *livekit.UpdateParticipantMetadataRequest) (*livekit.ParticipantInfo, error) {
rtcSink, err := s.createRTCSink(ctx, req.Target.Room, req.Target.Identity)
if err != nil {
return nil, err
}
defer rtcSink.Close()
participant, err := s.roomManager.roomStore.GetParticipant(req.Target.Room, req.Target.Identity)
if err != nil {
return nil, err
}
err = rtcSink.WriteMessage(&livekit.RTCNodeMessage{
Message: &livekit.RTCNodeMessage_UpdateMetadata{
UpdateMetadata: req,
},
})
participant.Metadata = req.Metadata
return participant, nil
}
func (s *RoomService) createRTCSink(ctx context.Context, room, identity string) (routing.MessageSink, error) {
if err := EnsureAdminPermission(ctx, room); err != nil {
return nil, twirpAuthError(err)
}
_, err := s.roomManager.roomStore.GetParticipant(room, identity)
if err != nil {
return nil, err
}
return s.roomManager.router.CreateRTCSink(room, identity)
}
+23 -11
View File
@@ -56,14 +56,24 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
roomName := r.FormValue("room") roomName := r.FormValue("room")
reconnectParam := r.FormValue("reconnect") reconnectParam := r.FormValue("reconnect")
isReconnect := reconnectParam == "1" || reconnectParam == "true"
claims := GetGrants(r.Context()) claims := GetGrants(r.Context())
// require a claim // require a claim
if claims == nil || claims.Video == nil { if claims == nil || claims.Video == nil {
handleError(w, http.StatusUnauthorized, rtc.ErrPermissionDenied.Error()) handleError(w, http.StatusUnauthorized, rtc.ErrPermissionDenied.Error())
return return
} }
identity := claims.Identity pi := routing.ParticipantInit{
Reconnect: reconnectParam == "1" || reconnectParam == "true",
Identity: claims.Identity,
}
// only use permissions if any of them are set, default permissive
if claims.Video.CanPublish || claims.Video.CanSubscribe {
pi.Permission = &livekit.ParticipantPermission{
CanSubscribe: claims.Video.CanSubscribe,
CanPublish: claims.Video.CanPublish,
}
}
onlyName, err := EnsureJoinPermission(r.Context()) onlyName, err := EnsureJoinPermission(r.Context())
if err != nil { if err != nil {
@@ -81,17 +91,16 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
} }
var metadata string
if claims.Metadata != nil { if claims.Metadata != nil {
if data, err := json.Marshal(claims.Metadata); err != nil { if data, err := json.Marshal(claims.Metadata); err != nil {
logger.Warnw("unable to encode metadata", "error", err) logger.Warnw("unable to encode metadata", "error", err)
} else { } else {
metadata = string(data) pi.Metadata = string(data)
} }
} }
// this needs to be started first *before* using router functions on this node // this needs to be started first *before* using router functions on this node
connId, reqSink, resSource, err := s.router.StartParticipantSignal(roomName, identity, metadata, isReconnect) connId, reqSink, resSource, err := s.router.StartParticipantSignal(roomName, pi)
if err != nil { if err != nil {
handleError(w, http.StatusInternalServerError, "could not start session: "+err.Error()) handleError(w, http.StatusInternalServerError, "could not start session: "+err.Error())
return return
@@ -100,7 +109,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
done := make(chan bool, 1) done := make(chan bool, 1)
// function exits when websocket terminates, it'll close the event reading off of response sink as well // function exits when websocket terminates, it'll close the event reading off of response sink as well
defer func() { defer func() {
logger.Infow("WS connection closed", "participant", identity, "connectionId", connId) logger.Infow("WS connection closed", "participant", pi.Identity, "connectionId", connId)
reqSink.Close() reqSink.Close()
close(done) close(done)
}() }()
@@ -120,7 +129,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
"connectionId", connId, "connectionId", connId,
"room", rm.Sid, "room", rm.Sid,
"roomName", rm.Name, "roomName", rm.Name,
"name", identity, "name", pi.Identity,
) )
// handle responses // handle responses
@@ -137,7 +146,8 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
case msg := <-resSource.ReadChan(): case msg := <-resSource.ReadChan():
if msg == nil { if msg == nil {
logger.Infow("source closed connection", "participant", identity, logger.Infow("source closed connection",
"participant", pi.Identity,
"connectionId", connId) "connectionId", connId)
return return
} }
@@ -145,7 +155,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if !ok { if !ok {
logger.Errorw("unexpected message type", logger.Errorw("unexpected message type",
"type", fmt.Sprintf("%T", msg), "type", fmt.Sprintf("%T", msg),
"participant", identity, "participant", pi.Identity,
"connectionId", connId) "connectionId", connId)
continue continue
} }
@@ -172,8 +182,10 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} }
} }
if err := reqSink.WriteMessage(req); err != nil { if err := reqSink.WriteMessage(req); err != nil {
logger.Warnw("error writing to request sink", "error", err, logger.Warnw("error writing to request sink",
"participant", identity, "connectionId", connId) "error", err,
"participant", pi.Identity,
"connectionId", connId)
} }
} }
} }
+174 -64
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.25.0
// protoc v3.15.5 // protoc v3.15.6
// source: internal.proto // source: internal.proto
package livekit package livekit
@@ -197,6 +197,7 @@ type RTCNodeMessage struct {
// *RTCNodeMessage_Request // *RTCNodeMessage_Request
// *RTCNodeMessage_RemoveParticipant // *RTCNodeMessage_RemoveParticipant
// *RTCNodeMessage_MuteTrack // *RTCNodeMessage_MuteTrack
// *RTCNodeMessage_UpdateMetadata
Message isRTCNodeMessage_Message `protobuf_oneof:"message"` Message isRTCNodeMessage_Message `protobuf_oneof:"message"`
} }
@@ -274,6 +275,13 @@ func (x *RTCNodeMessage) GetMuteTrack() *MuteRoomTrackRequest {
return nil return nil
} }
func (x *RTCNodeMessage) GetUpdateMetadata() *UpdateParticipantMetadataRequest {
if x, ok := x.GetMessage().(*RTCNodeMessage_UpdateMetadata); ok {
return x.UpdateMetadata
}
return nil
}
type isRTCNodeMessage_Message interface { type isRTCNodeMessage_Message interface {
isRTCNodeMessage_Message() isRTCNodeMessage_Message()
} }
@@ -295,6 +303,10 @@ type RTCNodeMessage_MuteTrack struct {
MuteTrack *MuteRoomTrackRequest `protobuf:"bytes,5,opt,name=mute_track,json=muteTrack,proto3,oneof"` MuteTrack *MuteRoomTrackRequest `protobuf:"bytes,5,opt,name=mute_track,json=muteTrack,proto3,oneof"`
} }
type RTCNodeMessage_UpdateMetadata struct {
UpdateMetadata *UpdateParticipantMetadataRequest `protobuf:"bytes,6,opt,name=update_metadata,json=updateMetadata,proto3,oneof"`
}
func (*RTCNodeMessage_StartSession) isRTCNodeMessage_Message() {} func (*RTCNodeMessage_StartSession) isRTCNodeMessage_Message() {}
func (*RTCNodeMessage_Request) isRTCNodeMessage_Message() {} func (*RTCNodeMessage_Request) isRTCNodeMessage_Message() {}
@@ -303,6 +315,8 @@ func (*RTCNodeMessage_RemoveParticipant) isRTCNodeMessage_Message() {}
func (*RTCNodeMessage_MuteTrack) isRTCNodeMessage_Message() {} func (*RTCNodeMessage_MuteTrack) isRTCNodeMessage_Message() {}
func (*RTCNodeMessage_UpdateMetadata) isRTCNodeMessage_Message() {}
// message to Signal nodes // message to Signal nodes
type SignalNodeMessage struct { type SignalNodeMessage struct {
state protoimpl.MessageState state protoimpl.MessageState
@@ -403,7 +417,8 @@ type StartSession struct {
// if a client is reconnecting (i.e. resume instead of restart) // if a client is reconnecting (i.e. resume instead of restart)
Reconnect bool `protobuf:"varint,4,opt,name=reconnect,proto3" json:"reconnect,omitempty"` Reconnect bool `protobuf:"varint,4,opt,name=reconnect,proto3" json:"reconnect,omitempty"`
// metadata to pass to participant // metadata to pass to participant
Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
Permission *ParticipantPermission `protobuf:"bytes,6,opt,name=permission,proto3" json:"permission,omitempty"`
} }
func (x *StartSession) Reset() { func (x *StartSession) Reset() {
@@ -473,6 +488,68 @@ func (x *StartSession) GetMetadata() string {
return "" return ""
} }
func (x *StartSession) GetPermission() *ParticipantPermission {
if x != nil {
return x.Permission
}
return nil
}
type ParticipantPermission struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CanSubscribe bool `protobuf:"varint,1,opt,name=can_subscribe,json=canSubscribe,proto3" json:"can_subscribe,omitempty"`
CanPublish bool `protobuf:"varint,2,opt,name=can_publish,json=canPublish,proto3" json:"can_publish,omitempty"`
}
func (x *ParticipantPermission) Reset() {
*x = ParticipantPermission{}
if protoimpl.UnsafeEnabled {
mi := &file_internal_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ParticipantPermission) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ParticipantPermission) ProtoMessage() {}
func (x *ParticipantPermission) ProtoReflect() protoreflect.Message {
mi := &file_internal_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 ParticipantPermission.ProtoReflect.Descriptor instead.
func (*ParticipantPermission) Descriptor() ([]byte, []int) {
return file_internal_proto_rawDescGZIP(), []int{5}
}
func (x *ParticipantPermission) GetCanSubscribe() bool {
if x != nil {
return x.CanSubscribe
}
return false
}
func (x *ParticipantPermission) GetCanPublish() bool {
if x != nil {
return x.CanPublish
}
return false
}
type EndSession struct { type EndSession struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -482,7 +559,7 @@ type EndSession struct {
func (x *EndSession) Reset() { func (x *EndSession) Reset() {
*x = EndSession{} *x = EndSession{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_internal_proto_msgTypes[5] mi := &file_internal_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -495,7 +572,7 @@ func (x *EndSession) String() string {
func (*EndSession) ProtoMessage() {} func (*EndSession) ProtoMessage() {}
func (x *EndSession) ProtoReflect() protoreflect.Message { func (x *EndSession) ProtoReflect() protoreflect.Message {
mi := &file_internal_proto_msgTypes[5] mi := &file_internal_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -508,7 +585,7 @@ func (x *EndSession) ProtoReflect() protoreflect.Message {
// Deprecated: Use EndSession.ProtoReflect.Descriptor instead. // Deprecated: Use EndSession.ProtoReflect.Descriptor instead.
func (*EndSession) Descriptor() ([]byte, []int) { func (*EndSession) Descriptor() ([]byte, []int) {
return file_internal_proto_rawDescGZIP(), []int{5} return file_internal_proto_rawDescGZIP(), []int{6}
} }
type RemoveParticipant struct { type RemoveParticipant struct {
@@ -522,7 +599,7 @@ type RemoveParticipant struct {
func (x *RemoveParticipant) Reset() { func (x *RemoveParticipant) Reset() {
*x = RemoveParticipant{} *x = RemoveParticipant{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_internal_proto_msgTypes[6] mi := &file_internal_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -535,7 +612,7 @@ func (x *RemoveParticipant) String() string {
func (*RemoveParticipant) ProtoMessage() {} func (*RemoveParticipant) ProtoMessage() {}
func (x *RemoveParticipant) ProtoReflect() protoreflect.Message { func (x *RemoveParticipant) ProtoReflect() protoreflect.Message {
mi := &file_internal_proto_msgTypes[6] mi := &file_internal_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -548,7 +625,7 @@ func (x *RemoveParticipant) ProtoReflect() protoreflect.Message {
// Deprecated: Use RemoveParticipant.ProtoReflect.Descriptor instead. // Deprecated: Use RemoveParticipant.ProtoReflect.Descriptor instead.
func (*RemoveParticipant) Descriptor() ([]byte, []int) { func (*RemoveParticipant) Descriptor() ([]byte, []int) {
return file_internal_proto_rawDescGZIP(), []int{6} return file_internal_proto_rawDescGZIP(), []int{7}
} }
func (x *RemoveParticipant) GetParticipantId() string { func (x *RemoveParticipant) GetParticipantId() string {
@@ -584,7 +661,7 @@ var file_internal_proto_rawDesc = []byte{
0x6e, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x49, 0x6e, 0x12, 0x24, 0x0a, 0x0e, 0x6e, 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, 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, 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, 0x74, 0x22, 0x9f, 0x03, 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, 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, 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, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x3c, 0x0a,
@@ -604,37 +681,53 @@ var file_internal_proto_rawDesc = []byte{
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 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, 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, 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, 0x63, 0x6b, 0x12, 0x54, 0x0a, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x65, 0x74,
0x0a, 0x11, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6c, 0x69,
0x61, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74,
0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x76, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x61, 0x67, 0x65, 0x22, 0xb2, 0x01, 0x0a, 0x11, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4e, 0x6f,
0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e,
0x36, 0x0a, 0x0b, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x45, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x35,
0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61,
0x67, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73,
0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x0b, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x73,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6c, 0x69, 0x76,
0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x45, 0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48,
0x28, 0x09, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x00, 0x52, 0x0a, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x0a,
0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xe6, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x61,
0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f,
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x18, 0x04, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f,
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x0c, 0x0a, 0x0a, 0x45, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x25, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x6e,
0x0a, 0x0e, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x6e, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x6f,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x61, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x61, 0x12, 0x3e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18,
0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e,
0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x22, 0x5d, 0x0a, 0x15, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74,
0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x61,
0x6e, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x08, 0x52, 0x0c, 0x63, 0x61, 0x6e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12,
0x1f, 0x0a, 0x0b, 0x63, 0x61, 0x6e, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x18, 0x02,
0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x63, 0x61, 0x6e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68,
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 ( var (
@@ -649,33 +742,37 @@ func file_internal_proto_rawDescGZIP() []byte {
return file_internal_proto_rawDescData return file_internal_proto_rawDescData
} }
var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_internal_proto_goTypes = []interface{}{ var file_internal_proto_goTypes = []interface{}{
(*Node)(nil), // 0: livekit.Node (*Node)(nil), // 0: livekit.Node
(*NodeStats)(nil), // 1: livekit.NodeStats (*NodeStats)(nil), // 1: livekit.NodeStats
(*RTCNodeMessage)(nil), // 2: livekit.RTCNodeMessage (*RTCNodeMessage)(nil), // 2: livekit.RTCNodeMessage
(*SignalNodeMessage)(nil), // 3: livekit.SignalNodeMessage (*SignalNodeMessage)(nil), // 3: livekit.SignalNodeMessage
(*StartSession)(nil), // 4: livekit.StartSession (*StartSession)(nil), // 4: livekit.StartSession
(*EndSession)(nil), // 5: livekit.EndSession (*ParticipantPermission)(nil), // 5: livekit.ParticipantPermission
(*RemoveParticipant)(nil), // 6: livekit.RemoveParticipant (*EndSession)(nil), // 6: livekit.EndSession
(*SignalRequest)(nil), // 7: livekit.SignalRequest (*RemoveParticipant)(nil), // 7: livekit.RemoveParticipant
(*RoomParticipantIdentity)(nil), // 8: livekit.RoomParticipantIdentity (*SignalRequest)(nil), // 8: livekit.SignalRequest
(*MuteRoomTrackRequest)(nil), // 9: livekit.MuteRoomTrackRequest (*RoomParticipantIdentity)(nil), // 9: livekit.RoomParticipantIdentity
(*SignalResponse)(nil), // 10: livekit.SignalResponse (*MuteRoomTrackRequest)(nil), // 10: livekit.MuteRoomTrackRequest
(*UpdateParticipantMetadataRequest)(nil), // 11: livekit.UpdateParticipantMetadataRequest
(*SignalResponse)(nil), // 12: livekit.SignalResponse
} }
var file_internal_proto_depIdxs = []int32{ var file_internal_proto_depIdxs = []int32{
1, // 0: livekit.Node.stats:type_name -> livekit.NodeStats 1, // 0: livekit.Node.stats:type_name -> livekit.NodeStats
4, // 1: livekit.RTCNodeMessage.start_session:type_name -> livekit.StartSession 4, // 1: livekit.RTCNodeMessage.start_session:type_name -> livekit.StartSession
7, // 2: livekit.RTCNodeMessage.request:type_name -> livekit.SignalRequest 8, // 2: livekit.RTCNodeMessage.request:type_name -> livekit.SignalRequest
8, // 3: livekit.RTCNodeMessage.remove_participant:type_name -> livekit.RoomParticipantIdentity 9, // 3: livekit.RTCNodeMessage.remove_participant:type_name -> livekit.RoomParticipantIdentity
9, // 4: livekit.RTCNodeMessage.mute_track:type_name -> livekit.MuteRoomTrackRequest 10, // 4: livekit.RTCNodeMessage.mute_track:type_name -> livekit.MuteRoomTrackRequest
10, // 5: livekit.SignalNodeMessage.response:type_name -> livekit.SignalResponse 11, // 5: livekit.RTCNodeMessage.update_metadata:type_name -> livekit.UpdateParticipantMetadataRequest
5, // 6: livekit.SignalNodeMessage.end_session:type_name -> livekit.EndSession 12, // 6: livekit.SignalNodeMessage.response:type_name -> livekit.SignalResponse
7, // [7:7] is the sub-list for method output_type 6, // 7: livekit.SignalNodeMessage.end_session:type_name -> livekit.EndSession
7, // [7:7] is the sub-list for method input_type 5, // 8: livekit.StartSession.permission:type_name -> livekit.ParticipantPermission
7, // [7:7] is the sub-list for extension type_name 9, // [9:9] is the sub-list for method output_type
7, // [7:7] is the sub-list for extension extendee 9, // [9:9] is the sub-list for method input_type
0, // [0:7] is the sub-list for field type_name 9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
} }
func init() { file_internal_proto_init() } func init() { file_internal_proto_init() }
@@ -747,7 +844,7 @@ func file_internal_proto_init() {
} }
} }
file_internal_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_internal_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EndSession); i { switch v := v.(*ParticipantPermission); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -759,6 +856,18 @@ func file_internal_proto_init() {
} }
} }
file_internal_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_internal_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EndSession); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_internal_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveParticipant); i { switch v := v.(*RemoveParticipant); i {
case 0: case 0:
return &v.state return &v.state
@@ -776,6 +885,7 @@ func file_internal_proto_init() {
(*RTCNodeMessage_Request)(nil), (*RTCNodeMessage_Request)(nil),
(*RTCNodeMessage_RemoveParticipant)(nil), (*RTCNodeMessage_RemoveParticipant)(nil),
(*RTCNodeMessage_MuteTrack)(nil), (*RTCNodeMessage_MuteTrack)(nil),
(*RTCNodeMessage_UpdateMetadata)(nil),
} }
file_internal_proto_msgTypes[3].OneofWrappers = []interface{}{ file_internal_proto_msgTypes[3].OneofWrappers = []interface{}{
(*SignalNodeMessage_Response)(nil), (*SignalNodeMessage_Response)(nil),
@@ -787,7 +897,7 @@ func file_internal_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_internal_proto_rawDesc, RawDescriptor: file_internal_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 7, NumMessages: 8,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
+1 -1
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.25.0
// protoc v3.15.5 // protoc v3.15.6
// source: model.proto // source: model.proto
package livekit package livekit
+163 -78
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.25.0
// protoc v3.15.5 // protoc v3.15.6
// source: room.proto // source: room.proto
package livekit package livekit
@@ -573,6 +573,61 @@ func (x *MuteRoomTrackResponse) GetTrack() *TrackInfo {
return nil return nil
} }
type UpdateParticipantMetadataRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Target *RoomParticipantIdentity `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
Metadata string `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (x *UpdateParticipantMetadataRequest) Reset() {
*x = UpdateParticipantMetadataRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_room_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateParticipantMetadataRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateParticipantMetadataRequest) ProtoMessage() {}
func (x *UpdateParticipantMetadataRequest) ProtoReflect() protoreflect.Message {
mi := &file_room_proto_msgTypes[11]
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 UpdateParticipantMetadataRequest.ProtoReflect.Descriptor instead.
func (*UpdateParticipantMetadataRequest) Descriptor() ([]byte, []int) {
return file_room_proto_rawDescGZIP(), []int{11}
}
func (x *UpdateParticipantMetadataRequest) GetTarget() *RoomParticipantIdentity {
if x != nil {
return x.Target
}
return nil
}
func (x *UpdateParticipantMetadataRequest) GetMetadata() string {
if x != nil {
return x.Metadata
}
return ""
}
var File_room_proto protoreflect.FileDescriptor var File_room_proto protoreflect.FileDescriptor
var file_room_proto_rawDesc = []byte{ var file_room_proto_rawDesc = []byte{
@@ -623,45 +678,59 @@ var file_room_proto_rawDesc = []byte{
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 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, 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, 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, 0x6b, 0x22, 0x78, 0x0a, 0x20, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69,
0x65, 0x12, 0x37, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65,
0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18,
0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x6c, 0x69, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e,
0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x42, 0x0a, 0x09, 0x4c, 0x69, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49,
0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x12, 0x19, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12,
0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28,
0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, 0x8a, 0x05, 0x0a, 0x0b,
0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x52, 0x6f, 0x6f, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x43,
0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x1a, 0x2e, 0x6c, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65,
0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6b, 0x69, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65,
0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e,
0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x42, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x73, 0x12, 0x19, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74,
0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c,
0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x73,
0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x69, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65,
0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74,
0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65,
0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c,
0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x57, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61,
0x74, 0x79, 0x1a, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x6e, 0x74, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69,
0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x59, 0x0a, 0x11, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65,
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e,
0x74, 0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73,
0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50,
0x69, 0x74, 0x79, 0x1a, 0x22, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x65, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x20, 0x2e, 0x6c, 0x69, 0x76,
0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x4d, 0x75, 0x74, 0x65, 0x50, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x18, 0x2e, 0x6c,
0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x1d, 0x2e, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61,
0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x59, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x20, 0x2e, 0x6c, 0x69,
0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x54, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63,
0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x31, 0x5a, 0x2f, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x22, 0x2e,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61,
0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x4d, 0x75, 0x74, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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, 0x12, 0x60, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0x12, 0x29, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 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 ( var (
@@ -676,46 +745,50 @@ func file_room_proto_rawDescGZIP() []byte {
return file_room_proto_rawDescData return file_room_proto_rawDescData
} }
var file_room_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_room_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_room_proto_goTypes = []interface{}{ var file_room_proto_goTypes = []interface{}{
(*CreateRoomRequest)(nil), // 0: livekit.CreateRoomRequest (*CreateRoomRequest)(nil), // 0: livekit.CreateRoomRequest
(*ListRoomsRequest)(nil), // 1: livekit.ListRoomsRequest (*ListRoomsRequest)(nil), // 1: livekit.ListRoomsRequest
(*ListRoomsResponse)(nil), // 2: livekit.ListRoomsResponse (*ListRoomsResponse)(nil), // 2: livekit.ListRoomsResponse
(*DeleteRoomRequest)(nil), // 3: livekit.DeleteRoomRequest (*DeleteRoomRequest)(nil), // 3: livekit.DeleteRoomRequest
(*DeleteRoomResponse)(nil), // 4: livekit.DeleteRoomResponse (*DeleteRoomResponse)(nil), // 4: livekit.DeleteRoomResponse
(*ListParticipantsRequest)(nil), // 5: livekit.ListParticipantsRequest (*ListParticipantsRequest)(nil), // 5: livekit.ListParticipantsRequest
(*ListParticipantsResponse)(nil), // 6: livekit.ListParticipantsResponse (*ListParticipantsResponse)(nil), // 6: livekit.ListParticipantsResponse
(*RoomParticipantIdentity)(nil), // 7: livekit.RoomParticipantIdentity (*RoomParticipantIdentity)(nil), // 7: livekit.RoomParticipantIdentity
(*RemoveParticipantResponse)(nil), // 8: livekit.RemoveParticipantResponse (*RemoveParticipantResponse)(nil), // 8: livekit.RemoveParticipantResponse
(*MuteRoomTrackRequest)(nil), // 9: livekit.MuteRoomTrackRequest (*MuteRoomTrackRequest)(nil), // 9: livekit.MuteRoomTrackRequest
(*MuteRoomTrackResponse)(nil), // 10: livekit.MuteRoomTrackResponse (*MuteRoomTrackResponse)(nil), // 10: livekit.MuteRoomTrackResponse
(*Room)(nil), // 11: livekit.Room (*UpdateParticipantMetadataRequest)(nil), // 11: livekit.UpdateParticipantMetadataRequest
(*ParticipantInfo)(nil), // 12: livekit.ParticipantInfo (*Room)(nil), // 12: livekit.Room
(*TrackInfo)(nil), // 13: livekit.TrackInfo (*ParticipantInfo)(nil), // 13: livekit.ParticipantInfo
(*TrackInfo)(nil), // 14: livekit.TrackInfo
} }
var file_room_proto_depIdxs = []int32{ var file_room_proto_depIdxs = []int32{
11, // 0: livekit.ListRoomsResponse.rooms:type_name -> livekit.Room 12, // 0: livekit.ListRoomsResponse.rooms:type_name -> livekit.Room
12, // 1: livekit.ListParticipantsResponse.participants:type_name -> livekit.ParticipantInfo 13, // 1: livekit.ListParticipantsResponse.participants:type_name -> livekit.ParticipantInfo
13, // 2: livekit.MuteRoomTrackResponse.track:type_name -> livekit.TrackInfo 14, // 2: livekit.MuteRoomTrackResponse.track:type_name -> livekit.TrackInfo
0, // 3: livekit.RoomService.CreateRoom:input_type -> livekit.CreateRoomRequest 7, // 3: livekit.UpdateParticipantMetadataRequest.target:type_name -> livekit.RoomParticipantIdentity
1, // 4: livekit.RoomService.ListRooms:input_type -> livekit.ListRoomsRequest 0, // 4: livekit.RoomService.CreateRoom:input_type -> livekit.CreateRoomRequest
3, // 5: livekit.RoomService.DeleteRoom:input_type -> livekit.DeleteRoomRequest 1, // 5: livekit.RoomService.ListRooms:input_type -> livekit.ListRoomsRequest
5, // 6: livekit.RoomService.ListParticipants:input_type -> livekit.ListParticipantsRequest 3, // 6: livekit.RoomService.DeleteRoom:input_type -> livekit.DeleteRoomRequest
7, // 7: livekit.RoomService.GetParticipant:input_type -> livekit.RoomParticipantIdentity 5, // 7: livekit.RoomService.ListParticipants:input_type -> livekit.ListParticipantsRequest
7, // 8: livekit.RoomService.RemoveParticipant:input_type -> livekit.RoomParticipantIdentity 7, // 8: livekit.RoomService.GetParticipant:input_type -> livekit.RoomParticipantIdentity
9, // 9: livekit.RoomService.MutePublishedTrack:input_type -> livekit.MuteRoomTrackRequest 7, // 9: livekit.RoomService.RemoveParticipant:input_type -> livekit.RoomParticipantIdentity
11, // 10: livekit.RoomService.CreateRoom:output_type -> livekit.Room 9, // 10: livekit.RoomService.MutePublishedTrack:input_type -> livekit.MuteRoomTrackRequest
2, // 11: livekit.RoomService.ListRooms:output_type -> livekit.ListRoomsResponse 11, // 11: livekit.RoomService.UpdateParticipantMetadata:input_type -> livekit.UpdateParticipantMetadataRequest
4, // 12: livekit.RoomService.DeleteRoom:output_type -> livekit.DeleteRoomResponse 12, // 12: livekit.RoomService.CreateRoom:output_type -> livekit.Room
6, // 13: livekit.RoomService.ListParticipants:output_type -> livekit.ListParticipantsResponse 2, // 13: livekit.RoomService.ListRooms:output_type -> livekit.ListRoomsResponse
12, // 14: livekit.RoomService.GetParticipant:output_type -> livekit.ParticipantInfo 4, // 14: livekit.RoomService.DeleteRoom:output_type -> livekit.DeleteRoomResponse
8, // 15: livekit.RoomService.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse 6, // 15: livekit.RoomService.ListParticipants:output_type -> livekit.ListParticipantsResponse
10, // 16: livekit.RoomService.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse 13, // 16: livekit.RoomService.GetParticipant:output_type -> livekit.ParticipantInfo
10, // [10:17] is the sub-list for method output_type 8, // 17: livekit.RoomService.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse
3, // [3:10] is the sub-list for method input_type 10, // 18: livekit.RoomService.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse
3, // [3:3] is the sub-list for extension type_name 13, // 19: livekit.RoomService.UpdateParticipantMetadata:output_type -> livekit.ParticipantInfo
3, // [3:3] is the sub-list for extension extendee 12, // [12:20] is the sub-list for method output_type
0, // [0:3] is the sub-list for field type_name 4, // [4:12] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
} }
func init() { file_room_proto_init() } func init() { file_room_proto_init() }
@@ -857,6 +930,18 @@ func file_room_proto_init() {
return nil return nil
} }
} }
file_room_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateParticipantMetadataRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@@ -864,7 +949,7 @@ func file_room_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_room_proto_rawDesc, RawDescriptor: file_room_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 11, NumMessages: 12,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },
+318 -40
View File
@@ -60,6 +60,9 @@ type RoomService interface {
// mute/unmute a participant, requires RoomAdmin // mute/unmute a participant, requires RoomAdmin
MutePublishedTrack(context.Context, *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error) MutePublishedTrack(context.Context, *MuteRoomTrackRequest) (*MuteRoomTrackResponse, error)
// update participant metadata
UpdateParticipantMetadata(context.Context, *UpdateParticipantMetadataRequest) (*ParticipantInfo, error)
} }
// =========================== // ===========================
@@ -68,7 +71,7 @@ type RoomService interface {
type roomServiceProtobufClient struct { type roomServiceProtobufClient struct {
client HTTPClient client HTTPClient
urls [7]string urls [8]string
interceptor twirp.Interceptor interceptor twirp.Interceptor
opts twirp.ClientOptions opts twirp.ClientOptions
} }
@@ -88,7 +91,7 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi
// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
serviceURL := sanitizeBaseURL(baseURL) serviceURL := sanitizeBaseURL(baseURL)
serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService") serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService")
urls := [7]string{ urls := [8]string{
serviceURL + "CreateRoom", serviceURL + "CreateRoom",
serviceURL + "ListRooms", serviceURL + "ListRooms",
serviceURL + "DeleteRoom", serviceURL + "DeleteRoom",
@@ -96,6 +99,7 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi
serviceURL + "GetParticipant", serviceURL + "GetParticipant",
serviceURL + "RemoveParticipant", serviceURL + "RemoveParticipant",
serviceURL + "MutePublishedTrack", serviceURL + "MutePublishedTrack",
serviceURL + "UpdateParticipantMetadata",
} }
return &roomServiceProtobufClient{ return &roomServiceProtobufClient{
@@ -428,13 +432,59 @@ func (c *roomServiceProtobufClient) callMutePublishedTrack(ctx context.Context,
return out, nil return out, nil
} }
func (c *roomServiceProtobufClient) UpdateParticipantMetadata(ctx context.Context, in *UpdateParticipantMetadataRequest) (*ParticipantInfo, error) {
ctx = ctxsetters.WithPackageName(ctx, "livekit")
ctx = ctxsetters.WithServiceName(ctx, "RoomService")
ctx = ctxsetters.WithMethodName(ctx, "UpdateParticipantMetadata")
caller := c.callUpdateParticipantMetadata
if c.interceptor != nil {
caller = func(ctx context.Context, req *UpdateParticipantMetadataRequest) (*ParticipantInfo, error) {
resp, err := c.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*UpdateParticipantMetadataRequest)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*UpdateParticipantMetadataRequest) when calling interceptor")
}
return c.callUpdateParticipantMetadata(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) callUpdateParticipantMetadata(ctx context.Context, in *UpdateParticipantMetadataRequest) (*ParticipantInfo, error) {
out := new(ParticipantInfo)
ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[7], 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 // RoomService JSON Client
// ======================= // =======================
type roomServiceJSONClient struct { type roomServiceJSONClient struct {
client HTTPClient client HTTPClient
urls [7]string urls [8]string
interceptor twirp.Interceptor interceptor twirp.Interceptor
opts twirp.ClientOptions opts twirp.ClientOptions
} }
@@ -454,7 +504,7 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C
// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method> // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
serviceURL := sanitizeBaseURL(baseURL) serviceURL := sanitizeBaseURL(baseURL)
serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService") serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService")
urls := [7]string{ urls := [8]string{
serviceURL + "CreateRoom", serviceURL + "CreateRoom",
serviceURL + "ListRooms", serviceURL + "ListRooms",
serviceURL + "DeleteRoom", serviceURL + "DeleteRoom",
@@ -462,6 +512,7 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C
serviceURL + "GetParticipant", serviceURL + "GetParticipant",
serviceURL + "RemoveParticipant", serviceURL + "RemoveParticipant",
serviceURL + "MutePublishedTrack", serviceURL + "MutePublishedTrack",
serviceURL + "UpdateParticipantMetadata",
} }
return &roomServiceJSONClient{ return &roomServiceJSONClient{
@@ -794,6 +845,52 @@ func (c *roomServiceJSONClient) callMutePublishedTrack(ctx context.Context, in *
return out, nil return out, nil
} }
func (c *roomServiceJSONClient) UpdateParticipantMetadata(ctx context.Context, in *UpdateParticipantMetadataRequest) (*ParticipantInfo, error) {
ctx = ctxsetters.WithPackageName(ctx, "livekit")
ctx = ctxsetters.WithServiceName(ctx, "RoomService")
ctx = ctxsetters.WithMethodName(ctx, "UpdateParticipantMetadata")
caller := c.callUpdateParticipantMetadata
if c.interceptor != nil {
caller = func(ctx context.Context, req *UpdateParticipantMetadataRequest) (*ParticipantInfo, error) {
resp, err := c.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*UpdateParticipantMetadataRequest)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*UpdateParticipantMetadataRequest) when calling interceptor")
}
return c.callUpdateParticipantMetadata(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) callUpdateParticipantMetadata(ctx context.Context, in *UpdateParticipantMetadataRequest) (*ParticipantInfo, error) {
out := new(ParticipantInfo)
ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[7], 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 // RoomService Server Handler
// ========================== // ==========================
@@ -899,6 +996,9 @@ func (s *roomServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Reques
case "MutePublishedTrack": case "MutePublishedTrack":
s.serveMutePublishedTrack(ctx, resp, req) s.serveMutePublishedTrack(ctx, resp, req)
return return
case "UpdateParticipantMetadata":
s.serveUpdateParticipantMetadata(ctx, resp, req)
return
default: default:
msg := fmt.Sprintf("no handler for path %q", req.URL.Path) msg := fmt.Sprintf("no handler for path %q", req.URL.Path)
s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
@@ -2131,6 +2231,181 @@ func (s *roomServiceServer) serveMutePublishedTrackProtobuf(ctx context.Context,
callResponseSent(ctx, s.hooks) callResponseSent(ctx, s.hooks)
} }
func (s *roomServiceServer) serveUpdateParticipantMetadata(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.serveUpdateParticipantMetadataJSON(ctx, resp, req)
case "application/protobuf":
s.serveUpdateParticipantMetadataProtobuf(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) serveUpdateParticipantMetadataJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
var err error
ctx = ctxsetters.WithMethodName(ctx, "UpdateParticipantMetadata")
ctx, err = callRequestRouted(ctx, s.hooks)
if err != nil {
s.writeError(ctx, resp, err)
return
}
reqContent := new(UpdateParticipantMetadataRequest)
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.UpdateParticipantMetadata
if s.interceptor != nil {
handler = func(ctx context.Context, req *UpdateParticipantMetadataRequest) (*ParticipantInfo, error) {
resp, err := s.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*UpdateParticipantMetadataRequest)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*UpdateParticipantMetadataRequest) when calling interceptor")
}
return s.RoomService.UpdateParticipantMetadata(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 UpdateParticipantMetadata. 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) serveUpdateParticipantMetadataProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
var err error
ctx = ctxsetters.WithMethodName(ctx, "UpdateParticipantMetadata")
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(UpdateParticipantMetadataRequest)
if err = proto.Unmarshal(buf, reqContent); err != nil {
s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
return
}
handler := s.RoomService.UpdateParticipantMetadata
if s.interceptor != nil {
handler = func(ctx context.Context, req *UpdateParticipantMetadataRequest) (*ParticipantInfo, error) {
resp, err := s.interceptor(
func(ctx context.Context, req interface{}) (interface{}, error) {
typedReq, ok := req.(*UpdateParticipantMetadataRequest)
if !ok {
return nil, twirp.InternalError("failed type assertion req.(*UpdateParticipantMetadataRequest) when calling interceptor")
}
return s.RoomService.UpdateParticipantMetadata(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 UpdateParticipantMetadata. 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) { func (s *roomServiceServer) ServiceDescriptor() ([]byte, int) {
return twirpFileDescriptor0, 0 return twirpFileDescriptor0, 0
} }
@@ -2693,40 +2968,43 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error)
} }
var twirpFileDescriptor0 = []byte{ var twirpFileDescriptor0 = []byte{
// 549 bytes of a gzipped FileDescriptorProto // 604 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdf, 0x6f, 0x12, 0x41, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4d, 0x6f, 0xd3, 0x40,
0x10, 0x0e, 0xb6, 0xb4, 0x30, 0x14, 0x2d, 0x13, 0x0c, 0xd7, 0x23, 0x1a, 0x3c, 0x1f, 0xc4, 0x87, 0x10, 0x55, 0x68, 0xd3, 0x36, 0x93, 0x16, 0x9a, 0x55, 0x51, 0x5d, 0x57, 0x20, 0x63, 0x0e, 0xa4,
0x42, 0xc4, 0x07, 0x7d, 0xf0, 0xc5, 0xaa, 0x31, 0x24, 0x35, 0x69, 0x8e, 0x26, 0xfe, 0x78, 0x21, 0x87, 0x26, 0x22, 0x1c, 0xe8, 0x81, 0x0b, 0x05, 0x84, 0x22, 0xb5, 0x52, 0xe5, 0x14, 0xf1, 0x71,
0x07, 0x37, 0xda, 0x4d, 0xd9, 0x5b, 0xbc, 0xdb, 0x23, 0xe5, 0xbf, 0xf0, 0xcf, 0xf0, 0xcf, 0x34, 0x09, 0x9b, 0x78, 0x68, 0x57, 0xcd, 0x7a, 0x8d, 0xbd, 0x8e, 0x92, 0xbf, 0xc0, 0x89, 0x9f, 0x8c,
0xbb, 0x7b, 0x1c, 0x4b, 0x39, 0x88, 0x4f, 0xdc, 0xce, 0x7c, 0x33, 0xdf, 0x37, 0xb3, 0xdf, 0x02, 0x76, 0xbd, 0x76, 0xec, 0xc6, 0x49, 0x39, 0xc5, 0x33, 0xf3, 0xe6, 0xe3, 0xcd, 0xce, 0x53, 0x00,
0x10, 0x0b, 0xc1, 0x7b, 0xf3, 0x58, 0x48, 0x81, 0xc7, 0x33, 0xb6, 0xa0, 0x5b, 0x26, 0xdd, 0x1a, 0x22, 0x21, 0x78, 0x27, 0x8c, 0x84, 0x14, 0x64, 0x7b, 0xc2, 0xa6, 0x78, 0xc7, 0xa4, 0xdd, 0xe4,
0x17, 0x21, 0xcd, 0x4c, 0xd4, 0xfb, 0x53, 0x82, 0xc6, 0x87, 0x98, 0x02, 0x49, 0xbe, 0x10, 0xdc, 0xc2, 0xc7, 0x49, 0xea, 0x75, 0xff, 0xd6, 0xa0, 0xf5, 0x21, 0x42, 0x2a, 0xd1, 0x13, 0x82, 0x7b,
0xa7, 0xdf, 0x29, 0x25, 0x12, 0x11, 0x0e, 0xa3, 0x80, 0x93, 0x53, 0xea, 0x94, 0xba, 0x55, 0x5f, 0xf8, 0x3b, 0xc1, 0x58, 0x12, 0x02, 0x9b, 0x01, 0xe5, 0x68, 0xd5, 0x9c, 0x5a, 0xbb, 0xe1, 0xe9,
0x7f, 0xe3, 0x73, 0xa8, 0x13, 0x9f, 0xcb, 0xe5, 0x58, 0x32, 0x4e, 0x22, 0x95, 0xce, 0x83, 0x4e, 0x6f, 0xf2, 0x12, 0xf6, 0x90, 0x87, 0x72, 0x3e, 0x94, 0x8c, 0xa3, 0x48, 0xa4, 0xf5, 0xc8, 0xa9,
0xa9, 0x5b, 0xf7, 0x4f, 0x74, 0xf0, 0xda, 0xc4, 0xf0, 0x25, 0x9c, 0xf2, 0xe0, 0x6e, 0x3c, 0x0f, 0xb5, 0xf7, 0xbc, 0x5d, 0xed, 0xbc, 0x4e, 0x7d, 0xe4, 0x04, 0xf6, 0x39, 0x9d, 0x0d, 0x43, 0x1a,
0x62, 0xc9, 0xa6, 0x6c, 0x1e, 0x44, 0x32, 0x71, 0x0e, 0x34, 0xee, 0x11, 0x0f, 0xee, 0xae, 0xac, 0x49, 0x36, 0x66, 0x21, 0x0d, 0x64, 0x6c, 0x6d, 0x68, 0xdc, 0x13, 0x4e, 0x67, 0x57, 0x05, 0x37,
0x30, 0xb6, 0xe0, 0x38, 0x12, 0x21, 0x8d, 0x59, 0xe8, 0x1c, 0x6a, 0x9a, 0x23, 0x75, 0x1c, 0x86, 0x39, 0x84, 0xed, 0x40, 0xf8, 0x38, 0x64, 0xbe, 0xb5, 0xa9, 0xdb, 0x6c, 0x29, 0xb3, 0xef, 0xbb,
0x1e, 0xc2, 0xe9, 0x25, 0x4b, 0xa4, 0xd2, 0x93, 0x64, 0x82, 0xbc, 0xb7, 0xd0, 0xb0, 0x62, 0xc9, 0x04, 0xf6, 0x2f, 0x58, 0x2c, 0xd5, 0x3c, 0xb1, 0x19, 0xc8, 0x3d, 0x83, 0x56, 0xc1, 0x17, 0x87,
0x5c, 0x44, 0x89, 0x52, 0x54, 0x56, 0xf3, 0x25, 0x4e, 0xa9, 0x73, 0xd0, 0xad, 0x0d, 0xea, 0xbd, 0x22, 0x88, 0xd5, 0x44, 0x75, 0xc5, 0x2f, 0xb6, 0x6a, 0xce, 0x46, 0xbb, 0xd9, 0xdb, 0xeb, 0x18,
0x6c, 0xc2, 0x9e, 0x1e, 0xc5, 0xe4, 0xbc, 0x17, 0xd0, 0xf8, 0x48, 0x33, 0xda, 0x9a, 0x4f, 0x65, 0x86, 0x1d, 0x4d, 0x25, 0x8d, 0xb9, 0xaf, 0xa0, 0xf5, 0x11, 0x27, 0xb8, 0xc4, 0x4f, 0x45, 0x33,
0x57, 0xf3, 0xa9, 0x6f, 0xaf, 0x09, 0x68, 0x03, 0x0d, 0x87, 0x77, 0x0e, 0x2d, 0x45, 0x6c, 0x2b, 0x7e, 0xea, 0xdb, 0x3d, 0x00, 0x52, 0x04, 0xa6, 0x3d, 0xdc, 0x53, 0x38, 0x54, 0x8d, 0x8b, 0x93,
0xdf, 0xd7, 0xe4, 0x1b, 0x38, 0xdb, 0xf0, 0x4c, 0xee, 0x3b, 0x38, 0xd9, 0xd8, 0x8b, 0x51, 0xed, 0xaf, 0x2b, 0xf2, 0x0d, 0xac, 0x65, 0xb8, 0x19, 0xf7, 0x1d, 0xec, 0x96, 0xf6, 0x92, 0x4e, 0x6d,
0xe4, 0xaa, 0xad, 0xa2, 0x61, 0xf4, 0x53, 0xf8, 0x1b, 0x68, 0x6f, 0x08, 0x2d, 0x25, 0xcc, 0x06, 0xe5, 0x53, 0x17, 0x92, 0xfa, 0xc1, 0x2f, 0xe1, 0x95, 0xd0, 0x6e, 0x1f, 0x0e, 0xd5, 0x60, 0x45,
0x85, 0x14, 0x49, 0x26, 0x97, 0x45, 0x42, 0xd0, 0x85, 0x0a, 0xcb, 0xf2, 0xfa, 0xa2, 0xaa, 0x7e, 0x90, 0x8f, 0x81, 0x64, 0x72, 0x5e, 0x35, 0x08, 0xb1, 0x61, 0x87, 0x99, 0xb8, 0x7e, 0xa8, 0x86,
0x7e, 0xf6, 0xda, 0x70, 0xe6, 0x13, 0x17, 0x0b, 0xb2, 0x9a, 0xe5, 0x03, 0x2f, 0xa1, 0xf9, 0x25, 0x97, 0xdb, 0xee, 0x31, 0x1c, 0x79, 0xc8, 0xc5, 0x14, 0x0b, 0xc5, 0x72, 0xc2, 0x73, 0x38, 0xb8,
0x35, 0x4b, 0xb8, 0x8e, 0x83, 0xe9, 0xed, 0x9e, 0x69, 0xf7, 0x91, 0x60, 0x1b, 0xaa, 0x52, 0xd5, 0x4c, 0xd2, 0x25, 0x5c, 0x47, 0x74, 0x7c, 0xb7, 0x86, 0xed, 0xba, 0x26, 0xe4, 0x18, 0x1a, 0x52,
0x8f, 0x13, 0x16, 0x6a, 0x0b, 0x54, 0xfd, 0x8a, 0x0e, 0x8c, 0x58, 0x88, 0x4d, 0x28, 0xf3, 0x54, 0xe5, 0x0f, 0x63, 0xe6, 0xeb, 0x13, 0x68, 0x78, 0x3b, 0xda, 0x31, 0x60, 0x3e, 0x39, 0x80, 0x3a,
0x92, 0xb9, 0xf9, 0x8a, 0x6f, 0x0e, 0xde, 0x7b, 0x78, 0x7c, 0x8f, 0x3a, 0xdb, 0x5c, 0x17, 0xca, 0x4f, 0x24, 0xa6, 0x2f, 0xbf, 0xe3, 0xa5, 0x86, 0xfb, 0x1e, 0x9e, 0xde, 0x6b, 0x6d, 0x36, 0xd7,
0xba, 0x54, 0x93, 0xd7, 0x06, 0x98, 0xaf, 0x4c, 0xc3, 0xf4, 0xb2, 0x0c, 0x60, 0xf0, 0xf7, 0x10, 0x86, 0xba, 0x4e, 0xd5, 0xcd, 0x9b, 0x3d, 0x92, 0xaf, 0x4c, 0xc3, 0xf4, 0xb2, 0x52, 0x80, 0x3b,
0x6a, 0xaa, 0x7e, 0x44, 0xf1, 0x82, 0x4d, 0x09, 0xdf, 0x00, 0xac, 0xdd, 0x8d, 0x6e, 0x5e, 0xb8, 0x03, 0xe7, 0x4b, 0xe8, 0x53, 0x59, 0xa4, 0x76, 0x89, 0x92, 0xfa, 0x54, 0xd2, 0x8c, 0xc9, 0x19,
0x65, 0x79, 0x77, 0xd3, 0x3d, 0x78, 0x01, 0xd5, 0xdc, 0x70, 0x78, 0x96, 0xe7, 0xee, 0x1b, 0xd3, 0x6c, 0x49, 0x1a, 0xdd, 0xa0, 0x34, 0xe5, 0x9c, 0xd2, 0xdd, 0x54, 0x2c, 0xd8, 0x33, 0x78, 0xc5,
0x75, 0x8b, 0x52, 0x99, 0xec, 0x4f, 0x00, 0x6b, 0x47, 0x59, 0xe4, 0x5b, 0x7e, 0x74, 0xdb, 0x85, 0x97, 0x9b, 0x62, 0x19, 0xdf, 0xcc, 0xee, 0xfd, 0xa9, 0x43, 0x53, 0xe5, 0x0f, 0x30, 0x9a, 0xb2,
0xb9, 0xac, 0xcd, 0x57, 0xf3, 0x1e, 0x36, 0x1e, 0x4f, 0x67, 0x83, 0xb6, 0xc0, 0x9d, 0xee, 0xb3, 0x31, 0x92, 0xb7, 0x00, 0x0b, 0x5d, 0x11, 0x3b, 0xef, 0xb1, 0x24, 0x36, 0xbb, 0x7c, 0xb7, 0xe4,
0x3d, 0x88, 0xac, 0xf1, 0x25, 0x3c, 0xfc, 0x4c, 0x76, 0xca, 0x6a, 0xbb, 0xc3, 0x6b, 0xee, 0x4e, 0x1c, 0x1a, 0xf9, 0xa9, 0x93, 0xa3, 0x3c, 0x76, 0x5f, 0x12, 0xb6, 0x5d, 0x15, 0x32, 0x0b, 0xfb,
0xbb, 0xe2, 0x77, 0x68, 0x6c, 0xb9, 0xea, 0x3f, 0x1a, 0x7a, 0x6b, 0xc4, 0x2e, 0x4f, 0xe2, 0x08, 0x04, 0xb0, 0xb8, 0xe5, 0x42, 0xf3, 0x25, 0x25, 0xd8, 0xc7, 0x95, 0x31, 0x53, 0xe6, 0x6b, 0xaa,
0x50, 0x19, 0xe3, 0x2a, 0x9d, 0xcc, 0x58, 0x72, 0x43, 0xa1, 0xbe, 0x76, 0x7c, 0x92, 0x57, 0x16, 0xc4, 0x92, 0x6c, 0x9d, 0x52, 0xdb, 0x0a, 0x5d, 0xd8, 0x2f, 0xd6, 0x20, 0x4c, 0xe1, 0x0b, 0x78,
0x19, 0xd6, 0x7d, 0xba, 0x2b, 0x6d, 0x9a, 0x5e, 0xbc, 0xfa, 0xd1, 0xff, 0xc5, 0xe4, 0x4d, 0x3a, 0xfc, 0x19, 0x8b, 0x21, 0xf2, 0xe0, 0x23, 0xd8, 0x2b, 0x85, 0x42, 0xbe, 0x43, 0x6b, 0xe9, 0x9e,
0xe9, 0x4d, 0x05, 0xef, 0x67, 0xd8, 0xd5, 0xef, 0x79, 0x42, 0xf1, 0x82, 0xe2, 0xbe, 0xfe, 0x93, 0xff, 0xa3, 0xa0, 0xbb, 0x40, 0xac, 0x52, 0x03, 0x19, 0x00, 0x51, 0x27, 0x79, 0x95, 0x8c, 0x26,
0x5c, 0x05, 0x27, 0x47, 0xfa, 0xf8, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0x66, 0x2b, 0x2c, 0xbe, 0x45, 0x5f, 0x1f, 0x1c, 0x79, 0x96, 0x67, 0x56, 0x49, 0xc5, 0x7e, 0xbe, 0x2a, 0x6c,
0xf4, 0x57, 0x05, 0x00, 0x00, 0x8a, 0xfe, 0x84, 0xa3, 0x95, 0x47, 0x4a, 0x4e, 0xf2, 0xe4, 0x87, 0x0e, 0x79, 0xf5, 0x46, 0xce,
0x5f, 0xff, 0xe8, 0xde, 0x30, 0x79, 0x9b, 0x8c, 0x3a, 0x63, 0xc1, 0xbb, 0x06, 0x95, 0xfd, 0x9e,
0xc6, 0x18, 0x4d, 0x31, 0xea, 0xea, 0x3f, 0x80, 0xcc, 0x39, 0xda, 0xd2, 0xe6, 0x9b, 0x7f, 0x01,
0x00, 0x00, 0xff, 0xff, 0xa1, 0x4e, 0xfb, 0xa7, 0x33, 0x06, 0x00, 0x00,
} }
+30 -39
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.25.0 // protoc-gen-go v1.25.0
// protoc v3.15.5 // protoc v3.15.6
// source: rtc.proto // source: rtc.proto
package livekit package livekit
@@ -247,7 +247,7 @@ type SignalRequest_AddTrack struct {
} }
type SignalRequest_Mute struct { type SignalRequest_Mute struct {
// mute the participant's own tracks // mute the participant's published tracks
Mute *MuteTrackRequest `protobuf:"bytes,5,opt,name=mute,proto3,oneof"` Mute *MuteTrackRequest `protobuf:"bytes,5,opt,name=mute,proto3,oneof"`
} }
@@ -999,7 +999,6 @@ type UpdateSubscription struct {
TrackSids []string `protobuf:"bytes,1,rep,name=track_sids,json=trackSids,proto3" json:"track_sids,omitempty"` TrackSids []string `protobuf:"bytes,1,rep,name=track_sids,json=trackSids,proto3" json:"track_sids,omitempty"`
Subscribe bool `protobuf:"varint,2,opt,name=subscribe,proto3" json:"subscribe,omitempty"` Subscribe bool `protobuf:"varint,2,opt,name=subscribe,proto3" json:"subscribe,omitempty"`
Mute bool `protobuf:"varint,3,opt,name=mute,proto3" json:"mute,omitempty"`
Quality VideoQuality `protobuf:"varint,4,opt,name=quality,proto3,enum=livekit.VideoQuality" json:"quality,omitempty"` Quality VideoQuality `protobuf:"varint,4,opt,name=quality,proto3,enum=livekit.VideoQuality" json:"quality,omitempty"`
} }
@@ -1049,13 +1048,6 @@ func (x *UpdateSubscription) GetSubscribe() bool {
return false return false
} }
func (x *UpdateSubscription) GetMute() bool {
if x != nil {
return x.Mute
}
return false
}
func (x *UpdateSubscription) GetQuality() VideoQuality { func (x *UpdateSubscription) GetQuality() VideoQuality {
if x != nil { if x != nil {
return x.Quality return x.Quality
@@ -1306,39 +1298,38 @@ var file_rtc_proto_rawDesc = []byte{
0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a,
0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61,
0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x82, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a,
0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x73, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x73, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
0x52, 0x09, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x53, 0x69, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x52, 0x09, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x53, 0x69, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73,
0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x75, 0x74, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x71, 0x75, 0x61,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6d, 0x75, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76,
0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74,
0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x51, 0x75, 0x79, 0x52, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x79, 0x0a, 0x13, 0x55, 0x70,
0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x79, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x53, 0x65, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x73, 0x69, 0x64, 0x73, 0x18,
0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x73, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x53, 0x69, 0x64, 0x73,
0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
0x53, 0x69, 0x64, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x6d, 0x75, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18,
0x28, 0x08, 0x52, 0x04, 0x6d, 0x75, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e,
0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x07, 0x71, 0x75,
0x6b, 0x69, 0x74, 0x2e, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x5b, 0x0a, 0x09, 0x49, 0x43, 0x45, 0x53, 0x65, 0x72, 0x76,
0x52, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x5b, 0x0a, 0x09, 0x49, 0x43, 0x45, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x72, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x72, 0x6c, 0x73, 0x18, 0x01, 0x52, 0x04, 0x75, 0x72, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61,
0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x75, 0x72, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61,
0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c,
0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69,
0x74, 0x69, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x61, 0x6c, 0x2a, 0x2d, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x54, 0x61, 0x72, 0x67,
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2a, 0x2d, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x65, 0x74, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x52, 0x10,
0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45, 0x52, 0x10,
0x48, 0x45, 0x52, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x01, 0x2a, 0x2d, 0x0a, 0x0c, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x74,
0x42, 0x45, 0x52, 0x10, 0x01, 0x2a, 0x2d, 0x0a, 0x0c, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x51, 0x75, 0x79, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x4f, 0x57, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45,
0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x4f, 0x57, 0x10, 0x00, 0x12, 0x0a, 0x44, 0x49, 0x55, 0x4d, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x02,
0x0a, 0x06, 0x4d, 0x45, 0x44, 0x49, 0x55, 0x4d, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c,
0x47, 0x48, 0x10, 0x02, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73,
0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65,
0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (