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