Minor clean up of media track & friends module (#1067)

This commit is contained in:
Raja Subramanian
2022-10-04 05:23:18 +05:30
committed by GitHub
parent 057b9a0d26
commit 30e5037418
6 changed files with 163 additions and 126 deletions
+4 -3
View File
@@ -67,7 +67,7 @@ func (u *UpTrackManager) Close(willBeResumed bool) {
// remove all subscribers
for _, t := range u.GetPublishedTracks() {
t.InitiateClose(willBeResumed)
t.ClearAllReceivers(willBeResumed)
}
if notify && u.onClose != nil {
@@ -328,9 +328,10 @@ func (u *UpTrackManager) AddPublishedTrack(track types.MediaTrack) {
}
func (u *UpTrackManager) RemovePublishedTrack(track types.MediaTrack, willBeResumed bool, shouldClose bool) {
track.InitiateClose(willBeResumed)
if shouldClose {
track.Close()
track.Close(willBeResumed)
} else {
track.ClearAllReceivers(willBeResumed)
}
u.lock.Lock()
delete(u.publishedTracks, track.ID())