Participant method to check a track by name is subscribed. (#3192)
* Set down track connected flag in one-shot-signalling mode. Also, added maintaing ICE candidates for info purposes. And doing analytics events (have to maintain the subscription inside subscriptionmanager to get list of subscribed tracks, so added enough bits from the async path into sync path to get the analytics bits also) * comment typo * method to check if a track name is subscribed
This commit is contained in:
@@ -195,6 +195,19 @@ func (m *SubscriptionManager) GetSubscribedTracks() []types.SubscribedTrack {
|
||||
return tracks
|
||||
}
|
||||
|
||||
func (m *SubscriptionManager) IsTrackNameSubscribed(publisherIdentity livekit.ParticipantIdentity, trackName string) bool {
|
||||
m.lock.RLock()
|
||||
defer m.lock.RUnlock()
|
||||
|
||||
for _, s := range m.subscriptions {
|
||||
st := s.getSubscribedTrack()
|
||||
if st != nil && st.PublisherIdentity() == publisherIdentity && st.MediaTrack() != nil && st.MediaTrack().Name() == trackName {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *SubscriptionManager) StopAndGetSubscribedTracksForwarderState() map[livekit.TrackID]*livekit.RTPForwarderState {
|
||||
m.lock.RLock()
|
||||
defer m.lock.RUnlock()
|
||||
|
||||
@@ -381,6 +381,7 @@ type LocalParticipant interface {
|
||||
UnsubscribeFromTrack(trackID livekit.TrackID)
|
||||
UpdateSubscribedTrackSettings(trackID livekit.TrackID, settings *livekit.UpdateTrackSettings)
|
||||
GetSubscribedTracks() []SubscribedTrack
|
||||
IsTrackNameSubscribed(publisherIdentity livekit.ParticipantIdentity, trackName string) bool
|
||||
Verify() bool
|
||||
VerifySubscribeParticipantInfo(pID livekit.ParticipantID, version uint32)
|
||||
// WaitUntilSubscribed waits until all subscriptions have been settled, or if the timeout
|
||||
|
||||
@@ -628,6 +628,18 @@ type FakeLocalParticipant struct {
|
||||
isSubscribedToReturnsOnCall map[int]struct {
|
||||
result1 bool
|
||||
}
|
||||
IsTrackNameSubscribedStub func(livekit.ParticipantIdentity, string) bool
|
||||
isTrackNameSubscribedMutex sync.RWMutex
|
||||
isTrackNameSubscribedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantIdentity
|
||||
arg2 string
|
||||
}
|
||||
isTrackNameSubscribedReturns struct {
|
||||
result1 bool
|
||||
}
|
||||
isTrackNameSubscribedReturnsOnCall map[int]struct {
|
||||
result1 bool
|
||||
}
|
||||
IssueFullReconnectStub func(types.ParticipantCloseReason)
|
||||
issueFullReconnectMutex sync.RWMutex
|
||||
issueFullReconnectArgsForCall []struct {
|
||||
@@ -4363,6 +4375,68 @@ func (fake *FakeLocalParticipant) IsSubscribedToReturnsOnCall(i int, result1 boo
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) IsTrackNameSubscribed(arg1 livekit.ParticipantIdentity, arg2 string) bool {
|
||||
fake.isTrackNameSubscribedMutex.Lock()
|
||||
ret, specificReturn := fake.isTrackNameSubscribedReturnsOnCall[len(fake.isTrackNameSubscribedArgsForCall)]
|
||||
fake.isTrackNameSubscribedArgsForCall = append(fake.isTrackNameSubscribedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantIdentity
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.IsTrackNameSubscribedStub
|
||||
fakeReturns := fake.isTrackNameSubscribedReturns
|
||||
fake.recordInvocation("IsTrackNameSubscribed", []interface{}{arg1, arg2})
|
||||
fake.isTrackNameSubscribedMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) IsTrackNameSubscribedCallCount() int {
|
||||
fake.isTrackNameSubscribedMutex.RLock()
|
||||
defer fake.isTrackNameSubscribedMutex.RUnlock()
|
||||
return len(fake.isTrackNameSubscribedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) IsTrackNameSubscribedCalls(stub func(livekit.ParticipantIdentity, string) bool) {
|
||||
fake.isTrackNameSubscribedMutex.Lock()
|
||||
defer fake.isTrackNameSubscribedMutex.Unlock()
|
||||
fake.IsTrackNameSubscribedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) IsTrackNameSubscribedArgsForCall(i int) (livekit.ParticipantIdentity, string) {
|
||||
fake.isTrackNameSubscribedMutex.RLock()
|
||||
defer fake.isTrackNameSubscribedMutex.RUnlock()
|
||||
argsForCall := fake.isTrackNameSubscribedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) IsTrackNameSubscribedReturns(result1 bool) {
|
||||
fake.isTrackNameSubscribedMutex.Lock()
|
||||
defer fake.isTrackNameSubscribedMutex.Unlock()
|
||||
fake.IsTrackNameSubscribedStub = nil
|
||||
fake.isTrackNameSubscribedReturns = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) IsTrackNameSubscribedReturnsOnCall(i int, result1 bool) {
|
||||
fake.isTrackNameSubscribedMutex.Lock()
|
||||
defer fake.isTrackNameSubscribedMutex.Unlock()
|
||||
fake.IsTrackNameSubscribedStub = nil
|
||||
if fake.isTrackNameSubscribedReturnsOnCall == nil {
|
||||
fake.isTrackNameSubscribedReturnsOnCall = make(map[int]struct {
|
||||
result1 bool
|
||||
})
|
||||
}
|
||||
fake.isTrackNameSubscribedReturnsOnCall[i] = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) IssueFullReconnect(arg1 types.ParticipantCloseReason) {
|
||||
fake.issueFullReconnectMutex.Lock()
|
||||
fake.issueFullReconnectArgsForCall = append(fake.issueFullReconnectArgsForCall, struct {
|
||||
@@ -7501,6 +7575,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} {
|
||||
defer fake.isRecorderMutex.RUnlock()
|
||||
fake.isSubscribedToMutex.RLock()
|
||||
defer fake.isSubscribedToMutex.RUnlock()
|
||||
fake.isTrackNameSubscribedMutex.RLock()
|
||||
defer fake.isTrackNameSubscribedMutex.RUnlock()
|
||||
fake.issueFullReconnectMutex.RLock()
|
||||
defer fake.issueFullReconnectMutex.RUnlock()
|
||||
fake.kindMutex.RLock()
|
||||
|
||||
Reference in New Issue
Block a user