Perform unsubscribe in parallel to avoid blocking (#1760)
* Perform unsubscribe in parallel to avoid blocking When unsubscribing from tracks, we flush a blank frame in order to prepare the transceivers for re-use. This process is blocking for ~200ms. If the unsubscribes are performed serially, it would prevent other subscribe operation from continuing. This PR parallelizes that operation, and ensures subsequent subscribe operations could reuse the existing transceivers. * also perform in parallel when uptrack close * fix a few log fields
This commit is contained in:
@@ -98,9 +98,7 @@ func (r *RedPrimaryReceiver) CanClose() bool {
|
||||
|
||||
func (r *RedPrimaryReceiver) Close() {
|
||||
r.closed.Store(true)
|
||||
for _, dt := range r.downTrackSpreader.ResetAndGetDownTracks() {
|
||||
dt.Close()
|
||||
}
|
||||
closeTrackSenders(r.downTrackSpreader.ResetAndGetDownTracks())
|
||||
}
|
||||
|
||||
func (r *RedPrimaryReceiver) ReadRTP(buf []byte, layer uint8, sn uint16) (int, error) {
|
||||
|
||||
Reference in New Issue
Block a user