mirror of
https://github.com/livekit/livekit.git
synced 2026-08-28 20:08:16 +00:00
RemoveSubscriber through pariticipant (#359)
This commit is contained in:
+2
-2
@@ -376,7 +376,7 @@ func (r *Room) UpdateSubscriptions(
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
publisher.RemoveSubscriber(participant, trackID)
|
||||
publisher.RemoveSubscriber(participant, trackID, false)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -397,7 +397,7 @@ func (r *Room) RemoveDisallowedSubscriptions(sub types.LocalParticipant, disallo
|
||||
continue
|
||||
}
|
||||
|
||||
pub.RemoveSubscriber(sub, trackID)
|
||||
pub.RemoveSubscriber(sub, trackID, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ type Participant interface {
|
||||
GetPublishedTracks() []MediaTrack
|
||||
|
||||
AddSubscriber(op LocalParticipant, params AddSubscriberParams) (int, error)
|
||||
RemoveSubscriber(op LocalParticipant, trackID livekit.TrackID)
|
||||
RemoveSubscriber(op LocalParticipant, trackID livekit.TrackID, resume bool)
|
||||
|
||||
// permissions
|
||||
Hidden() bool
|
||||
|
||||
@@ -342,11 +342,12 @@ type FakeLocalParticipant struct {
|
||||
removeSubscribedTrackArgsForCall []struct {
|
||||
arg1 types.SubscribedTrack
|
||||
}
|
||||
RemoveSubscriberStub func(types.LocalParticipant, livekit.TrackID)
|
||||
RemoveSubscriberStub func(types.LocalParticipant, livekit.TrackID, bool)
|
||||
removeSubscriberMutex sync.RWMutex
|
||||
removeSubscriberArgsForCall []struct {
|
||||
arg1 types.LocalParticipant
|
||||
arg2 livekit.TrackID
|
||||
arg3 bool
|
||||
}
|
||||
SendConnectionQualityUpdateStub func(*livekit.ConnectionQualityUpdate) error
|
||||
sendConnectionQualityUpdateMutex sync.RWMutex
|
||||
@@ -2363,17 +2364,18 @@ func (fake *FakeLocalParticipant) RemoveSubscribedTrackArgsForCall(i int) types.
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) RemoveSubscriber(arg1 types.LocalParticipant, arg2 livekit.TrackID) {
|
||||
func (fake *FakeLocalParticipant) RemoveSubscriber(arg1 types.LocalParticipant, arg2 livekit.TrackID, arg3 bool) {
|
||||
fake.removeSubscriberMutex.Lock()
|
||||
fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct {
|
||||
arg1 types.LocalParticipant
|
||||
arg2 livekit.TrackID
|
||||
}{arg1, arg2})
|
||||
arg3 bool
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.RemoveSubscriberStub
|
||||
fake.recordInvocation("RemoveSubscriber", []interface{}{arg1, arg2})
|
||||
fake.recordInvocation("RemoveSubscriber", []interface{}{arg1, arg2, arg3})
|
||||
fake.removeSubscriberMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.RemoveSubscriberStub(arg1, arg2)
|
||||
fake.RemoveSubscriberStub(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2383,17 +2385,17 @@ func (fake *FakeLocalParticipant) RemoveSubscriberCallCount() int {
|
||||
return len(fake.removeSubscriberArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) RemoveSubscriberCalls(stub func(types.LocalParticipant, livekit.TrackID)) {
|
||||
func (fake *FakeLocalParticipant) RemoveSubscriberCalls(stub func(types.LocalParticipant, livekit.TrackID, bool)) {
|
||||
fake.removeSubscriberMutex.Lock()
|
||||
defer fake.removeSubscriberMutex.Unlock()
|
||||
fake.RemoveSubscriberStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) RemoveSubscriberArgsForCall(i int) (types.LocalParticipant, livekit.TrackID) {
|
||||
func (fake *FakeLocalParticipant) RemoveSubscriberArgsForCall(i int) (types.LocalParticipant, livekit.TrackID, bool) {
|
||||
fake.removeSubscriberMutex.RLock()
|
||||
defer fake.removeSubscriberMutex.RUnlock()
|
||||
argsForCall := fake.removeSubscriberArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) SendConnectionQualityUpdate(arg1 *livekit.ConnectionQualityUpdate) error {
|
||||
|
||||
@@ -95,11 +95,12 @@ type FakeParticipant struct {
|
||||
identityReturnsOnCall map[int]struct {
|
||||
result1 livekit.ParticipantIdentity
|
||||
}
|
||||
RemoveSubscriberStub func(types.LocalParticipant, livekit.TrackID)
|
||||
RemoveSubscriberStub func(types.LocalParticipant, livekit.TrackID, bool)
|
||||
removeSubscriberMutex sync.RWMutex
|
||||
removeSubscriberArgsForCall []struct {
|
||||
arg1 types.LocalParticipant
|
||||
arg2 livekit.TrackID
|
||||
arg3 bool
|
||||
}
|
||||
SetMetadataStub func(string)
|
||||
setMetadataMutex sync.RWMutex
|
||||
@@ -635,17 +636,18 @@ func (fake *FakeParticipant) IdentityReturnsOnCall(i int, result1 livekit.Partic
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) RemoveSubscriber(arg1 types.LocalParticipant, arg2 livekit.TrackID) {
|
||||
func (fake *FakeParticipant) RemoveSubscriber(arg1 types.LocalParticipant, arg2 livekit.TrackID, arg3 bool) {
|
||||
fake.removeSubscriberMutex.Lock()
|
||||
fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct {
|
||||
arg1 types.LocalParticipant
|
||||
arg2 livekit.TrackID
|
||||
}{arg1, arg2})
|
||||
arg3 bool
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.RemoveSubscriberStub
|
||||
fake.recordInvocation("RemoveSubscriber", []interface{}{arg1, arg2})
|
||||
fake.recordInvocation("RemoveSubscriber", []interface{}{arg1, arg2, arg3})
|
||||
fake.removeSubscriberMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.RemoveSubscriberStub(arg1, arg2)
|
||||
fake.RemoveSubscriberStub(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,17 +657,17 @@ func (fake *FakeParticipant) RemoveSubscriberCallCount() int {
|
||||
return len(fake.removeSubscriberArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) RemoveSubscriberCalls(stub func(types.LocalParticipant, livekit.TrackID)) {
|
||||
func (fake *FakeParticipant) RemoveSubscriberCalls(stub func(types.LocalParticipant, livekit.TrackID, bool)) {
|
||||
fake.removeSubscriberMutex.Lock()
|
||||
defer fake.removeSubscriberMutex.Unlock()
|
||||
fake.RemoveSubscriberStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) RemoveSubscriberArgsForCall(i int) (types.LocalParticipant, livekit.TrackID) {
|
||||
func (fake *FakeParticipant) RemoveSubscriberArgsForCall(i int) (types.LocalParticipant, livekit.TrackID, bool) {
|
||||
fake.removeSubscriberMutex.RLock()
|
||||
defer fake.removeSubscriberMutex.RUnlock()
|
||||
argsForCall := fake.removeSubscriberArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) SetMetadata(arg1 string) {
|
||||
|
||||
@@ -128,10 +128,10 @@ func (u *UpTrackManager) AddSubscriber(sub types.LocalParticipant, params types.
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (u *UpTrackManager) RemoveSubscriber(sub types.LocalParticipant, trackID livekit.TrackID) {
|
||||
func (u *UpTrackManager) RemoveSubscriber(sub types.LocalParticipant, trackID livekit.TrackID, resume bool) {
|
||||
track := u.GetPublishedTrack(trackID)
|
||||
if track != nil {
|
||||
track.RemoveSubscriber(sub.ID(), false)
|
||||
track.RemoveSubscriber(sub.ID(), resume)
|
||||
}
|
||||
|
||||
u.lock.Lock()
|
||||
|
||||
Reference in New Issue
Block a user