mirror of
https://github.com/livekit/livekit.git
synced 2026-10-24 02:02:55 +00:00
ability to disable auto subscribe per participant
This commit is contained in:
1 parent
55d801d30b
commit
0900054c24
29 files changed
+236
-7683
No files matched your search
@@ -11,7 +11,7 @@ require (
|
||||
github.com/google/wire v0.5.0
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/jxskiss/base62 v0.0.0-20191017122030-4f11678b909b
|
||||
github.com/livekit/protocol v0.5.0
|
||||
github.com/livekit/protocol v0.5.1
|
||||
github.com/magefile/mage v1.11.0
|
||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
|
||||
@@ -231,6 +231,8 @@ 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/livekit/protocol v0.5.0 h1:dcehG+icwEkHCutjb3erSpaElNa86OLVL0KKZbiajKo=
|
||||
github.com/livekit/protocol v0.5.0/go.mod h1:wo3CGfYB7XMF8GoVJAfTARrYSP/ombi+sbLl6AYdKP0=
|
||||
github.com/livekit/protocol v0.5.1 h1:RSX0sQM2+NK2kCHTg/n6wPf0d3qYskc611GYV3h+5+8=
|
||||
github.com/livekit/protocol v0.5.1/go.mod h1:wo3CGfYB7XMF8GoVJAfTARrYSP/ombi+sbLl6AYdKP0=
|
||||
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/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
|
||||
|
||||
@@ -3,13 +3,13 @@ package config
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestConfig_UnmarshalKeys(t *testing.T) {
|
||||
conf, err := NewConfig("")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.NoError(t, conf.unmarshalKeys("key1: secret1"))
|
||||
assert.Equal(t, "secret1", conf.Keys["key1"])
|
||||
require.NoError(t, conf.unmarshalKeys("key1: secret1"))
|
||||
require.Equal(t, "secret1", conf.Keys["key1"])
|
||||
}
|
||||
@@ -30,6 +30,7 @@ type ParticipantInit struct {
|
||||
Permission *livekit.ParticipantPermission
|
||||
ProtocolVersion int32
|
||||
UsePlanB bool
|
||||
AutoSubscribe bool
|
||||
}
|
||||
|
||||
type NewParticipantCallback func(roomName string, pi ParticipantInit, requestSource MessageSource, responseSink MessageSink)
|
||||
|
||||
@@ -158,6 +158,7 @@ func (r *RedisRouter) StartParticipantSignal(roomName string, pi ParticipantInit
|
||||
Permission: pi.Permission,
|
||||
ProtocolVersion: pi.ProtocolVersion,
|
||||
UsePlanB: pi.UsePlanB,
|
||||
AutoSubscribe: pi.AutoSubscribe,
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
@@ -225,6 +226,7 @@ func (r *RedisRouter) startParticipantRTC(ss *livekit.StartSession, participantK
|
||||
Permission: ss.Permission,
|
||||
ProtocolVersion: ss.ProtocolVersion,
|
||||
UsePlanB: ss.UsePlanB,
|
||||
AutoSubscribe: ss.AutoSubscribe,
|
||||
}
|
||||
|
||||
reqChan := r.getOrCreateMessageChannel(r.requestChannels, participantKey)
|
||||
|
||||
@@ -4,10 +4,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestIsAvailable(t *testing.T) {
|
||||
@@ -17,7 +16,7 @@ func TestIsAvailable(t *testing.T) {
|
||||
UpdatedAt: time.Now().Unix() - 3,
|
||||
},
|
||||
}
|
||||
assert.True(t, routing.IsAvailable(n))
|
||||
require.True(t, routing.IsAvailable(n))
|
||||
})
|
||||
|
||||
t.Run("expired", func(t *testing.T) {
|
||||
@@ -26,6 +25,6 @@ func TestIsAvailable(t *testing.T) {
|
||||
UpdatedAt: time.Now().Unix() - 20,
|
||||
},
|
||||
}
|
||||
assert.False(t, routing.IsAvailable(n))
|
||||
require.False(t, routing.IsAvailable(n))
|
||||
})
|
||||
}
|
||||
@@ -3,9 +3,8 @@ package rtc_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -19,11 +18,11 @@ func TestAudioLevel(t *testing.T) {
|
||||
t.Run("initially to return not noisy, within a few samples", func(t *testing.T) {
|
||||
a := rtc.NewAudioLevel(defaultActiveLevel, defaultPercentile)
|
||||
_, noisy := a.GetLevel()
|
||||
assert.False(t, noisy)
|
||||
require.False(t, noisy)
|
||||
|
||||
observeSamples(a, 28, 5)
|
||||
_, noisy = a.GetLevel()
|
||||
assert.False(t, noisy)
|
||||
require.False(t, noisy)
|
||||
})
|
||||
|
||||
t.Run("not noisy when all samples are below threshold", func(t *testing.T) {
|
||||
@@ -31,7 +30,7 @@ func TestAudioLevel(t *testing.T) {
|
||||
|
||||
observeSamples(a, 35, 100)
|
||||
_, noisy := a.GetLevel()
|
||||
assert.False(t, noisy)
|
||||
require.False(t, noisy)
|
||||
})
|
||||
|
||||
t.Run("not noisy when less than percentile samples are above threshold", func(t *testing.T) {
|
||||
@@ -42,7 +41,7 @@ func TestAudioLevel(t *testing.T) {
|
||||
observeSamples(a, 35, 1)
|
||||
|
||||
_, noisy := a.GetLevel()
|
||||
assert.False(t, noisy)
|
||||
require.False(t, noisy)
|
||||
})
|
||||
|
||||
t.Run("noisy when higher than percentile samples are above threshold", func(t *testing.T) {
|
||||
@@ -53,9 +52,9 @@ func TestAudioLevel(t *testing.T) {
|
||||
observeSamples(a, 29, 2)
|
||||
|
||||
level, noisy := a.GetLevel()
|
||||
assert.True(t, noisy)
|
||||
assert.Less(t, level, uint8(defaultActiveLevel))
|
||||
assert.Greater(t, level, uint8(25))
|
||||
require.True(t, noisy)
|
||||
require.Less(t, level, uint8(defaultActiveLevel))
|
||||
require.Greater(t, level, uint8(25))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ func newMockParticipant(identity string, protocol types.ProtocolVersion) *typesf
|
||||
p.IdentityReturns(identity)
|
||||
p.StateReturns(livekit.ParticipantInfo_JOINED)
|
||||
p.ProtocolVersionReturns(protocol)
|
||||
p.CanSubscribeReturns(true)
|
||||
p.CanPublishReturns(true)
|
||||
|
||||
p.SetMetadataStub = func(m string) {
|
||||
var f func(participant types.Participant)
|
||||
|
||||
@@ -115,6 +115,10 @@ func (t *MediaTrack) IsSubscriber(subId string) bool {
|
||||
|
||||
// AddSubscriber subscribes sub to current mediaTrack
|
||||
func (t *MediaTrack) AddSubscriber(sub types.Participant) error {
|
||||
if !sub.CanSubscribe() {
|
||||
return ErrPermissionDenied
|
||||
}
|
||||
|
||||
t.lock.Lock()
|
||||
defer t.lock.Unlock()
|
||||
existingSt := t.subscribedTracks[sub.ID()]
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
@@ -43,7 +42,7 @@ func TestIsReady(t *testing.T) {
|
||||
t.Run(test.state.String(), func(t *testing.T) {
|
||||
p := &ParticipantImpl{}
|
||||
p.state.Store(test.state)
|
||||
assert.Equal(t, test.ready, p.IsReady())
|
||||
require.Equal(t, test.ready, p.IsReady())
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -82,13 +81,13 @@ func TestTrackPublishing(t *testing.T) {
|
||||
})
|
||||
p.handleTrackPublished(track)
|
||||
|
||||
assert.True(t, published)
|
||||
assert.False(t, updated)
|
||||
assert.Len(t, p.publishedTracks, 1)
|
||||
require.True(t, published)
|
||||
require.False(t, updated)
|
||||
require.Len(t, p.publishedTracks, 1)
|
||||
|
||||
track.OnCloseArgsForCall(0)()
|
||||
assert.Len(t, p.publishedTracks, 0)
|
||||
assert.True(t, updated)
|
||||
require.Len(t, p.publishedTracks, 0)
|
||||
require.True(t, updated)
|
||||
})
|
||||
|
||||
t.Run("sends back trackPublished event", func(t *testing.T) {
|
||||
@@ -97,13 +96,13 @@ func TestTrackPublishing(t *testing.T) {
|
||||
//track.IDReturns("id")
|
||||
sink := p.params.Sink.(*routingfakes.FakeMessageSink)
|
||||
p.AddTrack("cid", "webcam", livekit.TrackType_VIDEO)
|
||||
assert.Equal(t, 1, sink.WriteMessageCallCount())
|
||||
require.Equal(t, 1, sink.WriteMessageCallCount())
|
||||
res := sink.WriteMessageArgsForCall(0).(*livekit.SignalResponse)
|
||||
assert.IsType(t, &livekit.SignalResponse_TrackPublished{}, res.Message)
|
||||
require.IsType(t, &livekit.SignalResponse_TrackPublished{}, res.Message)
|
||||
published := res.Message.(*livekit.SignalResponse_TrackPublished).TrackPublished
|
||||
assert.Equal(t, "cid", published.Cid)
|
||||
assert.Equal(t, "webcam", published.Track.Name)
|
||||
assert.Equal(t, livekit.TrackType_VIDEO, published.Track.Type)
|
||||
require.Equal(t, "cid", published.Cid)
|
||||
require.Equal(t, "webcam", published.Track.Name)
|
||||
require.Equal(t, livekit.TrackType_VIDEO, published.Track.Type)
|
||||
})
|
||||
|
||||
t.Run("should not allow adding of duplicate tracks", func(t *testing.T) {
|
||||
@@ -114,7 +113,7 @@ func TestTrackPublishing(t *testing.T) {
|
||||
p.AddTrack("cid", "webcam", livekit.TrackType_VIDEO)
|
||||
p.AddTrack("cid", "duplicate", livekit.TrackType_AUDIO)
|
||||
|
||||
assert.Equal(t, 1, sink.WriteMessageCallCount())
|
||||
require.Equal(t, 1, sink.WriteMessageCallCount())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+34
-2
@@ -23,7 +23,9 @@ type Room struct {
|
||||
iceServers []*livekit.ICEServer
|
||||
lock sync.RWMutex
|
||||
// map of identity -> Participant
|
||||
participants map[string]types.Participant
|
||||
participants map[string]types.Participant
|
||||
participantOpts map[string]*ParticipantOptions
|
||||
|
||||
// time the first participant joined the room
|
||||
joinedAt atomic.Value
|
||||
// time that the last participant left the room
|
||||
@@ -40,6 +42,10 @@ type Room struct {
|
||||
onClose func()
|
||||
}
|
||||
|
||||
type ParticipantOptions struct {
|
||||
AutoSubscribe bool
|
||||
}
|
||||
|
||||
func NewRoom(room *livekit.Room, config WebRTCConfig, iceServers []*livekit.ICEServer, audioUpdateInterval uint32) *Room {
|
||||
r := &Room{
|
||||
Room: *room,
|
||||
@@ -49,6 +55,7 @@ func NewRoom(room *livekit.Room, config WebRTCConfig, iceServers []*livekit.ICES
|
||||
lock: sync.RWMutex{},
|
||||
statsReporter: NewRoomStatsReporter(room.Name),
|
||||
participants: make(map[string]types.Participant),
|
||||
participantOpts: make(map[string]*ParticipantOptions),
|
||||
}
|
||||
if r.EmptyTimeout == 0 {
|
||||
r.EmptyTimeout = DefaultEmptyTimeout
|
||||
@@ -118,7 +125,7 @@ func (r *Room) LastLeftAt() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (r *Room) Join(participant types.Participant) error {
|
||||
func (r *Room) Join(participant types.Participant, opts *ParticipantOptions) error {
|
||||
if r.isClosed.Get() {
|
||||
return ErrRoomClosed
|
||||
}
|
||||
@@ -171,6 +178,7 @@ func (r *Room) Join(participant types.Participant) error {
|
||||
"roomId", r.Sid)
|
||||
|
||||
r.participants[participant.Identity()] = participant
|
||||
r.participantOpts[participant.Identity()] = opts
|
||||
|
||||
// gather other participants and send join response
|
||||
otherParticipants := make([]types.Participant, 0, len(r.participants))
|
||||
@@ -192,6 +200,7 @@ func (r *Room) RemoveParticipant(identity string) {
|
||||
p, ok := r.participants[identity]
|
||||
if ok {
|
||||
delete(r.participants, identity)
|
||||
delete(r.participantOpts, identity)
|
||||
}
|
||||
r.lock.Unlock()
|
||||
if !ok {
|
||||
@@ -309,6 +318,22 @@ func (r *Room) OnParticipantChanged(f func(participant types.Participant)) {
|
||||
r.onParticipantChanged = f
|
||||
}
|
||||
|
||||
func (r *Room) autoSubscribe(participant types.Participant) bool {
|
||||
if !participant.CanSubscribe() {
|
||||
return false
|
||||
}
|
||||
|
||||
r.lock.RLock()
|
||||
defer r.lock.RUnlock()
|
||||
|
||||
opts := r.participantOpts[participant.Identity()]
|
||||
// default to true if no options are set
|
||||
if opts != nil && !opts.AutoSubscribe {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// a ParticipantImpl in the room added a new remoteTrack, subscribe other participants to it
|
||||
func (r *Room) onTrackAdded(participant types.Participant, track types.PublishedTrack) {
|
||||
// publish participant update, since track state is changed
|
||||
@@ -328,6 +353,9 @@ func (r *Room) onTrackAdded(participant types.Participant, track types.Published
|
||||
// not fully joined. don't subscribe yet
|
||||
continue
|
||||
}
|
||||
if !r.autoSubscribe(existingParticipant) {
|
||||
continue
|
||||
}
|
||||
|
||||
logger.Debugw("subscribing to new track",
|
||||
"source", participant.Identity(),
|
||||
@@ -374,6 +402,10 @@ func (r *Room) onDataPacket(source types.Participant, dp *livekit.DataPacket) {
|
||||
}
|
||||
|
||||
func (r *Room) subscribeToExistingTracks(p types.Participant) {
|
||||
if !r.autoSubscribe(p) {
|
||||
return
|
||||
}
|
||||
|
||||
tracksAdded := 0
|
||||
for _, op := range r.GetParticipants() {
|
||||
if p.ID() == op.ID() {
|
||||
|
||||
+38
-39
@@ -5,7 +5,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
@@ -28,15 +27,15 @@ func init() {
|
||||
func TestJoinedState(t *testing.T) {
|
||||
t.Run("new room should return joinedAt 0", func(t *testing.T) {
|
||||
rm := newRoomWithParticipants(t, testRoomOpts{num: 0})
|
||||
assert.Equal(t, int64(0), rm.FirstJoinedAt())
|
||||
assert.Equal(t, int64(0), rm.LastLeftAt())
|
||||
require.Equal(t, int64(0), rm.FirstJoinedAt())
|
||||
require.Equal(t, int64(0), rm.LastLeftAt())
|
||||
})
|
||||
|
||||
t.Run("should be current time when a participant joins", func(t *testing.T) {
|
||||
s := time.Now().Unix()
|
||||
rm := newRoomWithParticipants(t, testRoomOpts{num: 1})
|
||||
assert.Equal(t, s, rm.FirstJoinedAt())
|
||||
assert.Equal(t, int64(0), rm.LastLeftAt())
|
||||
require.Equal(t, s, rm.FirstJoinedAt())
|
||||
require.Equal(t, int64(0), rm.LastLeftAt())
|
||||
})
|
||||
|
||||
t.Run("should be set when a participant leaves", func(t *testing.T) {
|
||||
@@ -44,14 +43,14 @@ func TestJoinedState(t *testing.T) {
|
||||
p0 := rm.GetParticipants()[0]
|
||||
s := time.Now().Unix()
|
||||
rm.RemoveParticipant(p0.Identity())
|
||||
assert.Equal(t, s, rm.LastLeftAt())
|
||||
require.Equal(t, s, rm.LastLeftAt())
|
||||
})
|
||||
|
||||
t.Run("LastLeftAt should not be set when there are still participants in the room", func(t *testing.T) {
|
||||
rm := newRoomWithParticipants(t, testRoomOpts{num: 2})
|
||||
p0 := rm.GetParticipants()[0]
|
||||
rm.RemoveParticipant(p0.Identity())
|
||||
assert.EqualValues(t, 0, rm.LastLeftAt())
|
||||
require.EqualValues(t, 0, rm.LastLeftAt())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -60,13 +59,13 @@ func TestRoomJoin(t *testing.T) {
|
||||
rm := newRoomWithParticipants(t, testRoomOpts{num: numParticipants})
|
||||
pNew := newMockParticipant("new", types.DefaultProtocol)
|
||||
|
||||
rm.Join(pNew)
|
||||
rm.Join(pNew, nil)
|
||||
|
||||
// expect new participant to get a JoinReply
|
||||
info, participants, iceServers := pNew.SendJoinResponseArgsForCall(0)
|
||||
assert.Equal(t, info.Sid, rm.Sid)
|
||||
assert.Len(t, participants, numParticipants)
|
||||
assert.Len(t, rm.GetParticipants(), numParticipants+1)
|
||||
require.Equal(t, info.Sid, rm.Sid)
|
||||
require.Len(t, participants, numParticipants)
|
||||
require.Len(t, rm.GetParticipants(), numParticipants+1)
|
||||
require.NotEmpty(t, iceServers)
|
||||
})
|
||||
|
||||
@@ -75,11 +74,11 @@ func TestRoomJoin(t *testing.T) {
|
||||
rm := newRoomWithParticipants(t, testRoomOpts{num: numExisting})
|
||||
p := newMockParticipant("new", types.DefaultProtocol)
|
||||
|
||||
err := rm.Join(p)
|
||||
assert.NoError(t, err)
|
||||
err := rm.Join(p, &rtc.ParticipantOptions{AutoSubscribe: true})
|
||||
require.NoError(t, err)
|
||||
|
||||
stateChangeCB := p.OnStateChangeArgsForCall(0)
|
||||
assert.NotNil(t, stateChangeCB)
|
||||
require.NotNil(t, stateChangeCB)
|
||||
p.StateReturns(livekit.ParticipantInfo_ACTIVE)
|
||||
stateChangeCB(p, livekit.ParticipantInfo_JOINED)
|
||||
|
||||
@@ -89,9 +88,9 @@ func TestRoomJoin(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
mockP := op.(*typesfakes.FakeParticipant)
|
||||
assert.NotZero(t, mockP.AddSubscriberCallCount())
|
||||
require.NotZero(t, mockP.AddSubscriberCallCount())
|
||||
// last call should be to add the newest participant
|
||||
assert.Equal(t, p, mockP.AddSubscriberArgsForCall(mockP.AddSubscriberCallCount()-1))
|
||||
require.Equal(t, p, mockP.AddSubscriberArgsForCall(mockP.AddSubscriberCallCount()-1))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -109,19 +108,19 @@ func TestRoomJoin(t *testing.T) {
|
||||
rm.RemoveParticipant(p.Identity())
|
||||
time.Sleep(defaultDelay)
|
||||
|
||||
assert.Equal(t, p, changedParticipant)
|
||||
require.Equal(t, p, changedParticipant)
|
||||
|
||||
numUpdates := 0
|
||||
for _, op := range participants {
|
||||
if op == p || op == disconnectedParticipant {
|
||||
assert.Zero(t, p.SendParticipantUpdateCallCount())
|
||||
require.Zero(t, p.SendParticipantUpdateCallCount())
|
||||
continue
|
||||
}
|
||||
fakeP := op.(*typesfakes.FakeParticipant)
|
||||
assert.Equal(t, 1, fakeP.SendParticipantUpdateCallCount())
|
||||
require.Equal(t, 1, fakeP.SendParticipantUpdateCallCount())
|
||||
numUpdates += 1
|
||||
}
|
||||
assert.Equal(t, numParticipants-2, numUpdates)
|
||||
require.Equal(t, numParticipants-2, numUpdates)
|
||||
})
|
||||
|
||||
t.Run("cannot exceed max participants", func(t *testing.T) {
|
||||
@@ -129,8 +128,8 @@ func TestRoomJoin(t *testing.T) {
|
||||
rm.MaxParticipants = 1
|
||||
p := newMockParticipant("second", types.ProtocolVersion(0))
|
||||
|
||||
err := rm.Join(p)
|
||||
assert.Equal(t, rtc.ErrMaxParticipantsExceeded, err)
|
||||
err := rm.Join(p, nil)
|
||||
require.Equal(t, rtc.ErrMaxParticipantsExceeded, err)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -205,10 +204,10 @@ func TestRoomClosure(t *testing.T) {
|
||||
time.Sleep(defaultDelay)
|
||||
|
||||
rm.CloseIfEmpty()
|
||||
assert.Len(t, rm.GetParticipants(), 0)
|
||||
assert.True(t, isClosed)
|
||||
require.Len(t, rm.GetParticipants(), 0)
|
||||
require.True(t, isClosed)
|
||||
|
||||
assert.Equal(t, rtc.ErrRoomClosed, rm.Join(p))
|
||||
require.Equal(t, rtc.ErrRoomClosed, rm.Join(p, nil))
|
||||
})
|
||||
|
||||
t.Run("room does not close before empty timeout", func(t *testing.T) {
|
||||
@@ -217,9 +216,9 @@ func TestRoomClosure(t *testing.T) {
|
||||
rm.OnClose(func() {
|
||||
isClosed = true
|
||||
})
|
||||
assert.NotZero(t, rm.EmptyTimeout)
|
||||
require.NotZero(t, rm.EmptyTimeout)
|
||||
rm.CloseIfEmpty()
|
||||
assert.False(t, isClosed)
|
||||
require.False(t, isClosed)
|
||||
})
|
||||
|
||||
t.Run("room closes after empty timeout", func(t *testing.T) {
|
||||
@@ -232,7 +231,7 @@ func TestRoomClosure(t *testing.T) {
|
||||
|
||||
time.Sleep(1010 * time.Millisecond)
|
||||
rm.CloseIfEmpty()
|
||||
assert.True(t, isClosed)
|
||||
require.True(t, isClosed)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -250,11 +249,11 @@ func TestNewTrack(t *testing.T) {
|
||||
// p3 adds track
|
||||
track := newMockTrack(livekit.TrackType_VIDEO, "webcam")
|
||||
trackCB := pub.OnTrackPublishedArgsForCall(0)
|
||||
assert.NotNil(t, trackCB)
|
||||
require.NotNil(t, trackCB)
|
||||
trackCB(pub, track)
|
||||
// only p2 should've been called
|
||||
assert.Equal(t, 1, track.AddSubscriberCallCount())
|
||||
assert.Equal(t, p1, track.AddSubscriberArgsForCall(0))
|
||||
require.Equal(t, 1, track.AddSubscriberCallCount())
|
||||
require.Equal(t, p1, track.AddSubscriberArgsForCall(0))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -273,16 +272,16 @@ func TestActiveSpeakers(t *testing.T) {
|
||||
return updates
|
||||
}
|
||||
|
||||
audioUpdateDuration := (audioUpdateInterval + 2) * time.Millisecond
|
||||
audioUpdateDuration := (audioUpdateInterval + 10) * time.Millisecond
|
||||
t.Run("participant should not be getting audio updates (protocol 2)", func(t *testing.T) {
|
||||
rm := newRoomWithParticipants(t, testRoomOpts{num: 1, protocol: types.DefaultProtocol})
|
||||
p := rm.GetParticipants()[0].(*typesfakes.FakeParticipant)
|
||||
assert.Empty(t, rm.GetActiveSpeakers())
|
||||
require.Empty(t, rm.GetActiveSpeakers())
|
||||
|
||||
time.Sleep(audioUpdateDuration)
|
||||
|
||||
updates := getActiveSpeakerUpdates(p)
|
||||
assert.Empty(t, updates)
|
||||
require.Empty(t, updates)
|
||||
})
|
||||
|
||||
t.Run("speakers should be sorted by loudness (protocol 0)", func(t *testing.T) {
|
||||
@@ -294,9 +293,9 @@ func TestActiveSpeakers(t *testing.T) {
|
||||
p2.GetAudioLevelReturns(20, true)
|
||||
|
||||
speakers := rm.GetActiveSpeakers()
|
||||
assert.Len(t, speakers, 2)
|
||||
assert.Equal(t, p.ID(), speakers[0].Sid)
|
||||
assert.Equal(t, p2.ID(), speakers[1].Sid)
|
||||
require.Len(t, speakers, 2)
|
||||
require.Equal(t, p.ID(), speakers[0].Sid)
|
||||
require.Equal(t, p2.ID(), speakers[1].Sid)
|
||||
})
|
||||
|
||||
t.Run("participants are getting audio updates (protocol 2)", func(t *testing.T) {
|
||||
@@ -357,9 +356,9 @@ func newRoomWithParticipants(t *testing.T, opts testRoomOpts) *rtc.Room {
|
||||
for i := 0; i < opts.num; i++ {
|
||||
identity := fmt.Sprintf("p%d", i)
|
||||
participant := newMockParticipant(identity, opts.protocol)
|
||||
err := rm.Join(participant)
|
||||
err := rm.Join(participant, &rtc.ParticipantOptions{AutoSubscribe: true})
|
||||
participant.StateReturns(livekit.ParticipantInfo_ACTIVE)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
return rm
|
||||
}
|
||||
@@ -62,7 +62,7 @@ func TestMissingAnswerDuringICERestart(t *testing.T) {
|
||||
ICERestart: true,
|
||||
}))
|
||||
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
require.Equal(t, webrtc.ICEConnectionStateConnected, transportA.pc.ICEConnectionState())
|
||||
require.Equal(t, webrtc.ICEConnectionStateConnected, transportB.pc.ICEConnectionState())
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ type Participant interface {
|
||||
GetAudioLevel() (level uint8, noisy bool)
|
||||
|
||||
// permissions
|
||||
|
||||
CanPublish() bool
|
||||
CanSubscribe() bool
|
||||
|
||||
@@ -61,6 +62,7 @@ type Participant interface {
|
||||
Close() error
|
||||
|
||||
// callbacks
|
||||
|
||||
OnStateChange(func(p Participant, oldState livekit.ParticipantInfo_State))
|
||||
// OnTrackPublished - remote added a remoteTrack
|
||||
OnTrackPublished(func(Participant, PublishedTrack))
|
||||
@@ -71,6 +73,7 @@ type Participant interface {
|
||||
OnClose(func(Participant))
|
||||
|
||||
// package methods
|
||||
|
||||
AddSubscribedTrack(participantId string, st SubscribedTrack)
|
||||
RemoveSubscribedTrack(participantId string, st SubscribedTrack)
|
||||
SubscriberPC() *webrtc.PeerConnection
|
||||
|
||||
@@ -3,16 +3,16 @@ package rtc
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPackStreamId(t *testing.T) {
|
||||
packed := "PA_123abc|uuid-id"
|
||||
pId, trackId := UnpackStreamID(packed)
|
||||
assert.Equal(t, "PA_123abc", pId)
|
||||
assert.Equal(t, "uuid-id", trackId)
|
||||
require.Equal(t, "PA_123abc", pId)
|
||||
require.Equal(t, "uuid-id", trackId)
|
||||
|
||||
assert.Equal(t, packed, PackStreamID(pId, trackId))
|
||||
require.Equal(t, packed, PackStreamID(pId, trackId))
|
||||
}
|
||||
|
||||
func TestPackDataTrackLabel(t *testing.T) {
|
||||
@@ -20,10 +20,10 @@ func TestPackDataTrackLabel(t *testing.T) {
|
||||
trackId := "TR_b3da25"
|
||||
label := "trackLabel"
|
||||
packed := "PA_123abc|TR_b3da25|trackLabel"
|
||||
assert.Equal(t, packed, PackDataTrackLabel(pId, trackId, label))
|
||||
require.Equal(t, packed, PackDataTrackLabel(pId, trackId, label))
|
||||
|
||||
p, tr, l := UnpackDataTrackLabel(packed)
|
||||
assert.Equal(t, pId, p)
|
||||
assert.Equal(t, trackId, tr)
|
||||
assert.Equal(t, label, l)
|
||||
require.Equal(t, pId, p)
|
||||
require.Equal(t, trackId, tr)
|
||||
require.Equal(t, label, l)
|
||||
}
|
||||
@@ -5,11 +5,10 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/service"
|
||||
"github.com/livekit/protocol/auth"
|
||||
"github.com/livekit/protocol/auth/authfakes"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAuthMiddleware(t *testing.T) {
|
||||
@@ -30,23 +29,23 @@ func TestAuthMiddleware(t *testing.T) {
|
||||
at := auth.NewAccessToken(api, secret).
|
||||
AddGrant(orig)
|
||||
token, err := at.ToJWT()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
r := &http.Request{Header: http.Header{}}
|
||||
w := httptest.NewRecorder()
|
||||
service.SetAuthorizationToken(r, token)
|
||||
m.ServeHTTP(w, r, handler)
|
||||
|
||||
assert.NotNil(t, grants)
|
||||
assert.EqualValues(t, orig, grants.Video)
|
||||
require.NotNil(t, grants)
|
||||
require.EqualValues(t, orig, grants.Video)
|
||||
|
||||
// no authorization == no claims
|
||||
grants = nil
|
||||
w = httptest.NewRecorder()
|
||||
r = &http.Request{Header: http.Header{}}
|
||||
m.ServeHTTP(w, r, handler)
|
||||
assert.Nil(t, grants)
|
||||
assert.Equal(t, http.StatusOK, w.Code)
|
||||
require.Nil(t, grants)
|
||||
require.Equal(t, http.StatusOK, w.Code)
|
||||
|
||||
// incorrect authorization: error
|
||||
grants = nil
|
||||
@@ -54,6 +53,6 @@ func TestAuthMiddleware(t *testing.T) {
|
||||
r = &http.Request{Header: http.Header{}}
|
||||
service.SetAuthorizationToken(r, "invalid token")
|
||||
m.ServeHTTP(w, r, handler)
|
||||
assert.Nil(t, grants)
|
||||
assert.Equal(t, http.StatusUnauthorized, w.Code)
|
||||
require.Nil(t, grants)
|
||||
require.Equal(t, http.StatusUnauthorized, w.Code)
|
||||
}
|
||||
@@ -3,10 +3,9 @@ package service_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/service"
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestParticipantPersisence(t *testing.T) {
|
||||
@@ -33,28 +32,28 @@ func TestParticipantPersisence(t *testing.T) {
|
||||
}
|
||||
|
||||
// create the participant
|
||||
assert.NoError(t, rs.PersistParticipant(roomName, p))
|
||||
require.NoError(t, rs.PersistParticipant(roomName, p))
|
||||
|
||||
// result should match
|
||||
pGet, err := rs.GetParticipant(roomName, p.Identity)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, p.Identity, pGet.Identity)
|
||||
assert.Equal(t, len(p.Tracks), len(pGet.Tracks))
|
||||
assert.Equal(t, p.Tracks[0].Sid, pGet.Tracks[0].Sid)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, p.Identity, pGet.Identity)
|
||||
require.Equal(t, len(p.Tracks), len(pGet.Tracks))
|
||||
require.Equal(t, p.Tracks[0].Sid, pGet.Tracks[0].Sid)
|
||||
|
||||
// list should return one participant
|
||||
participants, err := rs.ListParticipants(roomName)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, participants, 1)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, participants, 1)
|
||||
|
||||
// deleting participant should return back to normal
|
||||
assert.NoError(t, rs.DeleteParticipant(roomName, p.Identity))
|
||||
require.NoError(t, rs.DeleteParticipant(roomName, p.Identity))
|
||||
|
||||
participants, err = rs.ListParticipants(roomName)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, participants, 0)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, participants, 0)
|
||||
|
||||
// shouldn't be able to get it
|
||||
_, err = rs.GetParticipant(roomName, p.Identity)
|
||||
assert.Equal(t, err, service.ErrParticipantNotFound)
|
||||
require.Equal(t, err, service.ErrParticipantNotFound)
|
||||
}
|
||||
@@ -260,7 +260,10 @@ func (r *RoomManager) StartSession(roomName string, pi routing.ParticipantInit,
|
||||
}
|
||||
|
||||
// join room
|
||||
if err := room.Join(participant); err != nil {
|
||||
opts := rtc.ParticipantOptions{
|
||||
AutoSubscribe: pi.AutoSubscribe,
|
||||
}
|
||||
if err := room.Join(participant, &opts); err != nil {
|
||||
logger.Errorw("could not join room", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
roomName := r.FormValue("room")
|
||||
reconnectParam := r.FormValue("reconnect")
|
||||
protocolParam := r.FormValue("protocol")
|
||||
autoSubParam := r.FormValue("auto_subscribe")
|
||||
planBParam := r.FormValue("planb")
|
||||
|
||||
claims := GetGrants(r.Context())
|
||||
@@ -66,10 +67,18 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
pi := routing.ParticipantInit{
|
||||
Reconnect: boolValue(reconnectParam),
|
||||
Identity: claims.Identity,
|
||||
UsePlanB: boolValue(planBParam),
|
||||
Reconnect: boolValue(reconnectParam),
|
||||
Identity: claims.Identity,
|
||||
UsePlanB: boolValue(planBParam),
|
||||
AutoSubscribe: true,
|
||||
}
|
||||
if autoSubParam != "" {
|
||||
pi.AutoSubscribe = boolValue(autoSubParam)
|
||||
}
|
||||
if pv, err := strconv.Atoi(protocolParam); err == nil {
|
||||
pi.ProtocolVersion = int32(pv)
|
||||
}
|
||||
|
||||
// only use permissions if any of them are set, default permissive
|
||||
if claims.Video.CanPublish || claims.Video.CanSubscribe {
|
||||
pi.Permission = &livekit.ParticipantPermission{
|
||||
@@ -77,9 +86,6 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
CanPublish: claims.Video.CanPublish,
|
||||
}
|
||||
}
|
||||
if pv, err := strconv.Atoi(protocolParam); err == nil {
|
||||
pi.ProtocolVersion = int32(pv)
|
||||
}
|
||||
|
||||
onlyName, err := EnsureJoinPermission(r.Context())
|
||||
if err != nil {
|
||||
|
||||
@@ -1,877 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.15.8
|
||||
// source: livekit_internal.proto
|
||||
|
||||
package livekit
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
NumCpus uint32 `protobuf:"varint,3,opt,name=num_cpus,json=numCpus,proto3" json:"num_cpus,omitempty"`
|
||||
Stats *NodeStats `protobuf:"bytes,4,opt,name=stats,proto3" json:"stats,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Node) Reset() {
|
||||
*x = Node{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_internal_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Node) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Node) ProtoMessage() {}
|
||||
|
||||
func (x *Node) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_internal_proto_msgTypes[0]
|
||||
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 Node.ProtoReflect.Descriptor instead.
|
||||
func (*Node) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_internal_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Node) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetNumCpus() uint32 {
|
||||
if x != nil {
|
||||
return x.NumCpus
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Node) GetStats() *NodeStats {
|
||||
if x != nil {
|
||||
return x.Stats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NodeStats struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// when server was started
|
||||
StartedAt int64 `protobuf:"varint,1,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
|
||||
// when server last reported its status
|
||||
UpdatedAt int64 `protobuf:"varint,2,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
|
||||
NumRooms uint32 `protobuf:"varint,3,opt,name=num_rooms,json=numRooms,proto3" json:"num_rooms,omitempty"`
|
||||
NumClients uint32 `protobuf:"varint,4,opt,name=num_clients,json=numClients,proto3" json:"num_clients,omitempty"`
|
||||
NumTracksIn uint32 `protobuf:"varint,5,opt,name=num_tracks_in,json=numTracksIn,proto3" json:"num_tracks_in,omitempty"`
|
||||
NumTracksOut uint32 `protobuf:"varint,6,opt,name=num_tracks_out,json=numTracksOut,proto3" json:"num_tracks_out,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeStats) Reset() {
|
||||
*x = NodeStats{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_internal_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeStats) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeStats) ProtoMessage() {}
|
||||
|
||||
func (x *NodeStats) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_internal_proto_msgTypes[1]
|
||||
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 NodeStats.ProtoReflect.Descriptor instead.
|
||||
func (*NodeStats) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_internal_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *NodeStats) GetStartedAt() int64 {
|
||||
if x != nil {
|
||||
return x.StartedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeStats) GetUpdatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeStats) GetNumRooms() uint32 {
|
||||
if x != nil {
|
||||
return x.NumRooms
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeStats) GetNumClients() uint32 {
|
||||
if x != nil {
|
||||
return x.NumClients
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeStats) GetNumTracksIn() uint32 {
|
||||
if x != nil {
|
||||
return x.NumTracksIn
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeStats) GetNumTracksOut() uint32 {
|
||||
if x != nil {
|
||||
return x.NumTracksOut
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// message to RTC nodes
|
||||
type RTCNodeMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ParticipantKey string `protobuf:"bytes,1,opt,name=participant_key,json=participantKey,proto3" json:"participant_key,omitempty"`
|
||||
// Types that are assignable to Message:
|
||||
// *RTCNodeMessage_StartSession
|
||||
// *RTCNodeMessage_Request
|
||||
// *RTCNodeMessage_RemoveParticipant
|
||||
// *RTCNodeMessage_MuteTrack
|
||||
// *RTCNodeMessage_UpdateParticipant
|
||||
// *RTCNodeMessage_DeleteRoom
|
||||
Message isRTCNodeMessage_Message `protobuf_oneof:"message"`
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) Reset() {
|
||||
*x = RTCNodeMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_internal_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RTCNodeMessage) ProtoMessage() {}
|
||||
|
||||
func (x *RTCNodeMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_internal_proto_msgTypes[2]
|
||||
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 RTCNodeMessage.ProtoReflect.Descriptor instead.
|
||||
func (*RTCNodeMessage) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_internal_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) GetParticipantKey() string {
|
||||
if x != nil {
|
||||
return x.ParticipantKey
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *RTCNodeMessage) GetMessage() isRTCNodeMessage_Message {
|
||||
if m != nil {
|
||||
return m.Message
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) GetStartSession() *StartSession {
|
||||
if x, ok := x.GetMessage().(*RTCNodeMessage_StartSession); ok {
|
||||
return x.StartSession
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) GetRequest() *SignalRequest {
|
||||
if x, ok := x.GetMessage().(*RTCNodeMessage_Request); ok {
|
||||
return x.Request
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) GetRemoveParticipant() *RoomParticipantIdentity {
|
||||
if x, ok := x.GetMessage().(*RTCNodeMessage_RemoveParticipant); ok {
|
||||
return x.RemoveParticipant
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) GetMuteTrack() *MuteRoomTrackRequest {
|
||||
if x, ok := x.GetMessage().(*RTCNodeMessage_MuteTrack); ok {
|
||||
return x.MuteTrack
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) GetUpdateParticipant() *UpdateParticipantRequest {
|
||||
if x, ok := x.GetMessage().(*RTCNodeMessage_UpdateParticipant); ok {
|
||||
return x.UpdateParticipant
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RTCNodeMessage) GetDeleteRoom() *DeleteRoomRequest {
|
||||
if x, ok := x.GetMessage().(*RTCNodeMessage_DeleteRoom); ok {
|
||||
return x.DeleteRoom
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isRTCNodeMessage_Message interface {
|
||||
isRTCNodeMessage_Message()
|
||||
}
|
||||
|
||||
type RTCNodeMessage_StartSession struct {
|
||||
StartSession *StartSession `protobuf:"bytes,2,opt,name=start_session,json=startSession,proto3,oneof"`
|
||||
}
|
||||
|
||||
type RTCNodeMessage_Request struct {
|
||||
Request *SignalRequest `protobuf:"bytes,3,opt,name=request,proto3,oneof"`
|
||||
}
|
||||
|
||||
type RTCNodeMessage_RemoveParticipant struct {
|
||||
// internal messages
|
||||
RemoveParticipant *RoomParticipantIdentity `protobuf:"bytes,4,opt,name=remove_participant,json=removeParticipant,proto3,oneof"`
|
||||
}
|
||||
|
||||
type RTCNodeMessage_MuteTrack struct {
|
||||
MuteTrack *MuteRoomTrackRequest `protobuf:"bytes,5,opt,name=mute_track,json=muteTrack,proto3,oneof"`
|
||||
}
|
||||
|
||||
type RTCNodeMessage_UpdateParticipant struct {
|
||||
UpdateParticipant *UpdateParticipantRequest `protobuf:"bytes,6,opt,name=update_participant,json=updateParticipant,proto3,oneof"`
|
||||
}
|
||||
|
||||
type RTCNodeMessage_DeleteRoom struct {
|
||||
DeleteRoom *DeleteRoomRequest `protobuf:"bytes,7,opt,name=delete_room,json=deleteRoom,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*RTCNodeMessage_StartSession) isRTCNodeMessage_Message() {}
|
||||
|
||||
func (*RTCNodeMessage_Request) isRTCNodeMessage_Message() {}
|
||||
|
||||
func (*RTCNodeMessage_RemoveParticipant) isRTCNodeMessage_Message() {}
|
||||
|
||||
func (*RTCNodeMessage_MuteTrack) isRTCNodeMessage_Message() {}
|
||||
|
||||
func (*RTCNodeMessage_UpdateParticipant) isRTCNodeMessage_Message() {}
|
||||
|
||||
func (*RTCNodeMessage_DeleteRoom) isRTCNodeMessage_Message() {}
|
||||
|
||||
// message to Signal nodes
|
||||
type SignalNodeMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"`
|
||||
// Types that are assignable to Message:
|
||||
// *SignalNodeMessage_Response
|
||||
// *SignalNodeMessage_EndSession
|
||||
Message isSignalNodeMessage_Message `protobuf_oneof:"message"`
|
||||
}
|
||||
|
||||
func (x *SignalNodeMessage) Reset() {
|
||||
*x = SignalNodeMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_internal_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SignalNodeMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SignalNodeMessage) ProtoMessage() {}
|
||||
|
||||
func (x *SignalNodeMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_internal_proto_msgTypes[3]
|
||||
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 SignalNodeMessage.ProtoReflect.Descriptor instead.
|
||||
func (*SignalNodeMessage) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_internal_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *SignalNodeMessage) GetConnectionId() string {
|
||||
if x != nil {
|
||||
return x.ConnectionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *SignalNodeMessage) GetMessage() isSignalNodeMessage_Message {
|
||||
if m != nil {
|
||||
return m.Message
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignalNodeMessage) GetResponse() *SignalResponse {
|
||||
if x, ok := x.GetMessage().(*SignalNodeMessage_Response); ok {
|
||||
return x.Response
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignalNodeMessage) GetEndSession() *EndSession {
|
||||
if x, ok := x.GetMessage().(*SignalNodeMessage_EndSession); ok {
|
||||
return x.EndSession
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isSignalNodeMessage_Message interface {
|
||||
isSignalNodeMessage_Message()
|
||||
}
|
||||
|
||||
type SignalNodeMessage_Response struct {
|
||||
Response *SignalResponse `protobuf:"bytes,2,opt,name=response,proto3,oneof"`
|
||||
}
|
||||
|
||||
type SignalNodeMessage_EndSession struct {
|
||||
EndSession *EndSession `protobuf:"bytes,3,opt,name=end_session,json=endSession,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*SignalNodeMessage_Response) isSignalNodeMessage_Message() {}
|
||||
|
||||
func (*SignalNodeMessage_EndSession) isSignalNodeMessage_Message() {}
|
||||
|
||||
type StartSession struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RoomName string `protobuf:"bytes,1,opt,name=room_name,json=roomName,proto3" json:"room_name,omitempty"`
|
||||
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||
ConnectionId string `protobuf:"bytes,3,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"`
|
||||
// if a client is reconnecting (i.e. resume instead of restart)
|
||||
Reconnect bool `protobuf:"varint,4,opt,name=reconnect,proto3" json:"reconnect,omitempty"`
|
||||
// metadata to pass to participant
|
||||
Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
Permission *ParticipantPermission `protobuf:"bytes,6,opt,name=permission,proto3" json:"permission,omitempty"`
|
||||
ProtocolVersion int32 `protobuf:"varint,7,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
|
||||
UsePlanB bool `protobuf:"varint,8,opt,name=use_plan_b,json=usePlanB,proto3" json:"use_plan_b,omitempty"`
|
||||
}
|
||||
|
||||
func (x *StartSession) Reset() {
|
||||
*x = StartSession{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_internal_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StartSession) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StartSession) ProtoMessage() {}
|
||||
|
||||
func (x *StartSession) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_internal_proto_msgTypes[4]
|
||||
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 StartSession.ProtoReflect.Descriptor instead.
|
||||
func (*StartSession) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_internal_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *StartSession) GetRoomName() string {
|
||||
if x != nil {
|
||||
return x.RoomName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StartSession) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StartSession) GetConnectionId() string {
|
||||
if x != nil {
|
||||
return x.ConnectionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StartSession) GetReconnect() bool {
|
||||
if x != nil {
|
||||
return x.Reconnect
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *StartSession) GetMetadata() string {
|
||||
if x != nil {
|
||||
return x.Metadata
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StartSession) GetPermission() *ParticipantPermission {
|
||||
if x != nil {
|
||||
return x.Permission
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *StartSession) GetProtocolVersion() int32 {
|
||||
if x != nil {
|
||||
return x.ProtocolVersion
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *StartSession) GetUsePlanB() bool {
|
||||
if x != nil {
|
||||
return x.UsePlanB
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type EndSession struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *EndSession) Reset() {
|
||||
*x = EndSession{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_internal_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EndSession) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*EndSession) ProtoMessage() {}
|
||||
|
||||
func (x *EndSession) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_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 EndSession.ProtoReflect.Descriptor instead.
|
||||
func (*EndSession) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_internal_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
type RemoveParticipant struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ParticipantId string `protobuf:"bytes,1,opt,name=participant_id,json=participantId,proto3" json:"participant_id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RemoveParticipant) Reset() {
|
||||
*x = RemoveParticipant{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_internal_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RemoveParticipant) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RemoveParticipant) ProtoMessage() {}
|
||||
|
||||
func (x *RemoveParticipant) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_internal_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RemoveParticipant.ProtoReflect.Descriptor instead.
|
||||
func (*RemoveParticipant) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_internal_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *RemoveParticipant) GetParticipantId() string {
|
||||
if x != nil {
|
||||
return x.ParticipantId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_livekit_internal_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_livekit_internal_proto_rawDesc = []byte{
|
||||
0x0a, 0x16, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
|
||||
0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69,
|
||||
0x74, 0x1a, 0x11, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x72, 0x74, 0x63, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x72, 0x6f,
|
||||
0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6b, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70,
|
||||
0x12, 0x19, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x43, 0x70, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x05, 0x73,
|
||||
0x74, 0x61, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76,
|
||||
0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05,
|
||||
0x73, 0x74, 0x61, 0x74, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x09, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74,
|
||||
0x61, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61,
|
||||
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64,
|
||||
0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41,
|
||||
0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x6f, 0x6f, 0x6d, 0x73, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x12, 0x1f,
|
||||
0x0a, 0x0b, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6e, 0x75, 0x6d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x12,
|
||||
0x22, 0x0a, 0x0d, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x5f, 0x69, 0x6e,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b,
|
||||
0x73, 0x49, 0x6e, 0x12, 0x24, 0x0a, 0x0e, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b,
|
||||
0x73, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6e, 0x75, 0x6d,
|
||||
0x54, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x4f, 0x75, 0x74, 0x22, 0xdc, 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, 0x61, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61,
|
||||
0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x3c, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x73,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c,
|
||||
0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x07,
|
||||
0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, 0x12, 0x72, 0x65, 0x6d, 0x6f, 0x76,
|
||||
0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f,
|
||||
0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x65,
|
||||
0x6e, 0x74, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50,
|
||||
0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x0a, 0x6d, 0x75,
|
||||
0x74, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d,
|
||||
0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x6f,
|
||||
0x6d, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52,
|
||||
0x09, 0x6d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x52, 0x0a, 0x12, 0x75, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 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, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x11, 0x75, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x3d,
|
||||
0x0a, 0x0b, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x07, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48,
|
||||
0x00, 0x52, 0x0a, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x42, 0x09, 0x0a,
|
||||
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xb2, 0x01, 0x0a, 0x11, 0x53, 0x69, 0x67,
|
||||
0x6e, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e,
|
||||
0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00,
|
||||
0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x0b, 0x65, 0x6e,
|
||||
0x64, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x13, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x45, 0x6e, 0x64, 0x53, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xaf, 0x02,
|
||||
0x0a, 0x0c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1b,
|
||||
0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69,
|
||||
0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69,
|
||||
0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
|
||||
0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09,
|
||||
0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x09, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65,
|
||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65,
|
||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x76,
|
||||
0x65, 0x6b, 0x69, 0x74, 0x2e, 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, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
||||
0x6f, 0x6c, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x1c, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x5f, 0x62, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x73, 0x65, 0x50, 0x6c, 0x61, 0x6e, 0x42, 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 (
|
||||
file_livekit_internal_proto_rawDescOnce sync.Once
|
||||
file_livekit_internal_proto_rawDescData = file_livekit_internal_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_livekit_internal_proto_rawDescGZIP() []byte {
|
||||
file_livekit_internal_proto_rawDescOnce.Do(func() {
|
||||
file_livekit_internal_proto_rawDescData = protoimpl.X.CompressGZIP(file_livekit_internal_proto_rawDescData)
|
||||
})
|
||||
return file_livekit_internal_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_livekit_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||
var file_livekit_internal_proto_goTypes = []interface{}{
|
||||
(*Node)(nil), // 0: livekit.Node
|
||||
(*NodeStats)(nil), // 1: livekit.NodeStats
|
||||
(*RTCNodeMessage)(nil), // 2: livekit.RTCNodeMessage
|
||||
(*SignalNodeMessage)(nil), // 3: livekit.SignalNodeMessage
|
||||
(*StartSession)(nil), // 4: livekit.StartSession
|
||||
(*EndSession)(nil), // 5: livekit.EndSession
|
||||
(*RemoveParticipant)(nil), // 6: livekit.RemoveParticipant
|
||||
(*SignalRequest)(nil), // 7: livekit.SignalRequest
|
||||
(*RoomParticipantIdentity)(nil), // 8: livekit.RoomParticipantIdentity
|
||||
(*MuteRoomTrackRequest)(nil), // 9: livekit.MuteRoomTrackRequest
|
||||
(*UpdateParticipantRequest)(nil), // 10: livekit.UpdateParticipantRequest
|
||||
(*DeleteRoomRequest)(nil), // 11: livekit.DeleteRoomRequest
|
||||
(*SignalResponse)(nil), // 12: livekit.SignalResponse
|
||||
(*ParticipantPermission)(nil), // 13: livekit.ParticipantPermission
|
||||
}
|
||||
var file_livekit_internal_proto_depIdxs = []int32{
|
||||
1, // 0: livekit.Node.stats:type_name -> livekit.NodeStats
|
||||
4, // 1: livekit.RTCNodeMessage.start_session:type_name -> livekit.StartSession
|
||||
7, // 2: livekit.RTCNodeMessage.request:type_name -> livekit.SignalRequest
|
||||
8, // 3: livekit.RTCNodeMessage.remove_participant:type_name -> livekit.RoomParticipantIdentity
|
||||
9, // 4: livekit.RTCNodeMessage.mute_track:type_name -> livekit.MuteRoomTrackRequest
|
||||
10, // 5: livekit.RTCNodeMessage.update_participant:type_name -> livekit.UpdateParticipantRequest
|
||||
11, // 6: livekit.RTCNodeMessage.delete_room:type_name -> livekit.DeleteRoomRequest
|
||||
12, // 7: livekit.SignalNodeMessage.response:type_name -> livekit.SignalResponse
|
||||
5, // 8: livekit.SignalNodeMessage.end_session:type_name -> livekit.EndSession
|
||||
13, // 9: livekit.StartSession.permission:type_name -> livekit.ParticipantPermission
|
||||
10, // [10:10] is the sub-list for method output_type
|
||||
10, // [10:10] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_livekit_internal_proto_init() }
|
||||
func file_livekit_internal_proto_init() {
|
||||
if File_livekit_internal_proto != nil {
|
||||
return
|
||||
}
|
||||
file_livekit_rtc_proto_init()
|
||||
file_livekit_room_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_livekit_internal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Node); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_livekit_internal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeStats); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_livekit_internal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RTCNodeMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_livekit_internal_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignalNodeMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_livekit_internal_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StartSession); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_livekit_internal_proto_msgTypes[5].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_livekit_internal_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RemoveParticipant); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
file_livekit_internal_proto_msgTypes[2].OneofWrappers = []interface{}{
|
||||
(*RTCNodeMessage_StartSession)(nil),
|
||||
(*RTCNodeMessage_Request)(nil),
|
||||
(*RTCNodeMessage_RemoveParticipant)(nil),
|
||||
(*RTCNodeMessage_MuteTrack)(nil),
|
||||
(*RTCNodeMessage_UpdateParticipant)(nil),
|
||||
(*RTCNodeMessage_DeleteRoom)(nil),
|
||||
}
|
||||
file_livekit_internal_proto_msgTypes[3].OneofWrappers = []interface{}{
|
||||
(*SignalNodeMessage_Response)(nil),
|
||||
(*SignalNodeMessage_EndSession)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_livekit_internal_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 7,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_livekit_internal_proto_goTypes,
|
||||
DependencyIndexes: file_livekit_internal_proto_depIdxs,
|
||||
MessageInfos: file_livekit_internal_proto_msgTypes,
|
||||
}.Build()
|
||||
File_livekit_internal_proto = out.File
|
||||
file_livekit_internal_proto_rawDesc = nil
|
||||
file_livekit_internal_proto_goTypes = nil
|
||||
file_livekit_internal_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,622 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.15.8
|
||||
// source: livekit_models.proto
|
||||
|
||||
package livekit
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type TrackType int32
|
||||
|
||||
const (
|
||||
TrackType_AUDIO TrackType = 0
|
||||
TrackType_VIDEO TrackType = 1
|
||||
TrackType_DATA TrackType = 2
|
||||
)
|
||||
|
||||
// Enum value maps for TrackType.
|
||||
var (
|
||||
TrackType_name = map[int32]string{
|
||||
0: "AUDIO",
|
||||
1: "VIDEO",
|
||||
2: "DATA",
|
||||
}
|
||||
TrackType_value = map[string]int32{
|
||||
"AUDIO": 0,
|
||||
"VIDEO": 1,
|
||||
"DATA": 2,
|
||||
}
|
||||
)
|
||||
|
||||
func (x TrackType) Enum() *TrackType {
|
||||
p := new(TrackType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x TrackType) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (TrackType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_livekit_models_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (TrackType) Type() protoreflect.EnumType {
|
||||
return &file_livekit_models_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x TrackType) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use TrackType.Descriptor instead.
|
||||
func (TrackType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_livekit_models_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type ParticipantInfo_State int32
|
||||
|
||||
const (
|
||||
// websocket' connected, but not offered yet
|
||||
ParticipantInfo_JOINING ParticipantInfo_State = 0
|
||||
// server received client offer
|
||||
ParticipantInfo_JOINED ParticipantInfo_State = 1
|
||||
// ICE connectivity established
|
||||
ParticipantInfo_ACTIVE ParticipantInfo_State = 2
|
||||
// WS disconnected
|
||||
ParticipantInfo_DISCONNECTED ParticipantInfo_State = 3
|
||||
)
|
||||
|
||||
// Enum value maps for ParticipantInfo_State.
|
||||
var (
|
||||
ParticipantInfo_State_name = map[int32]string{
|
||||
0: "JOINING",
|
||||
1: "JOINED",
|
||||
2: "ACTIVE",
|
||||
3: "DISCONNECTED",
|
||||
}
|
||||
ParticipantInfo_State_value = map[string]int32{
|
||||
"JOINING": 0,
|
||||
"JOINED": 1,
|
||||
"ACTIVE": 2,
|
||||
"DISCONNECTED": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x ParticipantInfo_State) Enum() *ParticipantInfo_State {
|
||||
p := new(ParticipantInfo_State)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x ParticipantInfo_State) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (ParticipantInfo_State) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_livekit_models_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (ParticipantInfo_State) Type() protoreflect.EnumType {
|
||||
return &file_livekit_models_proto_enumTypes[1]
|
||||
}
|
||||
|
||||
func (x ParticipantInfo_State) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ParticipantInfo_State.Descriptor instead.
|
||||
func (ParticipantInfo_State) EnumDescriptor() ([]byte, []int) {
|
||||
return file_livekit_models_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
type Room struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
EmptyTimeout uint32 `protobuf:"varint,3,opt,name=empty_timeout,json=emptyTimeout,proto3" json:"empty_timeout,omitempty"`
|
||||
MaxParticipants uint32 `protobuf:"varint,4,opt,name=max_participants,json=maxParticipants,proto3" json:"max_participants,omitempty"`
|
||||
CreationTime int64 `protobuf:"varint,5,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"`
|
||||
TurnPassword string `protobuf:"bytes,6,opt,name=turn_password,json=turnPassword,proto3" json:"turn_password,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Room) Reset() {
|
||||
*x = Room{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_models_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Room) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Room) ProtoMessage() {}
|
||||
|
||||
func (x *Room) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_models_proto_msgTypes[0]
|
||||
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 Room.ProtoReflect.Descriptor instead.
|
||||
func (*Room) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_models_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Room) GetSid() string {
|
||||
if x != nil {
|
||||
return x.Sid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Room) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Room) GetEmptyTimeout() uint32 {
|
||||
if x != nil {
|
||||
return x.EmptyTimeout
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Room) GetMaxParticipants() uint32 {
|
||||
if x != nil {
|
||||
return x.MaxParticipants
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Room) GetCreationTime() int64 {
|
||||
if x != nil {
|
||||
return x.CreationTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Room) GetTurnPassword() string {
|
||||
if x != nil {
|
||||
return x.TurnPassword
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ParticipantInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
|
||||
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||
State ParticipantInfo_State `protobuf:"varint,3,opt,name=state,proto3,enum=livekit.ParticipantInfo_State" json:"state,omitempty"`
|
||||
Tracks []*TrackInfo `protobuf:"bytes,4,rep,name=tracks,proto3" json:"tracks,omitempty"`
|
||||
Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
// timestamp when participant joined room
|
||||
JoinedAt int64 `protobuf:"varint,6,opt,name=joined_at,json=joinedAt,proto3" json:"joined_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) Reset() {
|
||||
*x = ParticipantInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_models_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ParticipantInfo) ProtoMessage() {}
|
||||
|
||||
func (x *ParticipantInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_models_proto_msgTypes[1]
|
||||
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 ParticipantInfo.ProtoReflect.Descriptor instead.
|
||||
func (*ParticipantInfo) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_models_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) GetSid() string {
|
||||
if x != nil {
|
||||
return x.Sid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) GetState() ParticipantInfo_State {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ParticipantInfo_JOINING
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) GetTracks() []*TrackInfo {
|
||||
if x != nil {
|
||||
return x.Tracks
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) GetMetadata() string {
|
||||
if x != nil {
|
||||
return x.Metadata
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) GetJoinedAt() int64 {
|
||||
if x != nil {
|
||||
return x.JoinedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type TrackInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
|
||||
Type TrackType `protobuf:"varint,2,opt,name=type,proto3,enum=livekit.TrackType" json:"type,omitempty"`
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Muted bool `protobuf:"varint,4,opt,name=muted,proto3" json:"muted,omitempty"`
|
||||
}
|
||||
|
||||
func (x *TrackInfo) Reset() {
|
||||
*x = TrackInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_models_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *TrackInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TrackInfo) ProtoMessage() {}
|
||||
|
||||
func (x *TrackInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_models_proto_msgTypes[2]
|
||||
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 TrackInfo.ProtoReflect.Descriptor instead.
|
||||
func (*TrackInfo) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_models_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *TrackInfo) GetSid() string {
|
||||
if x != nil {
|
||||
return x.Sid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TrackInfo) GetType() TrackType {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return TrackType_AUDIO
|
||||
}
|
||||
|
||||
func (x *TrackInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TrackInfo) GetMuted() bool {
|
||||
if x != nil {
|
||||
return x.Muted
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// old DataTrack message
|
||||
type DataMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to Value:
|
||||
// *DataMessage_Text
|
||||
// *DataMessage_Binary
|
||||
Value isDataMessage_Value `protobuf_oneof:"value"`
|
||||
}
|
||||
|
||||
func (x *DataMessage) Reset() {
|
||||
*x = DataMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_livekit_models_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DataMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DataMessage) ProtoMessage() {}
|
||||
|
||||
func (x *DataMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_livekit_models_proto_msgTypes[3]
|
||||
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 DataMessage.ProtoReflect.Descriptor instead.
|
||||
func (*DataMessage) Descriptor() ([]byte, []int) {
|
||||
return file_livekit_models_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (m *DataMessage) GetValue() isDataMessage_Value {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DataMessage) GetText() string {
|
||||
if x, ok := x.GetValue().(*DataMessage_Text); ok {
|
||||
return x.Text
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DataMessage) GetBinary() []byte {
|
||||
if x, ok := x.GetValue().(*DataMessage_Binary); ok {
|
||||
return x.Binary
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isDataMessage_Value interface {
|
||||
isDataMessage_Value()
|
||||
}
|
||||
|
||||
type DataMessage_Text struct {
|
||||
Text string `protobuf:"bytes,1,opt,name=text,proto3,oneof"`
|
||||
}
|
||||
|
||||
type DataMessage_Binary struct {
|
||||
Binary []byte `protobuf:"bytes,2,opt,name=binary,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*DataMessage_Text) isDataMessage_Value() {}
|
||||
|
||||
func (*DataMessage_Binary) isDataMessage_Value() {}
|
||||
|
||||
var File_livekit_models_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_livekit_models_proto_rawDesc = []byte{
|
||||
0x0a, 0x14, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x22,
|
||||
0xc6, 0x01, 0x0a, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x6f, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69,
|
||||
0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x6d,
|
||||
0x61, 0x78, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x70, 0x61, 0x73, 0x73,
|
||||
0x77, 0x6f, 0x72, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x75, 0x72, 0x6e,
|
||||
0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x9a, 0x02, 0x0a, 0x0f, 0x50, 0x61, 0x72,
|
||||
0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74,
|
||||
0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x76, 0x65,
|
||||
0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x12, 0x2a, 0x0a, 0x06, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e,
|
||||
0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6a, 0x6f, 0x69,
|
||||
0x6e, 0x65, 0x64, 0x41, 0x74, 0x22, 0x3e, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b,
|
||||
0x0a, 0x07, 0x4a, 0x4f, 0x49, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4a,
|
||||
0x4f, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56,
|
||||
0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x49, 0x53, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43,
|
||||
0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x6f, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x73, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61,
|
||||
0x63, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x22, 0x46, 0x0a, 0x0b, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x06, 0x62,
|
||||
0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x06, 0x62,
|
||||
0x69, 0x6e, 0x61, 0x72, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x2b,
|
||||
0x0a, 0x09, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x41,
|
||||
0x55, 0x44, 0x49, 0x4f, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x49, 0x44, 0x45, 0x4f, 0x10,
|
||||
0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41, 0x54, 0x41, 0x10, 0x02, 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 (
|
||||
file_livekit_models_proto_rawDescOnce sync.Once
|
||||
file_livekit_models_proto_rawDescData = file_livekit_models_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_livekit_models_proto_rawDescGZIP() []byte {
|
||||
file_livekit_models_proto_rawDescOnce.Do(func() {
|
||||
file_livekit_models_proto_rawDescData = protoimpl.X.CompressGZIP(file_livekit_models_proto_rawDescData)
|
||||
})
|
||||
return file_livekit_models_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_livekit_models_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_livekit_models_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_livekit_models_proto_goTypes = []interface{}{
|
||||
(TrackType)(0), // 0: livekit.TrackType
|
||||
(ParticipantInfo_State)(0), // 1: livekit.ParticipantInfo.State
|
||||
(*Room)(nil), // 2: livekit.Room
|
||||
(*ParticipantInfo)(nil), // 3: livekit.ParticipantInfo
|
||||
(*TrackInfo)(nil), // 4: livekit.TrackInfo
|
||||
(*DataMessage)(nil), // 5: livekit.DataMessage
|
||||
}
|
||||
var file_livekit_models_proto_depIdxs = []int32{
|
||||
1, // 0: livekit.ParticipantInfo.state:type_name -> livekit.ParticipantInfo.State
|
||||
4, // 1: livekit.ParticipantInfo.tracks:type_name -> livekit.TrackInfo
|
||||
0, // 2: livekit.TrackInfo.type:type_name -> livekit.TrackType
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_livekit_models_proto_init() }
|
||||
func file_livekit_models_proto_init() {
|
||||
if File_livekit_models_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_livekit_models_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Room); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_livekit_models_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ParticipantInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_livekit_models_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TrackInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_livekit_models_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DataMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
file_livekit_models_proto_msgTypes[3].OneofWrappers = []interface{}{
|
||||
(*DataMessage_Text)(nil),
|
||||
(*DataMessage_Binary)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_livekit_models_proto_rawDesc,
|
||||
NumEnums: 2,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_livekit_models_proto_goTypes,
|
||||
DependencyIndexes: file_livekit_models_proto_depIdxs,
|
||||
EnumInfos: file_livekit_models_proto_enumTypes,
|
||||
MessageInfos: file_livekit_models_proto_msgTypes,
|
||||
}.Build()
|
||||
File_livekit_models_proto = out.File
|
||||
file_livekit_models_proto_rawDesc = nil
|
||||
file_livekit_models_proto_goTypes = nil
|
||||
file_livekit_models_proto_depIdxs = nil
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+11
-2
@@ -70,14 +70,23 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func NewWebSocketConn(host, token string) (*websocket.Conn, error) {
|
||||
type Options struct {
|
||||
AutoSubscribe bool
|
||||
}
|
||||
|
||||
func NewWebSocketConn(host, token string, opts *Options) (*websocket.Conn, error) {
|
||||
u, err := url.Parse(host + "/rtc")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
requestHeader := make(http.Header)
|
||||
SetAuthorizationToken(requestHeader, token)
|
||||
conn, _, err := websocket.DefaultDialer.Dial(u.String(), requestHeader)
|
||||
|
||||
connectUrl := u.String()
|
||||
if opts != nil {
|
||||
connectUrl = fmt.Sprintf("%s?auto_subscribe=%t", connectUrl, opts.AutoSubscribe)
|
||||
}
|
||||
conn, _, err := websocket.DefaultDialer.Dial(connectUrl, requestHeader)
|
||||
return conn, err
|
||||
}
|
||||
|
||||
|
||||
@@ -211,9 +211,9 @@ func createMultiNodeServer(nodeId string, port uint32) *service.LivekitServer {
|
||||
}
|
||||
|
||||
// creates a client and runs against server
|
||||
func createRTCClient(name string, port int) *testclient.RTCClient {
|
||||
func createRTCClient(name string, port int, opts *testclient.Options) *testclient.RTCClient {
|
||||
token := joinToken(testRoom, name)
|
||||
ws, err := testclient.NewWebSocketConn(fmt.Sprintf("ws://localhost:%d", port), token)
|
||||
ws, err := testclient.NewWebSocketConn(fmt.Sprintf("ws://localhost:%d", port), token, opts)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
+11
-12
@@ -4,10 +4,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestMultiNodeRouting(t *testing.T) {
|
||||
@@ -27,17 +26,17 @@ func TestMultiNodeRouting(t *testing.T) {
|
||||
_, err := roomClient.CreateRoom(contextWithCreateRoomToken(), &livekit.CreateRoomRequest{
|
||||
Name: testRoom,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
// one node connecting to node 1, and another connecting to node 2
|
||||
c1 := createRTCClient("c1", defaultServerPort)
|
||||
c2 := createRTCClient("c2", secondServerPort)
|
||||
c1 := createRTCClient("c1", defaultServerPort, nil)
|
||||
c2 := createRTCClient("c2", secondServerPort, nil)
|
||||
waitUntilConnected(t, c1, c2)
|
||||
defer stopClients(c1, c2)
|
||||
|
||||
// c1 publishing, and c2 receiving
|
||||
t1, err := c1.AddStaticTrack("audio/opus", "audio", "webcam")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
if t1 != nil {
|
||||
defer t1.Stop()
|
||||
}
|
||||
@@ -52,7 +51,7 @@ func TestMultiNodeRouting(t *testing.T) {
|
||||
}
|
||||
|
||||
tr1 := c2.SubscribedTracks()[c1.ID()][0]
|
||||
assert.Equal(t, c1.ID(), tr1.StreamID())
|
||||
require.Equal(t, c1.ID(), tr1.StreamID())
|
||||
return true
|
||||
})
|
||||
}
|
||||
@@ -69,7 +68,7 @@ func TestConnectWithoutCreation(t *testing.T) {
|
||||
defer s1.Stop()
|
||||
defer s2.Stop()
|
||||
|
||||
c1 := createRTCClient("c1", defaultServerPort)
|
||||
c1 := createRTCClient("c1", defaultServerPort, nil)
|
||||
waitUntilConnected(t, c1)
|
||||
|
||||
c1.Stop()
|
||||
@@ -127,11 +126,11 @@ func TestMultinodeReconnectAfterNodeShutdown(t *testing.T) {
|
||||
Name: testRoom,
|
||||
NodeId: s2.Node().Id,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
// one node connecting to node 1, and another connecting to node 2
|
||||
c1 := createRTCClient("c1", defaultServerPort)
|
||||
c2 := createRTCClient("c2", secondServerPort)
|
||||
c1 := createRTCClient("c1", defaultServerPort, nil)
|
||||
c2 := createRTCClient("c2", secondServerPort, nil)
|
||||
|
||||
waitUntilConnected(t, c1, c2)
|
||||
stopClients(c1, c2)
|
||||
@@ -141,7 +140,7 @@ func TestMultinodeReconnectAfterNodeShutdown(t *testing.T) {
|
||||
|
||||
time.Sleep(syncDelay)
|
||||
|
||||
c3 := createRTCClient("c3", defaultServerPort)
|
||||
c3 := createRTCClient("c3", defaultServerPort, nil)
|
||||
waitUntilConnected(t, c3)
|
||||
}
|
||||
|
||||
|
||||
+11
-17
@@ -5,7 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
testclient "github.com/livekit/livekit-server/test/client"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
@@ -15,9 +14,9 @@ import (
|
||||
func scenarioPublishingUponJoining(t *testing.T, ports ...int) {
|
||||
firstPort := ports[0]
|
||||
lastPort := ports[len(ports)-1]
|
||||
c1 := createRTCClient("puj_1", firstPort)
|
||||
c2 := createRTCClient("puj_2", lastPort)
|
||||
c3 := createRTCClient("puj_3", firstPort)
|
||||
c1 := createRTCClient("puj_1", firstPort, nil)
|
||||
c2 := createRTCClient("puj_2", lastPort, &testclient.Options{AutoSubscribe: true})
|
||||
c3 := createRTCClient("puj_3", firstPort, &testclient.Options{AutoSubscribe: true})
|
||||
defer stopClients(c1, c2, c3)
|
||||
|
||||
waitUntilConnected(t, c1, c2, c3)
|
||||
@@ -66,7 +65,7 @@ func scenarioPublishingUponJoining(t *testing.T, ports ...int) {
|
||||
|
||||
logger.Infow("c2 reconnecting")
|
||||
// connect to a diff port
|
||||
c2 = createRTCClient("puj_2", firstPort)
|
||||
c2 = createRTCClient("puj_2", firstPort, nil)
|
||||
defer c2.Stop()
|
||||
waitUntilConnected(t, c2)
|
||||
writers = publishTracksForClients(t, c2)
|
||||
@@ -88,8 +87,8 @@ func scenarioPublishingUponJoining(t *testing.T, ports ...int) {
|
||||
}
|
||||
|
||||
func scenarioReceiveBeforePublish(t *testing.T) {
|
||||
c1 := createRTCClient("rbp_1", defaultServerPort)
|
||||
c2 := createRTCClient("rbp_2", defaultServerPort)
|
||||
c1 := createRTCClient("rbp_1", defaultServerPort, nil)
|
||||
c2 := createRTCClient("rbp_2", defaultServerPort, nil)
|
||||
|
||||
waitUntilConnected(t, c1, c2)
|
||||
defer stopClients(c1, c2)
|
||||
@@ -124,8 +123,8 @@ func scenarioReceiveBeforePublish(t *testing.T) {
|
||||
|
||||
// websocket reconnects
|
||||
func scenarioWSReconnect(t *testing.T) {
|
||||
c1 := createRTCClient("wsr_1", defaultServerPort)
|
||||
c2 := createRTCClient("wsr_2", defaultServerPort)
|
||||
c1 := createRTCClient("wsr_1", defaultServerPort, nil)
|
||||
c2 := createRTCClient("wsr_2", defaultServerPort, nil)
|
||||
|
||||
waitUntilConnected(t, c1, c2)
|
||||
|
||||
@@ -138,16 +137,11 @@ func publishTracksForClients(t *testing.T, clients ...*testclient.RTCClient) []*
|
||||
for i, _ := range clients {
|
||||
c := clients[i]
|
||||
tw, err := c.AddStaticTrack("audio/opus", "audio", "webcam")
|
||||
if !assert.NoError(t, err) {
|
||||
t.FailNow()
|
||||
return nil
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
writers = append(writers, tw)
|
||||
tw, err = c.AddStaticTrack("video/vp8", "video", "webcam")
|
||||
if !assert.NoError(t, err) {
|
||||
t.FailNow()
|
||||
return nil
|
||||
}
|
||||
require.NoError(t, err)
|
||||
writers = append(writers, tw)
|
||||
}
|
||||
return writers
|
||||
|
||||
+42
-13
@@ -3,8 +3,9 @@ package test
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
testclient "github.com/livekit/livekit-server/test/client"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -19,8 +20,8 @@ func TestClientCouldConnect(t *testing.T) {
|
||||
teardownTest(s, testRoom)
|
||||
}()
|
||||
|
||||
c1 := createRTCClient("c1", defaultServerPort)
|
||||
c2 := createRTCClient("c2", defaultServerPort)
|
||||
c1 := createRTCClient("c1", defaultServerPort, nil)
|
||||
c2 := createRTCClient("c2", defaultServerPort, nil)
|
||||
waitUntilConnected(t, c1, c2)
|
||||
|
||||
// ensure they both see each other
|
||||
@@ -28,7 +29,7 @@ func TestClientCouldConnect(t *testing.T) {
|
||||
if len(c1.RemoteParticipants()) == 0 || len(c2.RemoteParticipants()) == 0 {
|
||||
return false
|
||||
}
|
||||
//assert.Equal()
|
||||
//require.Equal()
|
||||
return true
|
||||
})
|
||||
}
|
||||
@@ -44,20 +45,20 @@ func TestSinglePublisher(t *testing.T) {
|
||||
teardownTest(s, testRoom)
|
||||
}()
|
||||
|
||||
c1 := createRTCClient("c1", defaultServerPort)
|
||||
c2 := createRTCClient("c2", defaultServerPort)
|
||||
c1 := createRTCClient("c1", defaultServerPort, nil)
|
||||
c2 := createRTCClient("c2", defaultServerPort, nil)
|
||||
waitUntilConnected(t, c1, c2)
|
||||
|
||||
// publish a track and ensure clients receive it ok
|
||||
t1, err := c1.AddStaticTrack("audio/opus", "audio", "webcam")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
defer t1.Stop()
|
||||
t2, err := c1.AddStaticTrack("video/vp8", "video", "webcam")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
defer t2.Stop()
|
||||
|
||||
// a new client joins and should get the initial stream
|
||||
c3 := createRTCClient("c3", defaultServerPort)
|
||||
c3 := createRTCClient("c3", defaultServerPort, nil)
|
||||
|
||||
success := withTimeout(t, "c2 should receive two tracks", func() bool {
|
||||
if len(c2.SubscribedTracks()) == 0 {
|
||||
@@ -69,7 +70,7 @@ func TestSinglePublisher(t *testing.T) {
|
||||
}
|
||||
|
||||
tr1 := c2.SubscribedTracks()[c1.ID()][0]
|
||||
assert.Equal(t, c1.ID(), tr1.StreamID())
|
||||
require.Equal(t, c1.ID(), tr1.StreamID())
|
||||
return true
|
||||
})
|
||||
if !success {
|
||||
@@ -95,7 +96,7 @@ func TestSinglePublisher(t *testing.T) {
|
||||
// ensure that the track ids are generated by server
|
||||
tracks := c3.SubscribedTracks()[c1.ID()]
|
||||
for _, tr := range tracks {
|
||||
assert.True(t, strings.HasPrefix(tr.ID(), "TR_"), "track should begin with TR")
|
||||
require.True(t, strings.HasPrefix(tr.ID(), "TR_"), "track should begin with TR")
|
||||
}
|
||||
|
||||
// when c3 disconnects.. ensure subscriber is cleaned up correctly
|
||||
@@ -105,14 +106,42 @@ func TestSinglePublisher(t *testing.T) {
|
||||
room := s.RoomManager().GetRoom(testRoom)
|
||||
require.NotNil(t, room)
|
||||
|
||||
p := room.GetParticipant("c3")
|
||||
p := room.GetParticipant("c1")
|
||||
require.NotNil(t, p)
|
||||
|
||||
for _, t := range p.GetPublishedTracks() {
|
||||
if t.IsSubscriber(p.ID()) {
|
||||
if t.IsSubscriber(c3.ID()) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func TestAutoSubDisabled(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
return
|
||||
}
|
||||
|
||||
s := setupSingleNodeTest(testRoom)
|
||||
defer func() {
|
||||
teardownTest(s, testRoom)
|
||||
}()
|
||||
|
||||
opts := testclient.Options{AutoSubscribe: false}
|
||||
c1 := createRTCClient("c1", defaultServerPort, &opts)
|
||||
c2 := createRTCClient("c2", defaultServerPort, &opts)
|
||||
defer c1.Stop()
|
||||
defer c2.Stop()
|
||||
waitUntilConnected(t, c1, c2)
|
||||
|
||||
// c2 should not receive any tracks c1 publishes
|
||||
t1, err := c1.AddStaticTrack("audio/opus", "audio", "webcam")
|
||||
require.NoError(t, err)
|
||||
defer t1.Stop()
|
||||
|
||||
time.Sleep(syncDelay)
|
||||
|
||||
require.Empty(t, c2.SubscribedTracks()[c1.ID()])
|
||||
}
|
||||
Reference in new issue
Block a user