Fix RTCP reader leak in DownTrack. (#4131)
When a participant is closing, RTCP readers should be cleaned up from factory even if the participant is expected to resume. The resumed participant will be a new participant session and peer connection(s) and everything will be set up again.
This commit is contained in:
@@ -287,10 +287,10 @@ func (t *MediaTrackSubscriptions) closeSubscribedTrack(subTrack types.Subscribed
|
||||
}
|
||||
|
||||
if isExpectedToResume {
|
||||
dt.CloseWithFlush(false)
|
||||
dt.CloseWithFlush(false, false)
|
||||
} else {
|
||||
// flushing blocks, avoid blocking when publisher removes all its subscribers
|
||||
go dt.CloseWithFlush(true)
|
||||
go dt.CloseWithFlush(true, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,12 +128,12 @@ func (m *SubscriptionManager) Close(isExpectedToResume bool) {
|
||||
|
||||
if isExpectedToResume {
|
||||
for _, dt := range downTracksToClose {
|
||||
dt.CloseWithFlush(false)
|
||||
dt.CloseWithFlush(false, true)
|
||||
}
|
||||
} else {
|
||||
// flush blocks, so execute in parallel
|
||||
for _, dt := range downTracksToClose {
|
||||
go dt.CloseWithFlush(true)
|
||||
go dt.CloseWithFlush(true, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user