Prevent subscribe renegotiation if tracks will be resumed. (#781)

This commit is contained in:
Raja Subramanian
2022-06-24 00:06:37 +05:30
committed by GitHub
parent 667ff4eba4
commit 20512151c6
8 changed files with 79 additions and 56 deletions
+3 -3
View File
@@ -56,7 +56,7 @@ func (u *UpTrackManager) Restart() {
}
}
func (u *UpTrackManager) Close() {
func (u *UpTrackManager) Close(willBeResumed bool) {
u.lock.Lock()
u.closed = true
notify := len(u.publishedTracks) == 0
@@ -64,7 +64,7 @@ func (u *UpTrackManager) Close() {
// remove all subscribers
for _, t := range u.GetPublishedTracks() {
t.RemoveAllSubscribers()
t.RemoveAllSubscribers(willBeResumed)
}
if notify && u.onClose != nil {
@@ -297,7 +297,7 @@ func (u *UpTrackManager) AddPublishedTrack(track types.MediaTrack) {
}
func (u *UpTrackManager) RemovePublishedTrack(track types.MediaTrack) {
track.RemoveAllSubscribers()
track.RemoveAllSubscribers(false)
u.lock.Lock()
delete(u.publishedTracks, track.ID())
u.lock.Unlock()