Add a flag to signal need to close underlying media track. (#1038)

With migration in, once the local track is published, the
remote track should be closed. Add a flag to `RemovePublishedTrack`
to control the close behaviour. Invoke `Close` if specified.

Without, the remote track is not closed if it is waiting to resolve,
i. e. not yet attached. That remote track is left hanging.
This commit is contained in:
Raja Subramanian
2022-09-26 15:32:22 +05:30
committed by GitHub
parent 572dd43329
commit dfc71d5bf8
7 changed files with 88 additions and 19 deletions
+4 -1
View File
@@ -327,8 +327,11 @@ func (u *UpTrackManager) AddPublishedTrack(track types.MediaTrack) {
})
}
func (u *UpTrackManager) RemovePublishedTrack(track types.MediaTrack, willBeResumed bool) {
func (u *UpTrackManager) RemovePublishedTrack(track types.MediaTrack, willBeResumed bool, shouldClose bool) {
track.InitiateClose(willBeResumed)
if shouldClose {
track.Close()
}
u.lock.Lock()
delete(u.publishedTracks, track.ID())
u.lock.Unlock()