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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user