support audio level extension & active speaker detection (#20)
* send active speaker updates with audio level * add test on loudness sorting * use a float to represent audio level
This commit is contained in:
+23
-1
@@ -12,6 +12,7 @@ type Config struct {
|
|||||||
Port uint32 `yaml:"port"`
|
Port uint32 `yaml:"port"`
|
||||||
RTC RTCConfig `yaml:"rtc"`
|
RTC RTCConfig `yaml:"rtc"`
|
||||||
Redis RedisConfig `yaml:"redis"`
|
Redis RedisConfig `yaml:"redis"`
|
||||||
|
Audio AudioConfig `yaml:"audio"`
|
||||||
KeyFile string `yaml:"key_file"`
|
KeyFile string `yaml:"key_file"`
|
||||||
Keys map[string]string `yaml:"keys"`
|
Keys map[string]string `yaml:"keys"`
|
||||||
LogLevel string `yaml:"log_level"`
|
LogLevel string `yaml:"log_level"`
|
||||||
@@ -25,10 +26,21 @@ type RTCConfig struct {
|
|||||||
StunServers []string `yaml:"stun_servers"`
|
StunServers []string `yaml:"stun_servers"`
|
||||||
UseExternalIP bool `yaml:"use_external_ip"`
|
UseExternalIP bool `yaml:"use_external_ip"`
|
||||||
|
|
||||||
|
// Max bitrate for REMB
|
||||||
MaxBitrate uint64 `yaml:"max_bitrate"`
|
MaxBitrate uint64 `yaml:"max_bitrate"`
|
||||||
MaxBufferTime int `yaml:"max_buffer_time"`
|
MaxBufferTime int `yaml:"max_buffer_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AudioConfig struct {
|
||||||
|
// minimum level to be considered active, 0-127, where 0 is loudest
|
||||||
|
ActiveLevel uint8 `yaml:"active_level"`
|
||||||
|
// percentile to measure, a participant is considered active if it has exceeded the ActiveLevel more than
|
||||||
|
// MinPercentile% of the time
|
||||||
|
MinPercentile uint8 `yaml:"min_percentile"`
|
||||||
|
// interval to update clients, in ms
|
||||||
|
UpdateInterval uint32 `yaml:"update_interval"`
|
||||||
|
}
|
||||||
|
|
||||||
type RedisConfig struct {
|
type RedisConfig struct {
|
||||||
Address string `yaml:"address"`
|
Address string `yaml:"address"`
|
||||||
Password string `yaml:"password"`
|
Password string `yaml:"password"`
|
||||||
@@ -43,8 +55,14 @@ func NewConfig(confString string) (*Config, error) {
|
|||||||
ICEPortRangeEnd: 10000,
|
ICEPortRangeEnd: 10000,
|
||||||
StunServers: []string{
|
StunServers: []string{
|
||||||
"stun.l.google.com:19302",
|
"stun.l.google.com:19302",
|
||||||
|
"stun1.l.google.com:19302",
|
||||||
},
|
},
|
||||||
MaxBitrate: 2 * 1024 * 1024, // 3 mbps
|
MaxBitrate: 3 * 1024 * 1024, // 3 mbps
|
||||||
|
},
|
||||||
|
Audio: AudioConfig{
|
||||||
|
ActiveLevel: 40,
|
||||||
|
MinPercentile: 20,
|
||||||
|
UpdateInterval: 1000,
|
||||||
},
|
},
|
||||||
Redis: RedisConfig{},
|
Redis: RedisConfig{},
|
||||||
Keys: map[string]string{},
|
Keys: map[string]string{},
|
||||||
@@ -102,3 +120,7 @@ func (conf *Config) unmarshalKeys(keys string) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetAudioConfig(conf *Config) AudioConfig {
|
||||||
|
return conf.Audio
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package rtc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync/atomic"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// number of samples to compute moving average over
|
||||||
|
averageSamples = 40
|
||||||
|
silentAudioLevel = uint8(127)
|
||||||
|
)
|
||||||
|
|
||||||
|
// keeps track of audio level for a participant
|
||||||
|
type AudioLevel struct {
|
||||||
|
levelThreshold uint8
|
||||||
|
minPercentile uint8
|
||||||
|
currentLevel atomic.Value
|
||||||
|
// min samples to be considered active
|
||||||
|
minSamples uint32
|
||||||
|
|
||||||
|
// for Observe goroutine use
|
||||||
|
// keeps track of current running average
|
||||||
|
sum uint32
|
||||||
|
activeSamples uint32
|
||||||
|
numSamples uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAudioLevel(activeLevel uint8, minPercentile uint8) *AudioLevel {
|
||||||
|
l := &AudioLevel{
|
||||||
|
levelThreshold: activeLevel,
|
||||||
|
minPercentile: minPercentile,
|
||||||
|
minSamples: uint32(minPercentile) * averageSamples / 100,
|
||||||
|
}
|
||||||
|
l.currentLevel.Store(silentAudioLevel)
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
|
// Observes a new sample, must be called from the same thread
|
||||||
|
func (l *AudioLevel) Observe(level uint8) {
|
||||||
|
l.numSamples++
|
||||||
|
|
||||||
|
if level <= l.levelThreshold {
|
||||||
|
l.activeSamples++
|
||||||
|
l.sum += uint32(level)
|
||||||
|
}
|
||||||
|
|
||||||
|
if l.numSamples >= averageSamples {
|
||||||
|
// compute and reset
|
||||||
|
if l.activeSamples >= l.minSamples {
|
||||||
|
l.currentLevel.Store(uint8(l.sum / l.activeSamples))
|
||||||
|
} else {
|
||||||
|
// nil to represent not noisy
|
||||||
|
l.currentLevel.Store(silentAudioLevel)
|
||||||
|
}
|
||||||
|
l.sum = 0
|
||||||
|
l.activeSamples = 0
|
||||||
|
l.numSamples = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns current audio level, 0 (loudest) to 127 (silent)
|
||||||
|
func (l *AudioLevel) GetLevel() (level uint8, noisy bool) {
|
||||||
|
level = l.currentLevel.Load().(uint8)
|
||||||
|
noisy = level != silentAudioLevel
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func convertAudioLevel(level uint8) float32 {
|
||||||
|
return (127 - float32(level)) / 127
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package rtc_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"github.com/livekit/livekit-server/pkg/rtc"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultActiveLevel = 30
|
||||||
|
// requires two noisy samples to count
|
||||||
|
defaultPercentile = 5
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
observeSamples(a, 35, 5)
|
||||||
|
_, noisy = a.GetLevel()
|
||||||
|
assert.False(t, noisy)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("not noisy when all samples are below threshold", func(t *testing.T) {
|
||||||
|
a := rtc.NewAudioLevel(defaultActiveLevel, defaultPercentile)
|
||||||
|
|
||||||
|
observeSamples(a, 35, 100)
|
||||||
|
_, noisy := a.GetLevel()
|
||||||
|
assert.False(t, noisy)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("not noisy when less than percentile samples are above threshold", func(t *testing.T) {
|
||||||
|
a := rtc.NewAudioLevel(defaultActiveLevel, defaultPercentile)
|
||||||
|
|
||||||
|
observeSamples(a, 35, 39)
|
||||||
|
observeSamples(a, 25, 1)
|
||||||
|
observeSamples(a, 35, 1)
|
||||||
|
|
||||||
|
_, noisy := a.GetLevel()
|
||||||
|
assert.False(t, noisy)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("noisy when higher than percentile samples are above threshold", func(t *testing.T) {
|
||||||
|
a := rtc.NewAudioLevel(defaultActiveLevel, defaultPercentile)
|
||||||
|
|
||||||
|
observeSamples(a, 35, 37)
|
||||||
|
observeSamples(a, 25, 1)
|
||||||
|
observeSamples(a, 29, 2)
|
||||||
|
|
||||||
|
level, noisy := a.GetLevel()
|
||||||
|
assert.True(t, noisy)
|
||||||
|
assert.Less(t, level, uint8(defaultActiveLevel))
|
||||||
|
assert.Greater(t, level, uint8(25))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func observeSamples(a *rtc.AudioLevel, level uint8, count int) {
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
a.Observe(level)
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
-12
@@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
"github.com/pion/webrtc/v3/pkg/rtcerr"
|
"github.com/pion/webrtc/v3/pkg/rtcerr"
|
||||||
|
|
||||||
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
"github.com/livekit/livekit-server/pkg/logger"
|
"github.com/livekit/livekit-server/pkg/logger"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||||
"github.com/livekit/livekit-server/pkg/utils"
|
"github.com/livekit/livekit-server/pkg/utils"
|
||||||
@@ -33,13 +34,14 @@ type MediaTrack struct {
|
|||||||
participantId string
|
participantId string
|
||||||
muted utils.AtomicFlag
|
muted utils.AtomicFlag
|
||||||
|
|
||||||
ssrc webrtc.SSRC
|
ssrc webrtc.SSRC
|
||||||
name string
|
name string
|
||||||
streamID string
|
streamID string
|
||||||
kind livekit.TrackType
|
kind livekit.TrackType
|
||||||
codec webrtc.RTPCodecParameters
|
codec webrtc.RTPCodecParameters
|
||||||
conf ReceiverConfig
|
receiverConf ReceiverConfig
|
||||||
onClose func()
|
audioConf config.AudioConfig
|
||||||
|
onClose func()
|
||||||
|
|
||||||
// channel to send RTCP packets to the source
|
// channel to send RTCP packets to the source
|
||||||
rtcpCh chan []rtcp.Packet
|
rtcpCh chan []rtcp.Packet
|
||||||
@@ -47,12 +49,13 @@ type MediaTrack struct {
|
|||||||
// map of target participantId -> *SubscribedTrack
|
// map of target participantId -> *SubscribedTrack
|
||||||
subscribedTracks map[string]*SubscribedTrack
|
subscribedTracks map[string]*SubscribedTrack
|
||||||
twcc *twcc.Responder
|
twcc *twcc.Responder
|
||||||
|
audioLevel *AudioLevel
|
||||||
receiver sfu.Receiver
|
receiver sfu.Receiver
|
||||||
//lastNack int64
|
//lastNack int64
|
||||||
lastPLI time.Time
|
lastPLI time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMediaTrack(trackId string, pId string, rtcpCh chan []rtcp.Packet, conf ReceiverConfig, track *webrtc.TrackRemote) *MediaTrack {
|
func NewMediaTrack(trackId string, pId string, rtcpCh chan []rtcp.Packet, track *webrtc.TrackRemote, rc ReceiverConfig, ac config.AudioConfig) *MediaTrack {
|
||||||
t := &MediaTrack{
|
t := &MediaTrack{
|
||||||
id: trackId,
|
id: trackId,
|
||||||
participantId: pId,
|
participantId: pId,
|
||||||
@@ -60,7 +63,8 @@ func NewMediaTrack(trackId string, pId string, rtcpCh chan []rtcp.Packet, conf R
|
|||||||
streamID: track.StreamID(),
|
streamID: track.StreamID(),
|
||||||
kind: ToProtoTrackKind(track.Kind()),
|
kind: ToProtoTrackKind(track.Kind()),
|
||||||
codec: track.Codec(),
|
codec: track.Codec(),
|
||||||
conf: conf,
|
receiverConf: rc,
|
||||||
|
audioConf: ac,
|
||||||
rtcpCh: rtcpCh,
|
rtcpCh: rtcpCh,
|
||||||
lock: sync.RWMutex{},
|
lock: sync.RWMutex{},
|
||||||
subscribedTracks: make(map[string]*SubscribedTrack),
|
subscribedTracks: make(map[string]*SubscribedTrack),
|
||||||
@@ -209,7 +213,10 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track *webrtc.Tra
|
|||||||
})
|
})
|
||||||
|
|
||||||
if t.Kind() == livekit.TrackType_AUDIO {
|
if t.Kind() == livekit.TrackType_AUDIO {
|
||||||
// TODO: audio level stuff
|
t.audioLevel = NewAudioLevel(t.audioConf.ActiveLevel, t.audioConf.MinPercentile)
|
||||||
|
buff.OnAudioLevel(func(level uint8) {
|
||||||
|
t.audioLevel.Observe(level)
|
||||||
|
})
|
||||||
} else if t.Kind() == livekit.TrackType_VIDEO {
|
} else if t.Kind() == livekit.TrackType_VIDEO {
|
||||||
if twcc != nil {
|
if twcc != nil {
|
||||||
buff.OnTransportWideCC(func(sn uint16, timeNS int64, marker bool) {
|
buff.OnTransportWideCC(func(sn uint16, timeNS int64, marker bool) {
|
||||||
@@ -259,8 +266,8 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track *webrtc.Tra
|
|||||||
t.receiver.AddUpTrack(track, buff)
|
t.receiver.AddUpTrack(track, buff)
|
||||||
|
|
||||||
buff.Bind(receiver.GetParameters(), buffer.Options{
|
buff.Bind(receiver.GetParameters(), buffer.Options{
|
||||||
BufferTime: t.conf.maxBufferTime,
|
BufferTime: t.receiverConf.maxBufferTime,
|
||||||
MaxBitRate: t.conf.maxBitrate,
|
MaxBitRate: t.receiverConf.maxBitrate,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+41
-3
@@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/thoas/go-funk"
|
"github.com/thoas/go-funk"
|
||||||
|
|
||||||
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
"github.com/livekit/livekit-server/pkg/logger"
|
"github.com/livekit/livekit-server/pkg/logger"
|
||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||||
@@ -32,6 +33,7 @@ type ParticipantImpl struct {
|
|||||||
subscriber *PCTransport
|
subscriber *PCTransport
|
||||||
responseSink routing.MessageSink
|
responseSink routing.MessageSink
|
||||||
receiverConfig ReceiverConfig
|
receiverConfig ReceiverConfig
|
||||||
|
audioConfig config.AudioConfig
|
||||||
isClosed utils.AtomicFlag
|
isClosed utils.AtomicFlag
|
||||||
identity string
|
identity string
|
||||||
// JSON encoded metadata to pass to clients
|
// JSON encoded metadata to pass to clients
|
||||||
@@ -58,14 +60,15 @@ type ParticipantImpl struct {
|
|||||||
onClose func(types.Participant)
|
onClose func(types.Participant)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewParticipant(identity string, conf *WebRTCConfig, rs routing.MessageSink, receiverConfig ReceiverConfig) (*ParticipantImpl, error) {
|
func NewParticipant(identity string, conf *WebRTCConfig, rs routing.MessageSink, rc ReceiverConfig, ac config.AudioConfig) (*ParticipantImpl, error) {
|
||||||
// TODO: check to ensure params are valid, id and identity can't be empty
|
// TODO: check to ensure params are valid, id and identity can't be empty
|
||||||
|
|
||||||
p := &ParticipantImpl{
|
p := &ParticipantImpl{
|
||||||
id: utils.NewGuid(utils.ParticipantPrefix),
|
id: utils.NewGuid(utils.ParticipantPrefix),
|
||||||
identity: identity,
|
identity: identity,
|
||||||
responseSink: rs,
|
responseSink: rs,
|
||||||
receiverConfig: receiverConfig,
|
receiverConfig: rc,
|
||||||
|
audioConfig: ac,
|
||||||
rtcpCh: make(chan []rtcp.Packet, 50),
|
rtcpCh: make(chan []rtcp.Packet, 50),
|
||||||
subscribedTracks: make(map[string][]types.SubscribedTrack),
|
subscribedTracks: make(map[string][]types.SubscribedTrack),
|
||||||
lock: sync.RWMutex{},
|
lock: sync.RWMutex{},
|
||||||
@@ -392,6 +395,20 @@ func (p *ParticipantImpl) SendParticipantUpdate(participants []*livekit.Particip
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *ParticipantImpl) SendActiveSpeakers(speakers []*livekit.SpeakerInfo) error {
|
||||||
|
if !p.IsReady() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return p.responseSink.WriteMessage(&livekit.SignalResponse{
|
||||||
|
Message: &livekit.SignalResponse_Speaker{
|
||||||
|
Speaker: &livekit.ActiveSpeakerUpdate{
|
||||||
|
Speakers: speakers,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool) {
|
func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool) {
|
||||||
p.lock.RLock()
|
p.lock.RLock()
|
||||||
defer p.lock.RUnlock()
|
defer p.lock.RUnlock()
|
||||||
@@ -412,6 +429,27 @@ func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *ParticipantImpl) GetAudioLevel() (level uint8, noisy bool) {
|
||||||
|
p.lock.RLock()
|
||||||
|
defer p.lock.RUnlock()
|
||||||
|
level = silentAudioLevel
|
||||||
|
for _, pt := range p.publishedTracks {
|
||||||
|
if mt, ok := pt.(*MediaTrack); ok {
|
||||||
|
if mt.audioLevel == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
tl, tn := mt.audioLevel.GetLevel()
|
||||||
|
if tn {
|
||||||
|
noisy = true
|
||||||
|
if tl < level {
|
||||||
|
level = tl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (p *ParticipantImpl) SubscriberPC() *webrtc.PeerConnection {
|
func (p *ParticipantImpl) SubscriberPC() *webrtc.PeerConnection {
|
||||||
return p.subscriber.pc
|
return p.subscriber.pc
|
||||||
}
|
}
|
||||||
@@ -529,7 +567,7 @@ func (p *ParticipantImpl) onMediaTrack(track *webrtc.TrackRemote, rtpReceiver *w
|
|||||||
logger.Debugw("using existing mediatrack, simulcast", "rid", track.RID())
|
logger.Debugw("using existing mediatrack, simulcast", "rid", track.RID())
|
||||||
mt = trk
|
mt = trk
|
||||||
} else {
|
} else {
|
||||||
mt = NewMediaTrack(ti.Sid, p.id, p.rtcpCh, p.receiverConfig, track)
|
mt = NewMediaTrack(ti.Sid, p.id, p.rtcpCh, track, p.receiverConfig, p.audioConfig)
|
||||||
mt.name = ti.Name
|
mt.name = ti.Name
|
||||||
newTrack = true
|
newTrack = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
"github.com/livekit/livekit-server/pkg/routing/routingfakes"
|
"github.com/livekit/livekit-server/pkg/routing/routingfakes"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||||
@@ -123,6 +124,7 @@ func newParticipantForTest(identity string) *ParticipantImpl {
|
|||||||
identity,
|
identity,
|
||||||
&WebRTCConfig{},
|
&WebRTCConfig{},
|
||||||
&routingfakes.FakeMessageSink{},
|
&routingfakes.FakeMessageSink{},
|
||||||
ReceiverConfig{})
|
ReceiverConfig{},
|
||||||
|
config.AudioConfig{})
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|||||||
+72
-12
@@ -1,12 +1,11 @@
|
|||||||
package rtc
|
package rtc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/thoas/go-funk"
|
|
||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/logger"
|
"github.com/livekit/livekit-server/pkg/logger"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||||
"github.com/livekit/livekit-server/pkg/utils"
|
"github.com/livekit/livekit-server/pkg/utils"
|
||||||
@@ -29,16 +28,21 @@ type Room struct {
|
|||||||
leftAt atomic.Value
|
leftAt atomic.Value
|
||||||
isClosed utils.AtomicFlag
|
isClosed utils.AtomicFlag
|
||||||
|
|
||||||
|
// for active speaker updates
|
||||||
|
audioUpdateInterval uint32
|
||||||
|
lastActiveSpeakers []*livekit.SpeakerInfo
|
||||||
|
|
||||||
onParticipantChanged func(p types.Participant)
|
onParticipantChanged func(p types.Participant)
|
||||||
onClose func()
|
onClose func()
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRoom(room *livekit.Room, config WebRTCConfig) *Room {
|
func NewRoom(room *livekit.Room, config WebRTCConfig, audioUpdateInterval uint32) *Room {
|
||||||
r := &Room{
|
r := &Room{
|
||||||
Room: *room,
|
Room: *room,
|
||||||
config: config,
|
config: config,
|
||||||
lock: sync.RWMutex{},
|
audioUpdateInterval: audioUpdateInterval,
|
||||||
participants: make(map[string]types.Participant),
|
lock: sync.RWMutex{},
|
||||||
|
participants: make(map[string]types.Participant),
|
||||||
}
|
}
|
||||||
if r.EmptyTimeout == 0 {
|
if r.EmptyTimeout == 0 {
|
||||||
r.EmptyTimeout = DefaultEmptyTimeout
|
r.EmptyTimeout = DefaultEmptyTimeout
|
||||||
@@ -46,6 +50,7 @@ func NewRoom(room *livekit.Room, config WebRTCConfig) *Room {
|
|||||||
if r.CreationTime == 0 {
|
if r.CreationTime == 0 {
|
||||||
r.CreationTime = time.Now().Unix()
|
r.CreationTime = time.Now().Unix()
|
||||||
}
|
}
|
||||||
|
go r.audioUpdateWorker()
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +63,32 @@ func (r *Room) GetParticipant(identity string) types.Participant {
|
|||||||
func (r *Room) GetParticipants() []types.Participant {
|
func (r *Room) GetParticipants() []types.Participant {
|
||||||
r.lock.RLock()
|
r.lock.RLock()
|
||||||
defer r.lock.RUnlock()
|
defer r.lock.RUnlock()
|
||||||
return funk.Values(r.participants).([]types.Participant)
|
participants := make([]types.Participant, 0, len(r.participants))
|
||||||
|
for _, p := range r.participants {
|
||||||
|
participants = append(participants, p)
|
||||||
|
}
|
||||||
|
return participants
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Room) GetActiveSpeakers() []*livekit.SpeakerInfo {
|
||||||
|
participants := r.GetParticipants()
|
||||||
|
speakers := make([]*livekit.SpeakerInfo, 0, len(participants))
|
||||||
|
for _, p := range participants {
|
||||||
|
level, active := p.GetAudioLevel()
|
||||||
|
if !active {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
speakers = append(speakers, &livekit.SpeakerInfo{
|
||||||
|
Sid: p.ID(),
|
||||||
|
Level: convertAudioLevel(level),
|
||||||
|
Active: active,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(speakers, func(i, j int) bool {
|
||||||
|
return speakers[i].Level > speakers[j].Level
|
||||||
|
})
|
||||||
|
return speakers
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Room) FirstJoinedAt() int64 {
|
func (r *Room) FirstJoinedAt() int64 {
|
||||||
@@ -271,11 +301,9 @@ func (r *Room) onTrackUpdated(p types.Participant, track types.PublishedTrack) {
|
|||||||
|
|
||||||
// broadcast an update about participant p
|
// broadcast an update about participant p
|
||||||
func (r *Room) broadcastParticipantState(p types.Participant) {
|
func (r *Room) broadcastParticipantState(p types.Participant) {
|
||||||
r.lock.RLock()
|
|
||||||
defer r.lock.RUnlock()
|
|
||||||
|
|
||||||
updates := ToProtoParticipants([]types.Participant{p})
|
updates := ToProtoParticipants([]types.Participant{p})
|
||||||
for _, op := range r.participants {
|
participants := r.GetParticipants()
|
||||||
|
for _, op := range participants {
|
||||||
// skip itself && closed participants
|
// skip itself && closed participants
|
||||||
if p.ID() == op.ID() || op.State() == livekit.ParticipantInfo_DISCONNECTED {
|
if p.ID() == op.ID() || op.State() == livekit.ParticipantInfo_DISCONNECTED {
|
||||||
continue
|
continue
|
||||||
@@ -289,3 +317,35 @@ func (r *Room) broadcastParticipantState(p types.Participant) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Room) sendSpeakerUpdates(speakers []*livekit.SpeakerInfo) {
|
||||||
|
for _, p := range r.GetParticipants() {
|
||||||
|
p.SendActiveSpeakers(speakers)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Room) audioUpdateWorker() {
|
||||||
|
for {
|
||||||
|
if r.isClosed.Get() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
speakers := r.GetActiveSpeakers()
|
||||||
|
|
||||||
|
// see if an update is needed
|
||||||
|
if len(speakers) == len(r.lastActiveSpeakers) {
|
||||||
|
for i, speaker := range speakers {
|
||||||
|
if speaker.Sid != r.lastActiveSpeakers[i].Sid {
|
||||||
|
r.sendSpeakerUpdates(speakers)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
r.sendSpeakerUpdates(speakers)
|
||||||
|
}
|
||||||
|
|
||||||
|
r.lastActiveSpeakers = speakers
|
||||||
|
|
||||||
|
time.Sleep(time.Duration(r.audioUpdateInterval) * time.Millisecond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+65
-3
@@ -15,8 +15,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
numParticipants = 3
|
numParticipants = 3
|
||||||
defaultDelay = 10 * time.Millisecond
|
defaultDelay = 10 * time.Millisecond
|
||||||
|
audioUpdateInterval = 25
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -199,17 +200,78 @@ func TestNewTrack(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestActiveSpeakers(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
audioUpdateDuration := (audioUpdateInterval + 2) * time.Millisecond
|
||||||
|
t.Run("participant should not be getting audio updates", func(t *testing.T) {
|
||||||
|
rm := newRoomWithParticipants(t, 1)
|
||||||
|
p := rm.GetParticipants()[0].(*typesfakes.FakeParticipant)
|
||||||
|
assert.Empty(t, rm.GetActiveSpeakers())
|
||||||
|
|
||||||
|
time.Sleep(audioUpdateDuration)
|
||||||
|
|
||||||
|
assert.Zero(t, p.SendActiveSpeakersCallCount())
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("speakers should be sorted by loudness", func(t *testing.T) {
|
||||||
|
rm := newRoomWithParticipants(t, 2)
|
||||||
|
participants := rm.GetParticipants()
|
||||||
|
p := participants[0].(*typesfakes.FakeParticipant)
|
||||||
|
p2 := participants[1].(*typesfakes.FakeParticipant)
|
||||||
|
p.GetAudioLevelReturns(10, true)
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("participants are getting updates when active", func(t *testing.T) {
|
||||||
|
rm := newRoomWithParticipants(t, 2)
|
||||||
|
participants := rm.GetParticipants()
|
||||||
|
p := participants[0].(*typesfakes.FakeParticipant)
|
||||||
|
time.Sleep(time.Millisecond) // let the first update cycle run
|
||||||
|
p.GetAudioLevelReturns(30, true)
|
||||||
|
|
||||||
|
speakers := rm.GetActiveSpeakers()
|
||||||
|
assert.NotEmpty(t, speakers)
|
||||||
|
assert.Equal(t, p.ID(), speakers[0].Sid)
|
||||||
|
|
||||||
|
time.Sleep(audioUpdateDuration)
|
||||||
|
|
||||||
|
// everyone should've received updates
|
||||||
|
for _, op := range participants {
|
||||||
|
op := op.(*typesfakes.FakeParticipant)
|
||||||
|
assert.Equal(t, 1, op.SendActiveSpeakersCallCount())
|
||||||
|
}
|
||||||
|
|
||||||
|
// after another cycle, we are not getting any new updates since unchanged
|
||||||
|
time.Sleep(audioUpdateDuration)
|
||||||
|
for _, op := range participants {
|
||||||
|
op := op.(*typesfakes.FakeParticipant)
|
||||||
|
assert.Equal(t, 1, op.SendActiveSpeakersCallCount())
|
||||||
|
}
|
||||||
|
|
||||||
|
// no longer speaking, send update with empty items
|
||||||
|
p.GetAudioLevelReturns(127, false)
|
||||||
|
time.Sleep(audioUpdateDuration)
|
||||||
|
assert.Equal(t, 2, p.SendActiveSpeakersCallCount())
|
||||||
|
assert.Empty(t, p.SendActiveSpeakersArgsForCall(1))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func newRoomWithParticipants(t *testing.T, num int) *rtc.Room {
|
func newRoomWithParticipants(t *testing.T, num int) *rtc.Room {
|
||||||
rm := rtc.NewRoom(
|
rm := rtc.NewRoom(
|
||||||
&livekit.Room{Name: "room"},
|
&livekit.Room{Name: "room"},
|
||||||
rtc.WebRTCConfig{},
|
rtc.WebRTCConfig{},
|
||||||
|
audioUpdateInterval,
|
||||||
)
|
)
|
||||||
for i := 0; i < num; i++ {
|
for i := 0; i < num; i++ {
|
||||||
identity := fmt.Sprintf("p%d", i)
|
identity := fmt.Sprintf("p%d", i)
|
||||||
participant := newMockParticipant(identity)
|
participant := newMockParticipant(identity)
|
||||||
err := rm.Join(participant)
|
err := rm.Join(participant)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
//rm.participants[participant.ID()] = participant
|
|
||||||
}
|
}
|
||||||
return rm
|
return rm
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ type Participant interface {
|
|||||||
RemoveSubscriber(peerId string)
|
RemoveSubscriber(peerId string)
|
||||||
SendJoinResponse(info *livekit.Room, otherParticipants []Participant) error
|
SendJoinResponse(info *livekit.Room, otherParticipants []Participant) error
|
||||||
SendParticipantUpdate(participants []*livekit.ParticipantInfo) error
|
SendParticipantUpdate(participants []*livekit.ParticipantInfo) error
|
||||||
|
SendActiveSpeakers(speakers []*livekit.SpeakerInfo) error
|
||||||
SetTrackMuted(trackId string, muted bool)
|
SetTrackMuted(trackId string, muted bool)
|
||||||
|
GetAudioLevel() (level uint8, noisy bool)
|
||||||
|
|
||||||
Start()
|
Start()
|
||||||
Close() error
|
Close() error
|
||||||
|
|||||||
@@ -58,6 +58,18 @@ type FakeParticipant struct {
|
|||||||
closeReturnsOnCall map[int]struct {
|
closeReturnsOnCall map[int]struct {
|
||||||
result1 error
|
result1 error
|
||||||
}
|
}
|
||||||
|
GetAudioLevelStub func() (uint8, bool)
|
||||||
|
getAudioLevelMutex sync.RWMutex
|
||||||
|
getAudioLevelArgsForCall []struct {
|
||||||
|
}
|
||||||
|
getAudioLevelReturns struct {
|
||||||
|
result1 uint8
|
||||||
|
result2 bool
|
||||||
|
}
|
||||||
|
getAudioLevelReturnsOnCall map[int]struct {
|
||||||
|
result1 uint8
|
||||||
|
result2 bool
|
||||||
|
}
|
||||||
GetResponseSinkStub func() routing.MessageSink
|
GetResponseSinkStub func() routing.MessageSink
|
||||||
getResponseSinkMutex sync.RWMutex
|
getResponseSinkMutex sync.RWMutex
|
||||||
getResponseSinkArgsForCall []struct {
|
getResponseSinkArgsForCall []struct {
|
||||||
@@ -163,6 +175,17 @@ type FakeParticipant struct {
|
|||||||
removeSubscriberArgsForCall []struct {
|
removeSubscriberArgsForCall []struct {
|
||||||
arg1 string
|
arg1 string
|
||||||
}
|
}
|
||||||
|
SendActiveSpeakersStub func([]*livekit.SpeakerInfo) error
|
||||||
|
sendActiveSpeakersMutex sync.RWMutex
|
||||||
|
sendActiveSpeakersArgsForCall []struct {
|
||||||
|
arg1 []*livekit.SpeakerInfo
|
||||||
|
}
|
||||||
|
sendActiveSpeakersReturns struct {
|
||||||
|
result1 error
|
||||||
|
}
|
||||||
|
sendActiveSpeakersReturnsOnCall map[int]struct {
|
||||||
|
result1 error
|
||||||
|
}
|
||||||
SendJoinResponseStub func(*livekit.Room, []types.Participant) error
|
SendJoinResponseStub func(*livekit.Room, []types.Participant) error
|
||||||
sendJoinResponseMutex sync.RWMutex
|
sendJoinResponseMutex sync.RWMutex
|
||||||
sendJoinResponseArgsForCall []struct {
|
sendJoinResponseArgsForCall []struct {
|
||||||
@@ -499,6 +522,62 @@ func (fake *FakeParticipant) CloseReturnsOnCall(i int, result1 error) {
|
|||||||
}{result1}
|
}{result1}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) GetAudioLevel() (uint8, bool) {
|
||||||
|
fake.getAudioLevelMutex.Lock()
|
||||||
|
ret, specificReturn := fake.getAudioLevelReturnsOnCall[len(fake.getAudioLevelArgsForCall)]
|
||||||
|
fake.getAudioLevelArgsForCall = append(fake.getAudioLevelArgsForCall, struct {
|
||||||
|
}{})
|
||||||
|
stub := fake.GetAudioLevelStub
|
||||||
|
fakeReturns := fake.getAudioLevelReturns
|
||||||
|
fake.recordInvocation("GetAudioLevel", []interface{}{})
|
||||||
|
fake.getAudioLevelMutex.Unlock()
|
||||||
|
if stub != nil {
|
||||||
|
return stub()
|
||||||
|
}
|
||||||
|
if specificReturn {
|
||||||
|
return ret.result1, ret.result2
|
||||||
|
}
|
||||||
|
return fakeReturns.result1, fakeReturns.result2
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) GetAudioLevelCallCount() int {
|
||||||
|
fake.getAudioLevelMutex.RLock()
|
||||||
|
defer fake.getAudioLevelMutex.RUnlock()
|
||||||
|
return len(fake.getAudioLevelArgsForCall)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) GetAudioLevelCalls(stub func() (uint8, bool)) {
|
||||||
|
fake.getAudioLevelMutex.Lock()
|
||||||
|
defer fake.getAudioLevelMutex.Unlock()
|
||||||
|
fake.GetAudioLevelStub = stub
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) GetAudioLevelReturns(result1 uint8, result2 bool) {
|
||||||
|
fake.getAudioLevelMutex.Lock()
|
||||||
|
defer fake.getAudioLevelMutex.Unlock()
|
||||||
|
fake.GetAudioLevelStub = nil
|
||||||
|
fake.getAudioLevelReturns = struct {
|
||||||
|
result1 uint8
|
||||||
|
result2 bool
|
||||||
|
}{result1, result2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) GetAudioLevelReturnsOnCall(i int, result1 uint8, result2 bool) {
|
||||||
|
fake.getAudioLevelMutex.Lock()
|
||||||
|
defer fake.getAudioLevelMutex.Unlock()
|
||||||
|
fake.GetAudioLevelStub = nil
|
||||||
|
if fake.getAudioLevelReturnsOnCall == nil {
|
||||||
|
fake.getAudioLevelReturnsOnCall = make(map[int]struct {
|
||||||
|
result1 uint8
|
||||||
|
result2 bool
|
||||||
|
})
|
||||||
|
}
|
||||||
|
fake.getAudioLevelReturnsOnCall[i] = struct {
|
||||||
|
result1 uint8
|
||||||
|
result2 bool
|
||||||
|
}{result1, result2}
|
||||||
|
}
|
||||||
|
|
||||||
func (fake *FakeParticipant) GetResponseSink() routing.MessageSink {
|
func (fake *FakeParticipant) GetResponseSink() routing.MessageSink {
|
||||||
fake.getResponseSinkMutex.Lock()
|
fake.getResponseSinkMutex.Lock()
|
||||||
ret, specificReturn := fake.getResponseSinkReturnsOnCall[len(fake.getResponseSinkArgsForCall)]
|
ret, specificReturn := fake.getResponseSinkReturnsOnCall[len(fake.getResponseSinkArgsForCall)]
|
||||||
@@ -1082,6 +1161,72 @@ func (fake *FakeParticipant) RemoveSubscriberArgsForCall(i int) string {
|
|||||||
return argsForCall.arg1
|
return argsForCall.arg1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) SendActiveSpeakers(arg1 []*livekit.SpeakerInfo) error {
|
||||||
|
var arg1Copy []*livekit.SpeakerInfo
|
||||||
|
if arg1 != nil {
|
||||||
|
arg1Copy = make([]*livekit.SpeakerInfo, len(arg1))
|
||||||
|
copy(arg1Copy, arg1)
|
||||||
|
}
|
||||||
|
fake.sendActiveSpeakersMutex.Lock()
|
||||||
|
ret, specificReturn := fake.sendActiveSpeakersReturnsOnCall[len(fake.sendActiveSpeakersArgsForCall)]
|
||||||
|
fake.sendActiveSpeakersArgsForCall = append(fake.sendActiveSpeakersArgsForCall, struct {
|
||||||
|
arg1 []*livekit.SpeakerInfo
|
||||||
|
}{arg1Copy})
|
||||||
|
stub := fake.SendActiveSpeakersStub
|
||||||
|
fakeReturns := fake.sendActiveSpeakersReturns
|
||||||
|
fake.recordInvocation("SendActiveSpeakers", []interface{}{arg1Copy})
|
||||||
|
fake.sendActiveSpeakersMutex.Unlock()
|
||||||
|
if stub != nil {
|
||||||
|
return stub(arg1)
|
||||||
|
}
|
||||||
|
if specificReturn {
|
||||||
|
return ret.result1
|
||||||
|
}
|
||||||
|
return fakeReturns.result1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) SendActiveSpeakersCallCount() int {
|
||||||
|
fake.sendActiveSpeakersMutex.RLock()
|
||||||
|
defer fake.sendActiveSpeakersMutex.RUnlock()
|
||||||
|
return len(fake.sendActiveSpeakersArgsForCall)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) SendActiveSpeakersCalls(stub func([]*livekit.SpeakerInfo) error) {
|
||||||
|
fake.sendActiveSpeakersMutex.Lock()
|
||||||
|
defer fake.sendActiveSpeakersMutex.Unlock()
|
||||||
|
fake.SendActiveSpeakersStub = stub
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) SendActiveSpeakersArgsForCall(i int) []*livekit.SpeakerInfo {
|
||||||
|
fake.sendActiveSpeakersMutex.RLock()
|
||||||
|
defer fake.sendActiveSpeakersMutex.RUnlock()
|
||||||
|
argsForCall := fake.sendActiveSpeakersArgsForCall[i]
|
||||||
|
return argsForCall.arg1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) SendActiveSpeakersReturns(result1 error) {
|
||||||
|
fake.sendActiveSpeakersMutex.Lock()
|
||||||
|
defer fake.sendActiveSpeakersMutex.Unlock()
|
||||||
|
fake.SendActiveSpeakersStub = nil
|
||||||
|
fake.sendActiveSpeakersReturns = struct {
|
||||||
|
result1 error
|
||||||
|
}{result1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (fake *FakeParticipant) SendActiveSpeakersReturnsOnCall(i int, result1 error) {
|
||||||
|
fake.sendActiveSpeakersMutex.Lock()
|
||||||
|
defer fake.sendActiveSpeakersMutex.Unlock()
|
||||||
|
fake.SendActiveSpeakersStub = nil
|
||||||
|
if fake.sendActiveSpeakersReturnsOnCall == nil {
|
||||||
|
fake.sendActiveSpeakersReturnsOnCall = make(map[int]struct {
|
||||||
|
result1 error
|
||||||
|
})
|
||||||
|
}
|
||||||
|
fake.sendActiveSpeakersReturnsOnCall[i] = struct {
|
||||||
|
result1 error
|
||||||
|
}{result1}
|
||||||
|
}
|
||||||
|
|
||||||
func (fake *FakeParticipant) SendJoinResponse(arg1 *livekit.Room, arg2 []types.Participant) error {
|
func (fake *FakeParticipant) SendJoinResponse(arg1 *livekit.Room, arg2 []types.Participant) error {
|
||||||
var arg2Copy []types.Participant
|
var arg2Copy []types.Participant
|
||||||
if arg2 != nil {
|
if arg2 != nil {
|
||||||
@@ -1590,6 +1735,8 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
|
|||||||
defer fake.addTrackMutex.RUnlock()
|
defer fake.addTrackMutex.RUnlock()
|
||||||
fake.closeMutex.RLock()
|
fake.closeMutex.RLock()
|
||||||
defer fake.closeMutex.RUnlock()
|
defer fake.closeMutex.RUnlock()
|
||||||
|
fake.getAudioLevelMutex.RLock()
|
||||||
|
defer fake.getAudioLevelMutex.RUnlock()
|
||||||
fake.getResponseSinkMutex.RLock()
|
fake.getResponseSinkMutex.RLock()
|
||||||
defer fake.getResponseSinkMutex.RUnlock()
|
defer fake.getResponseSinkMutex.RUnlock()
|
||||||
fake.handleAnswerMutex.RLock()
|
fake.handleAnswerMutex.RLock()
|
||||||
@@ -1616,6 +1763,8 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
|
|||||||
defer fake.removeSubscribedTrackMutex.RUnlock()
|
defer fake.removeSubscribedTrackMutex.RUnlock()
|
||||||
fake.removeSubscriberMutex.RLock()
|
fake.removeSubscriberMutex.RLock()
|
||||||
defer fake.removeSubscriberMutex.RUnlock()
|
defer fake.removeSubscriberMutex.RUnlock()
|
||||||
|
fake.sendActiveSpeakersMutex.RLock()
|
||||||
|
defer fake.sendActiveSpeakersMutex.RUnlock()
|
||||||
fake.sendJoinResponseMutex.RLock()
|
fake.sendJoinResponseMutex.RLock()
|
||||||
defer fake.sendJoinResponseMutex.RUnlock()
|
defer fake.sendJoinResponseMutex.RUnlock()
|
||||||
fake.sendParticipantUpdateMutex.RLock()
|
fake.sendParticipantUpdateMutex.RLock()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/thoas/go-funk"
|
"github.com/thoas/go-funk"
|
||||||
|
|
||||||
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
"github.com/livekit/livekit-server/pkg/logger"
|
"github.com/livekit/livekit-server/pkg/logger"
|
||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc"
|
"github.com/livekit/livekit-server/pkg/rtc"
|
||||||
@@ -28,14 +29,16 @@ type RoomManager struct {
|
|||||||
router routing.Router
|
router routing.Router
|
||||||
currentNode routing.LocalNode
|
currentNode routing.LocalNode
|
||||||
config *rtc.WebRTCConfig
|
config *rtc.WebRTCConfig
|
||||||
|
audioConfig config.AudioConfig
|
||||||
rooms map[string]*rtc.Room
|
rooms map[string]*rtc.Room
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRoomManager(rp RoomStore, router routing.Router, currentNode routing.LocalNode, selector routing.NodeSelector, config *rtc.WebRTCConfig) *RoomManager {
|
func NewRoomManager(rp RoomStore, router routing.Router, currentNode routing.LocalNode, selector routing.NodeSelector, config *rtc.WebRTCConfig, ac config.AudioConfig) *RoomManager {
|
||||||
return &RoomManager{
|
return &RoomManager{
|
||||||
lock: sync.RWMutex{},
|
lock: sync.RWMutex{},
|
||||||
roomStore: rp,
|
roomStore: rp,
|
||||||
config: config,
|
config: config,
|
||||||
|
audioConfig: ac,
|
||||||
router: router,
|
router: router,
|
||||||
selector: selector,
|
selector: selector,
|
||||||
currentNode: currentNode,
|
currentNode: currentNode,
|
||||||
@@ -177,7 +180,7 @@ func (r *RoomManager) StartSession(roomName, identity, metadata string, reconnec
|
|||||||
"num_participants", len(room.GetParticipants()),
|
"num_participants", len(room.GetParticipants()),
|
||||||
)
|
)
|
||||||
|
|
||||||
participant, err = rtc.NewParticipant(identity, r.config, responseSink, r.config.Receiver)
|
participant, err = rtc.NewParticipant(identity, r.config, responseSink, r.config.Receiver, r.audioConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorw("could not create participant", "error", err)
|
logger.Errorw("could not create participant", "error", err)
|
||||||
return
|
return
|
||||||
@@ -214,7 +217,7 @@ func (r *RoomManager) getOrCreateRoom(roomName string) (*rtc.Room, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
room = rtc.NewRoom(ri, *r.config)
|
room = rtc.NewRoom(ri, *r.config, r.audioConfig.UpdateInterval)
|
||||||
room.OnClose(func() {
|
room.OnClose(func() {
|
||||||
if err := r.DeleteRoom(roomName); err != nil {
|
if err := r.DeleteRoom(roomName); err != nil {
|
||||||
logger.Errorw("could not delete room", "error", err)
|
logger.Errorw("could not delete room", "error", err)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/google/wire"
|
"github.com/google/wire"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
"github.com/livekit/livekit-server/pkg/logger"
|
"github.com/livekit/livekit-server/pkg/logger"
|
||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc"
|
"github.com/livekit/livekit-server/pkg/rtc"
|
||||||
@@ -17,6 +18,7 @@ var ServiceSet = wire.NewSet(
|
|||||||
NewRTCService,
|
NewRTCService,
|
||||||
NewLivekitServer,
|
NewLivekitServer,
|
||||||
NewRoomManager,
|
NewRoomManager,
|
||||||
|
config.GetAudioConfig,
|
||||||
wire.Bind(new(livekit.RoomService), new(*RoomService)),
|
wire.Bind(new(livekit.RoomService), new(*RoomService)),
|
||||||
externalIpFromNode,
|
externalIpFromNode,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ func InitializeServer(conf *config.Config, keyProvider auth.KeyProvider, roomSto
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
roomManager := NewRoomManager(roomStore, router, currentNode, selector, webRTCConfig)
|
audioConfig := config.GetAudioConfig(conf)
|
||||||
|
roomManager := NewRoomManager(roomStore, router, currentNode, selector, webRTCConfig, audioConfig)
|
||||||
roomService, err := NewRoomService(roomManager)
|
roomService, err := NewRoomService(roomManager)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
+242
-73
@@ -223,6 +223,7 @@ type SignalResponse struct {
|
|||||||
// *SignalResponse_Trickle
|
// *SignalResponse_Trickle
|
||||||
// *SignalResponse_Update
|
// *SignalResponse_Update
|
||||||
// *SignalResponse_TrackPublished
|
// *SignalResponse_TrackPublished
|
||||||
|
// *SignalResponse_Speaker
|
||||||
Message isSignalResponse_Message `protobuf_oneof:"message"`
|
Message isSignalResponse_Message `protobuf_oneof:"message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,6 +308,13 @@ func (x *SignalResponse) GetTrackPublished() *TrackPublishedResponse {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *SignalResponse) GetSpeaker() *ActiveSpeakerUpdate {
|
||||||
|
if x, ok := x.GetMessage().(*SignalResponse_Speaker); ok {
|
||||||
|
return x.Speaker
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type isSignalResponse_Message interface {
|
type isSignalResponse_Message interface {
|
||||||
isSignalResponse_Message()
|
isSignalResponse_Message()
|
||||||
}
|
}
|
||||||
@@ -341,6 +349,11 @@ type SignalResponse_TrackPublished struct {
|
|||||||
TrackPublished *TrackPublishedResponse `protobuf:"bytes,6,opt,name=track_published,json=trackPublished,proto3,oneof"`
|
TrackPublished *TrackPublishedResponse `protobuf:"bytes,6,opt,name=track_published,json=trackPublished,proto3,oneof"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SignalResponse_Speaker struct {
|
||||||
|
// list of active speakers
|
||||||
|
Speaker *ActiveSpeakerUpdate `protobuf:"bytes,7,opt,name=speaker,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
func (*SignalResponse_Join) isSignalResponse_Message() {}
|
func (*SignalResponse_Join) isSignalResponse_Message() {}
|
||||||
|
|
||||||
func (*SignalResponse_Answer) isSignalResponse_Message() {}
|
func (*SignalResponse_Answer) isSignalResponse_Message() {}
|
||||||
@@ -353,6 +366,8 @@ func (*SignalResponse_Update) isSignalResponse_Message() {}
|
|||||||
|
|
||||||
func (*SignalResponse_TrackPublished) isSignalResponse_Message() {}
|
func (*SignalResponse_TrackPublished) isSignalResponse_Message() {}
|
||||||
|
|
||||||
|
func (*SignalResponse_Speaker) isSignalResponse_Message() {}
|
||||||
|
|
||||||
type AddTrackRequest struct {
|
type AddTrackRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@@ -793,6 +808,118 @@ func (x *ParticipantUpdate) GetParticipants() []*ParticipantInfo {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ActiveSpeakerUpdate struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Speakers []*SpeakerInfo `protobuf:"bytes,1,rep,name=speakers,proto3" json:"speakers,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ActiveSpeakerUpdate) Reset() {
|
||||||
|
*x = ActiveSpeakerUpdate{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_rtc_proto_msgTypes[10]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ActiveSpeakerUpdate) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ActiveSpeakerUpdate) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ActiveSpeakerUpdate) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_rtc_proto_msgTypes[10]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ActiveSpeakerUpdate.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ActiveSpeakerUpdate) Descriptor() ([]byte, []int) {
|
||||||
|
return file_rtc_proto_rawDescGZIP(), []int{10}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ActiveSpeakerUpdate) GetSpeakers() []*SpeakerInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.Speakers
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type SpeakerInfo struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
|
||||||
|
// audio level, 0-1.0, 1 is loudest
|
||||||
|
Level float32 `protobuf:"fixed32,2,opt,name=level,proto3" json:"level,omitempty"`
|
||||||
|
// true if speaker is currently active
|
||||||
|
Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SpeakerInfo) Reset() {
|
||||||
|
*x = SpeakerInfo{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_rtc_proto_msgTypes[11]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SpeakerInfo) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*SpeakerInfo) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *SpeakerInfo) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_rtc_proto_msgTypes[11]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use SpeakerInfo.ProtoReflect.Descriptor instead.
|
||||||
|
func (*SpeakerInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return file_rtc_proto_rawDescGZIP(), []int{11}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SpeakerInfo) GetSid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Sid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SpeakerInfo) GetLevel() float32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Level
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SpeakerInfo) GetActive() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Active
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
var File_rtc_proto protoreflect.FileDescriptor
|
var File_rtc_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_rtc_proto_rawDesc = []byte{
|
var file_rtc_proto_rawDesc = []byte{
|
||||||
@@ -821,7 +948,7 @@ var file_rtc_proto_rawDesc = []byte{
|
|||||||
0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65,
|
0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||||
0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x6d, 0x75, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
|
0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x6d, 0x75, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
|
||||||
0x69, 0x62, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22,
|
0x69, 0x62, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22,
|
||||||
0xeb, 0x02, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
0xa5, 0x03, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
||||||
0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x52,
|
0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x52,
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x12,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x12,
|
||||||
@@ -843,60 +970,73 @@ var file_rtc_proto_rawDesc = []byte{
|
|||||||
0x1f, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x50,
|
0x1f, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x50,
|
||||||
0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x48, 0x00, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68,
|
0x48, 0x00, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68,
|
||||||
0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x5f, 0x0a,
|
0x65, 0x64, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x18, 0x07, 0x20,
|
||||||
0x0f, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x41, 0x63,
|
||||||
0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63,
|
0x74, 0x69, 0x76, 0x65, 0x53, 0x70, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74,
|
||||||
0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x65, 0x48, 0x00, 0x52, 0x07, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x42, 0x09, 0x0a, 0x07,
|
||||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03,
|
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x5f, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x54, 0x72,
|
||||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54,
|
0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69,
|
||||||
0x72, 0x61, 0x63, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x65,
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04,
|
||||||
0x0a, 0x0e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
0x12, 0x24, 0x0a, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x69,
|
0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12,
|
||||||
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61,
|
0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x54, 0x79,
|
||||||
0x74, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
|
0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x65, 0x0a, 0x0e, 0x54, 0x72, 0x69, 0x63,
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74,
|
0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x61,
|
||||||
0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74,
|
0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x3a, 0x0a, 0x10, 0x4d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61,
|
0x09, 0x52, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x69, 0x74,
|
||||||
0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64,
|
0x12, 0x2d, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d,
|
0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61,
|
||||||
0x75, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65,
|
0x6c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22,
|
||||||
0x64, 0x22, 0x14, 0x0a, 0x12, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
0x3a, 0x0a, 0x10, 0x4d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xdd, 0x01, 0x0a, 0x0c, 0x4a, 0x6f, 0x69, 0x6e,
|
0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d,
|
0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x02,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74,
|
0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x4e,
|
||||||
0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x3a, 0x0a, 0x0b, 0x70,
|
0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
0x74, 0x22, 0xdd, 0x01, 0x0a, 0x0c, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69,
|
0x73, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
||||||
0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74,
|
0x32, 0x0d, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x52,
|
||||||
0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x12, 0x6f, 0x74, 0x68, 0x65, 0x72,
|
0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69,
|
||||||
0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20,
|
0x70, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76,
|
||||||
0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61,
|
0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74,
|
||||||
0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x11, 0x6f,
|
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e,
|
||||||
0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73,
|
0x74, 0x12, 0x47, 0x0a, 0x12, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69,
|
||||||
0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,
|
0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e,
|
||||||
0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70,
|
||||||
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x54, 0x0a, 0x16, 0x54, 0x72, 0x61, 0x63, 0x6b,
|
0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x11, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x50, 0x61,
|
||||||
0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65,
|
||||||
0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01,
|
||||||
0x63, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01,
|
0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
|
||||||
0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61,
|
0x6e, 0x22, 0x54, 0x0a, 0x16, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73,
|
||||||
0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x22, 0x3a, 0x0a,
|
0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63,
|
||||||
0x12, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
|
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x28, 0x0a,
|
||||||
0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c,
|
||||||
0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x64, 0x70, 0x18, 0x02,
|
0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x64, 0x70, 0x22, 0x51, 0x0a, 0x11, 0x50, 0x61, 0x72,
|
0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x22, 0x3a, 0x0a, 0x12, 0x53, 0x65, 0x73, 0x73, 0x69,
|
||||||
0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x3c,
|
0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a,
|
||||||
0x0a, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01,
|
0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70,
|
||||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50,
|
0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x64, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||||
0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c,
|
0x73, 0x64, 0x70, 0x22, 0x51, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61,
|
||||||
0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x2a, 0x2d, 0x0a, 0x0c,
|
0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x70, 0x61, 0x72, 0x74,
|
||||||
0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x0d, 0x0a, 0x09,
|
0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18,
|
||||||
0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x52, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x53,
|
0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69,
|
||||||
0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45, 0x52, 0x10, 0x01, 0x42, 0x31, 0x5a, 0x2f, 0x67,
|
0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63,
|
||||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69,
|
0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x47, 0x0a, 0x13, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65,
|
||||||
0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
0x53, 0x70, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x30, 0x0a,
|
||||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06,
|
0x08, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x14, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x70, 0x65, 0x61, 0x6b, 0x65,
|
||||||
|
0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x73, 0x70, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x73, 0x22,
|
||||||
|
0x4d, 0x0a, 0x0b, 0x53, 0x70, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10,
|
||||||
|
0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64,
|
||||||
|
0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52,
|
||||||
|
0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65,
|
||||||
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2a, 0x2d,
|
||||||
|
0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x0d,
|
||||||
|
0x0a, 0x09, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x52, 0x10, 0x00, 0x12, 0x0e, 0x0a,
|
||||||
|
0x0a, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45, 0x52, 0x10, 0x01, 0x42, 0x31, 0x5a,
|
||||||
|
0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65,
|
||||||
|
0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76,
|
||||||
|
0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -912,7 +1052,7 @@ func file_rtc_proto_rawDescGZIP() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var file_rtc_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
var file_rtc_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
var file_rtc_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
var file_rtc_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||||
var file_rtc_proto_goTypes = []interface{}{
|
var file_rtc_proto_goTypes = []interface{}{
|
||||||
(SignalTarget)(0), // 0: livekit.SignalTarget
|
(SignalTarget)(0), // 0: livekit.SignalTarget
|
||||||
(*SignalRequest)(nil), // 1: livekit.SignalRequest
|
(*SignalRequest)(nil), // 1: livekit.SignalRequest
|
||||||
@@ -925,10 +1065,12 @@ var file_rtc_proto_goTypes = []interface{}{
|
|||||||
(*TrackPublishedResponse)(nil), // 8: livekit.TrackPublishedResponse
|
(*TrackPublishedResponse)(nil), // 8: livekit.TrackPublishedResponse
|
||||||
(*SessionDescription)(nil), // 9: livekit.SessionDescription
|
(*SessionDescription)(nil), // 9: livekit.SessionDescription
|
||||||
(*ParticipantUpdate)(nil), // 10: livekit.ParticipantUpdate
|
(*ParticipantUpdate)(nil), // 10: livekit.ParticipantUpdate
|
||||||
(TrackType)(0), // 11: livekit.TrackType
|
(*ActiveSpeakerUpdate)(nil), // 11: livekit.ActiveSpeakerUpdate
|
||||||
(*Room)(nil), // 12: livekit.Room
|
(*SpeakerInfo)(nil), // 12: livekit.SpeakerInfo
|
||||||
(*ParticipantInfo)(nil), // 13: livekit.ParticipantInfo
|
(TrackType)(0), // 13: livekit.TrackType
|
||||||
(*TrackInfo)(nil), // 14: livekit.TrackInfo
|
(*Room)(nil), // 14: livekit.Room
|
||||||
|
(*ParticipantInfo)(nil), // 15: livekit.ParticipantInfo
|
||||||
|
(*TrackInfo)(nil), // 16: livekit.TrackInfo
|
||||||
}
|
}
|
||||||
var file_rtc_proto_depIdxs = []int32{
|
var file_rtc_proto_depIdxs = []int32{
|
||||||
9, // 0: livekit.SignalRequest.offer:type_name -> livekit.SessionDescription
|
9, // 0: livekit.SignalRequest.offer:type_name -> livekit.SessionDescription
|
||||||
@@ -943,18 +1085,20 @@ var file_rtc_proto_depIdxs = []int32{
|
|||||||
4, // 9: livekit.SignalResponse.trickle:type_name -> livekit.TrickleRequest
|
4, // 9: livekit.SignalResponse.trickle:type_name -> livekit.TrickleRequest
|
||||||
10, // 10: livekit.SignalResponse.update:type_name -> livekit.ParticipantUpdate
|
10, // 10: livekit.SignalResponse.update:type_name -> livekit.ParticipantUpdate
|
||||||
8, // 11: livekit.SignalResponse.track_published:type_name -> livekit.TrackPublishedResponse
|
8, // 11: livekit.SignalResponse.track_published:type_name -> livekit.TrackPublishedResponse
|
||||||
11, // 12: livekit.AddTrackRequest.type:type_name -> livekit.TrackType
|
11, // 12: livekit.SignalResponse.speaker:type_name -> livekit.ActiveSpeakerUpdate
|
||||||
0, // 13: livekit.TrickleRequest.target:type_name -> livekit.SignalTarget
|
13, // 13: livekit.AddTrackRequest.type:type_name -> livekit.TrackType
|
||||||
12, // 14: livekit.JoinResponse.room:type_name -> livekit.Room
|
0, // 14: livekit.TrickleRequest.target:type_name -> livekit.SignalTarget
|
||||||
13, // 15: livekit.JoinResponse.participant:type_name -> livekit.ParticipantInfo
|
14, // 15: livekit.JoinResponse.room:type_name -> livekit.Room
|
||||||
13, // 16: livekit.JoinResponse.other_participants:type_name -> livekit.ParticipantInfo
|
15, // 16: livekit.JoinResponse.participant:type_name -> livekit.ParticipantInfo
|
||||||
14, // 17: livekit.TrackPublishedResponse.track:type_name -> livekit.TrackInfo
|
15, // 17: livekit.JoinResponse.other_participants:type_name -> livekit.ParticipantInfo
|
||||||
13, // 18: livekit.ParticipantUpdate.participants:type_name -> livekit.ParticipantInfo
|
16, // 18: livekit.TrackPublishedResponse.track:type_name -> livekit.TrackInfo
|
||||||
19, // [19:19] is the sub-list for method output_type
|
15, // 19: livekit.ParticipantUpdate.participants:type_name -> livekit.ParticipantInfo
|
||||||
19, // [19:19] is the sub-list for method input_type
|
12, // 20: livekit.ActiveSpeakerUpdate.speakers:type_name -> livekit.SpeakerInfo
|
||||||
19, // [19:19] is the sub-list for extension type_name
|
21, // [21:21] is the sub-list for method output_type
|
||||||
19, // [19:19] is the sub-list for extension extendee
|
21, // [21:21] is the sub-list for method input_type
|
||||||
0, // [0:19] is the sub-list for field type_name
|
21, // [21:21] is the sub-list for extension type_name
|
||||||
|
21, // [21:21] is the sub-list for extension extendee
|
||||||
|
0, // [0:21] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_rtc_proto_init() }
|
func init() { file_rtc_proto_init() }
|
||||||
@@ -1084,6 +1228,30 @@ func file_rtc_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_rtc_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*ActiveSpeakerUpdate); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_rtc_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*SpeakerInfo); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
file_rtc_proto_msgTypes[0].OneofWrappers = []interface{}{
|
file_rtc_proto_msgTypes[0].OneofWrappers = []interface{}{
|
||||||
(*SignalRequest_Offer)(nil),
|
(*SignalRequest_Offer)(nil),
|
||||||
@@ -1100,6 +1268,7 @@ func file_rtc_proto_init() {
|
|||||||
(*SignalResponse_Trickle)(nil),
|
(*SignalResponse_Trickle)(nil),
|
||||||
(*SignalResponse_Update)(nil),
|
(*SignalResponse_Update)(nil),
|
||||||
(*SignalResponse_TrackPublished)(nil),
|
(*SignalResponse_TrackPublished)(nil),
|
||||||
|
(*SignalResponse_Speaker)(nil),
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@@ -1107,7 +1276,7 @@ func file_rtc_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_rtc_proto_rawDesc,
|
RawDescriptor: file_rtc_proto_rawDesc,
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 10,
|
NumMessages: 12,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ message SignalResponse {
|
|||||||
ParticipantUpdate update = 5;
|
ParticipantUpdate update = 5;
|
||||||
// sent to the participant when their track has been published
|
// sent to the participant when their track has been published
|
||||||
TrackPublishedResponse track_published = 6;
|
TrackPublishedResponse track_published = 6;
|
||||||
|
// list of active speakers
|
||||||
|
ActiveSpeakerUpdate speaker = 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,3 +85,15 @@ message SessionDescription {
|
|||||||
message ParticipantUpdate {
|
message ParticipantUpdate {
|
||||||
repeated ParticipantInfo participants = 1;
|
repeated ParticipantInfo participants = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ActiveSpeakerUpdate {
|
||||||
|
repeated SpeakerInfo speakers = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SpeakerInfo {
|
||||||
|
string sid = 1;
|
||||||
|
// audio level, 0-1.0, 1 is loudest
|
||||||
|
float level = 2;
|
||||||
|
// true if speaker is currently active
|
||||||
|
bool active = 3;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user