mirror of
https://github.com/livekit/livekit.git
synced 2026-10-23 15:12:43 +00:00
Handle UpdateLocalAudioTrack and UpdateLocalVideoTrack. (#2684)
* Handle UpdateLocalAudioTrack and UpdateLocalVideoTrack. - Update the TrackInfo - NOTE: populating Stereo and DisableDtx fields although there are features now. - The audio features in UpdateLocalAudioTrack is applied as is, i. e. the update has the latest set of features. - Emits a track update which will broadcast a participant update. TODO: ----- - Telemetry event with track update? * update deps
This commit is contained in:
1 parent
b55038af03
commit
90b47424b5
11 files changed
+588
-42
No files matched your search
@@ -649,7 +649,7 @@ func (t *MediaTrackReceiver) UpdateTrackInfo(ti *livekit.TrackInfo) {
|
||||
break
|
||||
}
|
||||
|
||||
// for client don't use simulcast codecs (old client version or single codec)
|
||||
// for clients that don't use simulcast codecs (old client version or single codec)
|
||||
if i == 0 {
|
||||
clonedInfo.Layers = ci.Layers
|
||||
}
|
||||
@@ -667,6 +667,41 @@ func (t *MediaTrackReceiver) UpdateTrackInfo(ti *livekit.TrackInfo) {
|
||||
t.updateTrackInfoOfReceivers()
|
||||
}
|
||||
|
||||
func (t *MediaTrackReceiver) UpdateAudioTrack(update *livekit.UpdateLocalAudioTrack) {
|
||||
if t.Kind() != livekit.TrackType_AUDIO {
|
||||
return
|
||||
}
|
||||
|
||||
t.lock.Lock()
|
||||
t.trackInfo.AudioFeatures = update.Features
|
||||
t.trackInfo.Stereo = false
|
||||
t.trackInfo.DisableDtx = false
|
||||
for _, feature := range update.Features {
|
||||
switch feature {
|
||||
case livekit.AudioTrackFeature_TF_STEREO:
|
||||
t.trackInfo.Stereo = true
|
||||
case livekit.AudioTrackFeature_TF_NO_DTX:
|
||||
t.trackInfo.DisableDtx = true
|
||||
}
|
||||
}
|
||||
t.lock.Unlock()
|
||||
|
||||
t.updateTrackInfoOfReceivers()
|
||||
}
|
||||
|
||||
func (t *MediaTrackReceiver) UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack) {
|
||||
if t.Kind() != livekit.TrackType_VIDEO {
|
||||
return
|
||||
}
|
||||
|
||||
t.lock.Lock()
|
||||
t.trackInfo.Width = update.Width
|
||||
t.trackInfo.Height = update.Height
|
||||
t.lock.Unlock()
|
||||
|
||||
t.updateTrackInfoOfReceivers()
|
||||
}
|
||||
|
||||
func (t *MediaTrackReceiver) UpdateVideoLayers(layers []*livekit.VideoLayer) {
|
||||
t.lock.Lock()
|
||||
// set video layer ssrc info
|
||||
|
||||
@@ -1816,6 +1816,12 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
|
||||
Encryption: req.Encryption,
|
||||
Stream: req.Stream,
|
||||
}
|
||||
if req.Stereo {
|
||||
ti.AudioFeatures = append(ti.AudioFeatures, livekit.AudioTrackFeature_TF_STEREO)
|
||||
}
|
||||
if req.DisableDtx {
|
||||
ti.AudioFeatures = append(ti.AudioFeatures, livekit.AudioTrackFeature_TF_NO_DTX)
|
||||
}
|
||||
if ti.Stream == "" {
|
||||
ti.Stream = StreamFromTrackSource(ti.Source)
|
||||
}
|
||||
|
||||
@@ -27,8 +27,10 @@ func HandleParticipantSignal(room types.Room, participant types.LocalParticipant
|
||||
switch msg := req.GetMessage().(type) {
|
||||
case *livekit.SignalRequest_Offer:
|
||||
participant.HandleOffer(FromProtoSessionDescription(msg.Offer))
|
||||
|
||||
case *livekit.SignalRequest_Answer:
|
||||
participant.HandleAnswer(FromProtoSessionDescription(msg.Answer))
|
||||
|
||||
case *livekit.SignalRequest_Trickle:
|
||||
candidateInit, err := FromProtoTrickle(msg.Trickle)
|
||||
if err != nil {
|
||||
@@ -36,11 +38,14 @@ func HandleParticipantSignal(room types.Room, participant types.LocalParticipant
|
||||
return nil
|
||||
}
|
||||
participant.AddICECandidate(candidateInit, msg.Trickle.Target)
|
||||
|
||||
case *livekit.SignalRequest_AddTrack:
|
||||
pLogger.Debugw("add track request", "trackID", msg.AddTrack.Cid)
|
||||
participant.AddTrack(msg.AddTrack)
|
||||
|
||||
case *livekit.SignalRequest_Mute:
|
||||
participant.SetTrackMuted(livekit.TrackID(msg.Mute.Sid), msg.Mute.Muted, false)
|
||||
|
||||
case *livekit.SignalRequest_Subscription:
|
||||
// allow participant to indicate their interest in the subscription
|
||||
// permission check happens later in SubscriptionManager
|
||||
@@ -50,25 +55,30 @@ func HandleParticipantSignal(room types.Room, participant types.LocalParticipant
|
||||
msg.Subscription.ParticipantTracks,
|
||||
msg.Subscription.Subscribe,
|
||||
)
|
||||
|
||||
case *livekit.SignalRequest_TrackSetting:
|
||||
for _, sid := range livekit.StringsAsIDs[livekit.TrackID](msg.TrackSetting.TrackSids) {
|
||||
participant.UpdateSubscribedTrackSettings(sid, msg.TrackSetting)
|
||||
}
|
||||
|
||||
case *livekit.SignalRequest_Leave:
|
||||
pLogger.Debugw("client leaving room")
|
||||
room.RemoveParticipant(participant.Identity(), participant.ID(), types.ParticipantCloseReasonClientRequestLeave)
|
||||
|
||||
case *livekit.SignalRequest_SubscriptionPermission:
|
||||
err := room.UpdateSubscriptionPermission(participant, msg.SubscriptionPermission)
|
||||
if err != nil {
|
||||
pLogger.Warnw("could not update subscription permission", err,
|
||||
"permissions", msg.SubscriptionPermission)
|
||||
}
|
||||
|
||||
case *livekit.SignalRequest_SyncState:
|
||||
err := room.SyncState(participant, msg.SyncState)
|
||||
if err != nil {
|
||||
pLogger.Warnw("could not sync state", err,
|
||||
"state", msg.SyncState)
|
||||
}
|
||||
|
||||
case *livekit.SignalRequest_Simulate:
|
||||
err := room.SimulateScenario(participant, msg.Simulate)
|
||||
if err != nil {
|
||||
@@ -85,6 +95,17 @@ func HandleParticipantSignal(room types.Room, participant types.LocalParticipant
|
||||
if participant.ClaimGrants().Video.GetCanUpdateOwnMetadata() {
|
||||
room.UpdateParticipantMetadata(participant, msg.UpdateMetadata.Name, msg.UpdateMetadata.Metadata)
|
||||
}
|
||||
|
||||
case *livekit.SignalRequest_UpdateAudioTrack:
|
||||
if err := participant.UpdateAudioTrack(msg.UpdateAudioTrack); err != nil {
|
||||
pLogger.Warnw("could not update audio track", err, "update", msg.UpdateAudioTrack)
|
||||
}
|
||||
|
||||
case *livekit.SignalRequest_UpdateVideoTrack:
|
||||
if err := participant.UpdateVideoTrack(msg.UpdateVideoTrack); err != nil {
|
||||
pLogger.Warnw("could not update video track", err, "update", msg.UpdateVideoTrack)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -280,6 +280,8 @@ type Participant interface {
|
||||
resolverBySid func(participantID livekit.ParticipantID) LocalParticipant,
|
||||
) error
|
||||
UpdateVideoLayers(updateVideoLayers *livekit.UpdateVideoLayers) error
|
||||
UpdateAudioTrack(update *livekit.UpdateLocalAudioTrack) error
|
||||
UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack) error
|
||||
|
||||
DebugInfo() map[string]interface{}
|
||||
}
|
||||
@@ -451,6 +453,8 @@ type MediaTrack interface {
|
||||
Stream() string
|
||||
|
||||
UpdateTrackInfo(ti *livekit.TrackInfo)
|
||||
UpdateAudioTrack(update *livekit.UpdateLocalAudioTrack)
|
||||
UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack)
|
||||
ToProto() *livekit.TrackInfo
|
||||
|
||||
PublisherID() livekit.ParticipantID
|
||||
|
||||
@@ -332,6 +332,11 @@ type FakeLocalMediaTrack struct {
|
||||
toProtoReturnsOnCall map[int]struct {
|
||||
result1 *livekit.TrackInfo
|
||||
}
|
||||
UpdateAudioTrackStub func(*livekit.UpdateLocalAudioTrack)
|
||||
updateAudioTrackMutex sync.RWMutex
|
||||
updateAudioTrackArgsForCall []struct {
|
||||
arg1 *livekit.UpdateLocalAudioTrack
|
||||
}
|
||||
UpdateTrackInfoStub func(*livekit.TrackInfo)
|
||||
updateTrackInfoMutex sync.RWMutex
|
||||
updateTrackInfoArgsForCall []struct {
|
||||
@@ -342,6 +347,11 @@ type FakeLocalMediaTrack struct {
|
||||
updateVideoLayersArgsForCall []struct {
|
||||
arg1 []*livekit.VideoLayer
|
||||
}
|
||||
UpdateVideoTrackStub func(*livekit.UpdateLocalVideoTrack)
|
||||
updateVideoTrackMutex sync.RWMutex
|
||||
updateVideoTrackArgsForCall []struct {
|
||||
arg1 *livekit.UpdateLocalVideoTrack
|
||||
}
|
||||
invocations map[string][][]interface{}
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
@@ -2077,6 +2087,38 @@ func (fake *FakeLocalMediaTrack) ToProtoReturnsOnCall(i int, result1 *livekit.Tr
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateAudioTrack(arg1 *livekit.UpdateLocalAudioTrack) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
fake.updateAudioTrackArgsForCall = append(fake.updateAudioTrackArgsForCall, struct {
|
||||
arg1 *livekit.UpdateLocalAudioTrack
|
||||
}{arg1})
|
||||
stub := fake.UpdateAudioTrackStub
|
||||
fake.recordInvocation("UpdateAudioTrack", []interface{}{arg1})
|
||||
fake.updateAudioTrackMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.UpdateAudioTrackStub(arg1)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateAudioTrackCallCount() int {
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
return len(fake.updateAudioTrackArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateAudioTrackCalls(stub func(*livekit.UpdateLocalAudioTrack)) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
defer fake.updateAudioTrackMutex.Unlock()
|
||||
fake.UpdateAudioTrackStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateAudioTrackArgsForCall(i int) *livekit.UpdateLocalAudioTrack {
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
argsForCall := fake.updateAudioTrackArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateTrackInfo(arg1 *livekit.TrackInfo) {
|
||||
fake.updateTrackInfoMutex.Lock()
|
||||
fake.updateTrackInfoArgsForCall = append(fake.updateTrackInfoArgsForCall, struct {
|
||||
@@ -2146,6 +2188,38 @@ func (fake *FakeLocalMediaTrack) UpdateVideoLayersArgsForCall(i int) []*livekit.
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateVideoTrack(arg1 *livekit.UpdateLocalVideoTrack) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
fake.updateVideoTrackArgsForCall = append(fake.updateVideoTrackArgsForCall, struct {
|
||||
arg1 *livekit.UpdateLocalVideoTrack
|
||||
}{arg1})
|
||||
stub := fake.UpdateVideoTrackStub
|
||||
fake.recordInvocation("UpdateVideoTrack", []interface{}{arg1})
|
||||
fake.updateVideoTrackMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.UpdateVideoTrackStub(arg1)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateVideoTrackCallCount() int {
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
return len(fake.updateVideoTrackArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateVideoTrackCalls(stub func(*livekit.UpdateLocalVideoTrack)) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
defer fake.updateVideoTrackMutex.Unlock()
|
||||
fake.UpdateVideoTrackStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) UpdateVideoTrackArgsForCall(i int) *livekit.UpdateLocalVideoTrack {
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
argsForCall := fake.updateVideoTrackArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
@@ -2219,10 +2293,14 @@ func (fake *FakeLocalMediaTrack) Invocations() map[string][][]interface{} {
|
||||
defer fake.streamMutex.RUnlock()
|
||||
fake.toProtoMutex.RLock()
|
||||
defer fake.toProtoMutex.RUnlock()
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
fake.updateTrackInfoMutex.RLock()
|
||||
defer fake.updateTrackInfoMutex.RUnlock()
|
||||
fake.updateVideoLayersMutex.RLock()
|
||||
defer fake.updateVideoLayersMutex.RUnlock()
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
copiedInvocations := map[string][][]interface{}{}
|
||||
for key, value := range fake.invocations {
|
||||
copiedInvocations[key] = value
|
||||
|
||||
@@ -916,6 +916,17 @@ type FakeLocalParticipant struct {
|
||||
unsubscribeFromTrackArgsForCall []struct {
|
||||
arg1 livekit.TrackID
|
||||
}
|
||||
UpdateAudioTrackStub func(*livekit.UpdateLocalAudioTrack) error
|
||||
updateAudioTrackMutex sync.RWMutex
|
||||
updateAudioTrackArgsForCall []struct {
|
||||
arg1 *livekit.UpdateLocalAudioTrack
|
||||
}
|
||||
updateAudioTrackReturns struct {
|
||||
result1 error
|
||||
}
|
||||
updateAudioTrackReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
UpdateLastSeenSignalStub func()
|
||||
updateLastSeenSignalMutex sync.RWMutex
|
||||
updateLastSeenSignalArgsForCall []struct {
|
||||
@@ -986,6 +997,17 @@ type FakeLocalParticipant struct {
|
||||
updateVideoLayersReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
UpdateVideoTrackStub func(*livekit.UpdateLocalVideoTrack) error
|
||||
updateVideoTrackMutex sync.RWMutex
|
||||
updateVideoTrackArgsForCall []struct {
|
||||
arg1 *livekit.UpdateLocalVideoTrack
|
||||
}
|
||||
updateVideoTrackReturns struct {
|
||||
result1 error
|
||||
}
|
||||
updateVideoTrackReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
VerifySubscribeParticipantInfoStub func(livekit.ParticipantID, uint32)
|
||||
verifySubscribeParticipantInfoMutex sync.RWMutex
|
||||
verifySubscribeParticipantInfoArgsForCall []struct {
|
||||
@@ -5902,6 +5924,67 @@ func (fake *FakeLocalParticipant) UnsubscribeFromTrackArgsForCall(i int) livekit
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateAudioTrack(arg1 *livekit.UpdateLocalAudioTrack) error {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
ret, specificReturn := fake.updateAudioTrackReturnsOnCall[len(fake.updateAudioTrackArgsForCall)]
|
||||
fake.updateAudioTrackArgsForCall = append(fake.updateAudioTrackArgsForCall, struct {
|
||||
arg1 *livekit.UpdateLocalAudioTrack
|
||||
}{arg1})
|
||||
stub := fake.UpdateAudioTrackStub
|
||||
fakeReturns := fake.updateAudioTrackReturns
|
||||
fake.recordInvocation("UpdateAudioTrack", []interface{}{arg1})
|
||||
fake.updateAudioTrackMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateAudioTrackCallCount() int {
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
return len(fake.updateAudioTrackArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateAudioTrackCalls(stub func(*livekit.UpdateLocalAudioTrack) error) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
defer fake.updateAudioTrackMutex.Unlock()
|
||||
fake.UpdateAudioTrackStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateAudioTrackArgsForCall(i int) *livekit.UpdateLocalAudioTrack {
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
argsForCall := fake.updateAudioTrackArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateAudioTrackReturns(result1 error) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
defer fake.updateAudioTrackMutex.Unlock()
|
||||
fake.UpdateAudioTrackStub = nil
|
||||
fake.updateAudioTrackReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateAudioTrackReturnsOnCall(i int, result1 error) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
defer fake.updateAudioTrackMutex.Unlock()
|
||||
fake.UpdateAudioTrackStub = nil
|
||||
if fake.updateAudioTrackReturnsOnCall == nil {
|
||||
fake.updateAudioTrackReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.updateAudioTrackReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateLastSeenSignal() {
|
||||
fake.updateLastSeenSignalMutex.Lock()
|
||||
fake.updateLastSeenSignalArgsForCall = append(fake.updateLastSeenSignalArgsForCall, struct {
|
||||
@@ -6278,6 +6361,67 @@ func (fake *FakeLocalParticipant) UpdateVideoLayersReturnsOnCall(i int, result1
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateVideoTrack(arg1 *livekit.UpdateLocalVideoTrack) error {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
ret, specificReturn := fake.updateVideoTrackReturnsOnCall[len(fake.updateVideoTrackArgsForCall)]
|
||||
fake.updateVideoTrackArgsForCall = append(fake.updateVideoTrackArgsForCall, struct {
|
||||
arg1 *livekit.UpdateLocalVideoTrack
|
||||
}{arg1})
|
||||
stub := fake.UpdateVideoTrackStub
|
||||
fakeReturns := fake.updateVideoTrackReturns
|
||||
fake.recordInvocation("UpdateVideoTrack", []interface{}{arg1})
|
||||
fake.updateVideoTrackMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateVideoTrackCallCount() int {
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
return len(fake.updateVideoTrackArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateVideoTrackCalls(stub func(*livekit.UpdateLocalVideoTrack) error) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
defer fake.updateVideoTrackMutex.Unlock()
|
||||
fake.UpdateVideoTrackStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateVideoTrackArgsForCall(i int) *livekit.UpdateLocalVideoTrack {
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
argsForCall := fake.updateVideoTrackArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateVideoTrackReturns(result1 error) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
defer fake.updateVideoTrackMutex.Unlock()
|
||||
fake.UpdateVideoTrackStub = nil
|
||||
fake.updateVideoTrackReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) UpdateVideoTrackReturnsOnCall(i int, result1 error) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
defer fake.updateVideoTrackMutex.Unlock()
|
||||
fake.UpdateVideoTrackStub = nil
|
||||
if fake.updateVideoTrackReturnsOnCall == nil {
|
||||
fake.updateVideoTrackReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.updateVideoTrackReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) VerifySubscribeParticipantInfo(arg1 livekit.ParticipantID, arg2 uint32) {
|
||||
fake.verifySubscribeParticipantInfoMutex.Lock()
|
||||
fake.verifySubscribeParticipantInfoArgsForCall = append(fake.verifySubscribeParticipantInfoArgsForCall, struct {
|
||||
@@ -6647,6 +6791,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} {
|
||||
defer fake.uncacheDownTrackMutex.RUnlock()
|
||||
fake.unsubscribeFromTrackMutex.RLock()
|
||||
defer fake.unsubscribeFromTrackMutex.RUnlock()
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
fake.updateLastSeenSignalMutex.RLock()
|
||||
defer fake.updateLastSeenSignalMutex.RUnlock()
|
||||
fake.updateMediaLossMutex.RLock()
|
||||
@@ -6663,6 +6809,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} {
|
||||
defer fake.updateSubscriptionPermissionMutex.RUnlock()
|
||||
fake.updateVideoLayersMutex.RLock()
|
||||
defer fake.updateVideoLayersMutex.RUnlock()
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
fake.verifySubscribeParticipantInfoMutex.RLock()
|
||||
defer fake.verifySubscribeParticipantInfoMutex.RUnlock()
|
||||
fake.waitUntilSubscribedMutex.RLock()
|
||||
|
||||
@@ -268,6 +268,11 @@ type FakeMediaTrack struct {
|
||||
toProtoReturnsOnCall map[int]struct {
|
||||
result1 *livekit.TrackInfo
|
||||
}
|
||||
UpdateAudioTrackStub func(*livekit.UpdateLocalAudioTrack)
|
||||
updateAudioTrackMutex sync.RWMutex
|
||||
updateAudioTrackArgsForCall []struct {
|
||||
arg1 *livekit.UpdateLocalAudioTrack
|
||||
}
|
||||
UpdateTrackInfoStub func(*livekit.TrackInfo)
|
||||
updateTrackInfoMutex sync.RWMutex
|
||||
updateTrackInfoArgsForCall []struct {
|
||||
@@ -278,6 +283,11 @@ type FakeMediaTrack struct {
|
||||
updateVideoLayersArgsForCall []struct {
|
||||
arg1 []*livekit.VideoLayer
|
||||
}
|
||||
UpdateVideoTrackStub func(*livekit.UpdateLocalVideoTrack)
|
||||
updateVideoTrackMutex sync.RWMutex
|
||||
updateVideoTrackArgsForCall []struct {
|
||||
arg1 *livekit.UpdateLocalVideoTrack
|
||||
}
|
||||
invocations map[string][][]interface{}
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
@@ -1663,6 +1673,38 @@ func (fake *FakeMediaTrack) ToProtoReturnsOnCall(i int, result1 *livekit.TrackIn
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateAudioTrack(arg1 *livekit.UpdateLocalAudioTrack) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
fake.updateAudioTrackArgsForCall = append(fake.updateAudioTrackArgsForCall, struct {
|
||||
arg1 *livekit.UpdateLocalAudioTrack
|
||||
}{arg1})
|
||||
stub := fake.UpdateAudioTrackStub
|
||||
fake.recordInvocation("UpdateAudioTrack", []interface{}{arg1})
|
||||
fake.updateAudioTrackMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.UpdateAudioTrackStub(arg1)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateAudioTrackCallCount() int {
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
return len(fake.updateAudioTrackArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateAudioTrackCalls(stub func(*livekit.UpdateLocalAudioTrack)) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
defer fake.updateAudioTrackMutex.Unlock()
|
||||
fake.UpdateAudioTrackStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateAudioTrackArgsForCall(i int) *livekit.UpdateLocalAudioTrack {
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
argsForCall := fake.updateAudioTrackArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateTrackInfo(arg1 *livekit.TrackInfo) {
|
||||
fake.updateTrackInfoMutex.Lock()
|
||||
fake.updateTrackInfoArgsForCall = append(fake.updateTrackInfoArgsForCall, struct {
|
||||
@@ -1732,6 +1774,38 @@ func (fake *FakeMediaTrack) UpdateVideoLayersArgsForCall(i int) []*livekit.Video
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateVideoTrack(arg1 *livekit.UpdateLocalVideoTrack) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
fake.updateVideoTrackArgsForCall = append(fake.updateVideoTrackArgsForCall, struct {
|
||||
arg1 *livekit.UpdateLocalVideoTrack
|
||||
}{arg1})
|
||||
stub := fake.UpdateVideoTrackStub
|
||||
fake.recordInvocation("UpdateVideoTrack", []interface{}{arg1})
|
||||
fake.updateVideoTrackMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.UpdateVideoTrackStub(arg1)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateVideoTrackCallCount() int {
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
return len(fake.updateVideoTrackArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateVideoTrackCalls(stub func(*livekit.UpdateLocalVideoTrack)) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
defer fake.updateVideoTrackMutex.Unlock()
|
||||
fake.UpdateVideoTrackStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) UpdateVideoTrackArgsForCall(i int) *livekit.UpdateLocalVideoTrack {
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
argsForCall := fake.updateVideoTrackArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeMediaTrack) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
@@ -1789,10 +1863,14 @@ func (fake *FakeMediaTrack) Invocations() map[string][][]interface{} {
|
||||
defer fake.streamMutex.RUnlock()
|
||||
fake.toProtoMutex.RLock()
|
||||
defer fake.toProtoMutex.RUnlock()
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
fake.updateTrackInfoMutex.RLock()
|
||||
defer fake.updateTrackInfoMutex.RUnlock()
|
||||
fake.updateVideoLayersMutex.RLock()
|
||||
defer fake.updateVideoLayersMutex.RUnlock()
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
copiedInvocations := map[string][][]interface{}{}
|
||||
for key, value := range fake.invocations {
|
||||
copiedInvocations[key] = value
|
||||
|
||||
@@ -217,6 +217,17 @@ type FakeParticipant struct {
|
||||
toProtoReturnsOnCall map[int]struct {
|
||||
result1 *livekit.ParticipantInfo
|
||||
}
|
||||
UpdateAudioTrackStub func(*livekit.UpdateLocalAudioTrack) error
|
||||
updateAudioTrackMutex sync.RWMutex
|
||||
updateAudioTrackArgsForCall []struct {
|
||||
arg1 *livekit.UpdateLocalAudioTrack
|
||||
}
|
||||
updateAudioTrackReturns struct {
|
||||
result1 error
|
||||
}
|
||||
updateAudioTrackReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
UpdateSubscriptionPermissionStub func(*livekit.SubscriptionPermission, utils.TimedVersion, func(participantID livekit.ParticipantID) types.LocalParticipant) error
|
||||
updateSubscriptionPermissionMutex sync.RWMutex
|
||||
updateSubscriptionPermissionArgsForCall []struct {
|
||||
@@ -241,6 +252,17 @@ type FakeParticipant struct {
|
||||
updateVideoLayersReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
UpdateVideoTrackStub func(*livekit.UpdateLocalVideoTrack) error
|
||||
updateVideoTrackMutex sync.RWMutex
|
||||
updateVideoTrackArgsForCall []struct {
|
||||
arg1 *livekit.UpdateLocalVideoTrack
|
||||
}
|
||||
updateVideoTrackReturns struct {
|
||||
result1 error
|
||||
}
|
||||
updateVideoTrackReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
invocations map[string][][]interface{}
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
@@ -1330,6 +1352,67 @@ func (fake *FakeParticipant) ToProtoReturnsOnCall(i int, result1 *livekit.Partic
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateAudioTrack(arg1 *livekit.UpdateLocalAudioTrack) error {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
ret, specificReturn := fake.updateAudioTrackReturnsOnCall[len(fake.updateAudioTrackArgsForCall)]
|
||||
fake.updateAudioTrackArgsForCall = append(fake.updateAudioTrackArgsForCall, struct {
|
||||
arg1 *livekit.UpdateLocalAudioTrack
|
||||
}{arg1})
|
||||
stub := fake.UpdateAudioTrackStub
|
||||
fakeReturns := fake.updateAudioTrackReturns
|
||||
fake.recordInvocation("UpdateAudioTrack", []interface{}{arg1})
|
||||
fake.updateAudioTrackMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateAudioTrackCallCount() int {
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
return len(fake.updateAudioTrackArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateAudioTrackCalls(stub func(*livekit.UpdateLocalAudioTrack) error) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
defer fake.updateAudioTrackMutex.Unlock()
|
||||
fake.UpdateAudioTrackStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateAudioTrackArgsForCall(i int) *livekit.UpdateLocalAudioTrack {
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
argsForCall := fake.updateAudioTrackArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateAudioTrackReturns(result1 error) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
defer fake.updateAudioTrackMutex.Unlock()
|
||||
fake.UpdateAudioTrackStub = nil
|
||||
fake.updateAudioTrackReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateAudioTrackReturnsOnCall(i int, result1 error) {
|
||||
fake.updateAudioTrackMutex.Lock()
|
||||
defer fake.updateAudioTrackMutex.Unlock()
|
||||
fake.UpdateAudioTrackStub = nil
|
||||
if fake.updateAudioTrackReturnsOnCall == nil {
|
||||
fake.updateAudioTrackReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.updateAudioTrackReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateSubscriptionPermission(arg1 *livekit.SubscriptionPermission, arg2 utils.TimedVersion, arg3 func(participantID livekit.ParticipantID) types.LocalParticipant) error {
|
||||
fake.updateSubscriptionPermissionMutex.Lock()
|
||||
ret, specificReturn := fake.updateSubscriptionPermissionReturnsOnCall[len(fake.updateSubscriptionPermissionArgsForCall)]
|
||||
@@ -1454,6 +1537,67 @@ func (fake *FakeParticipant) UpdateVideoLayersReturnsOnCall(i int, result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateVideoTrack(arg1 *livekit.UpdateLocalVideoTrack) error {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
ret, specificReturn := fake.updateVideoTrackReturnsOnCall[len(fake.updateVideoTrackArgsForCall)]
|
||||
fake.updateVideoTrackArgsForCall = append(fake.updateVideoTrackArgsForCall, struct {
|
||||
arg1 *livekit.UpdateLocalVideoTrack
|
||||
}{arg1})
|
||||
stub := fake.UpdateVideoTrackStub
|
||||
fakeReturns := fake.updateVideoTrackReturns
|
||||
fake.recordInvocation("UpdateVideoTrack", []interface{}{arg1})
|
||||
fake.updateVideoTrackMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateVideoTrackCallCount() int {
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
return len(fake.updateVideoTrackArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateVideoTrackCalls(stub func(*livekit.UpdateLocalVideoTrack) error) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
defer fake.updateVideoTrackMutex.Unlock()
|
||||
fake.UpdateVideoTrackStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateVideoTrackArgsForCall(i int) *livekit.UpdateLocalVideoTrack {
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
argsForCall := fake.updateVideoTrackArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateVideoTrackReturns(result1 error) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
defer fake.updateVideoTrackMutex.Unlock()
|
||||
fake.UpdateVideoTrackStub = nil
|
||||
fake.updateVideoTrackReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) UpdateVideoTrackReturnsOnCall(i int, result1 error) {
|
||||
fake.updateVideoTrackMutex.Lock()
|
||||
defer fake.updateVideoTrackMutex.Unlock()
|
||||
fake.UpdateVideoTrackStub = nil
|
||||
if fake.updateVideoTrackReturnsOnCall == nil {
|
||||
fake.updateVideoTrackReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.updateVideoTrackReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
@@ -1499,10 +1643,14 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
|
||||
defer fake.subscriptionPermissionMutex.RUnlock()
|
||||
fake.toProtoMutex.RLock()
|
||||
defer fake.toProtoMutex.RUnlock()
|
||||
fake.updateAudioTrackMutex.RLock()
|
||||
defer fake.updateAudioTrackMutex.RUnlock()
|
||||
fake.updateSubscriptionPermissionMutex.RLock()
|
||||
defer fake.updateSubscriptionPermissionMutex.RUnlock()
|
||||
fake.updateVideoLayersMutex.RLock()
|
||||
defer fake.updateVideoLayersMutex.RUnlock()
|
||||
fake.updateVideoTrackMutex.RLock()
|
||||
defer fake.updateVideoTrackMutex.RUnlock()
|
||||
copiedInvocations := map[string][][]interface{}{}
|
||||
for key, value := range fake.invocations {
|
||||
copiedInvocations[key] = value
|
||||
|
||||
@@ -254,6 +254,36 @@ func (u *UpTrackManager) UpdateVideoLayers(updateVideoLayers *livekit.UpdateVide
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *UpTrackManager) UpdateAudioTrack(update *livekit.UpdateLocalAudioTrack) error {
|
||||
track := u.GetPublishedTrack(livekit.TrackID(update.TrackSid))
|
||||
if track == nil {
|
||||
u.params.Logger.Warnw("could not find track", nil, "trackID", livekit.TrackID(update.TrackSid))
|
||||
return errors.New("could not find published track")
|
||||
}
|
||||
|
||||
track.UpdateAudioTrack(update)
|
||||
if u.onTrackUpdated != nil {
|
||||
u.onTrackUpdated(track)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *UpTrackManager) UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack) error {
|
||||
track := u.GetPublishedTrack(livekit.TrackID(update.TrackSid))
|
||||
if track == nil {
|
||||
u.params.Logger.Warnw("could not find track", nil, "trackID", livekit.TrackID(update.TrackSid))
|
||||
return errors.New("could not find published track")
|
||||
}
|
||||
|
||||
track.UpdateVideoTrack(update)
|
||||
if u.onTrackUpdated != nil {
|
||||
u.onTrackUpdated(track)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *UpTrackManager) AddPublishedTrack(track types.MediaTrack) {
|
||||
u.lock.Lock()
|
||||
if _, ok := u.publishedTracks[track.ID()]; !ok {
|
||||
|
||||
Reference in new issue
Block a user