Use a queue for add/remove subscribe operations. (#797)

* Use a queue for add/remove subscribe operations.

If subscribe/unsubscribe happens very quickly, the subscription
state gets mixed up as things are keyed off of subscriberID.

Use a queue of subscribe operations and process it serially.

* set up callback for down track added

* move the queue on unexpected type

* move the queue if removeSubscirber does not have a subscribed track
This commit is contained in:
Raja Subramanian
2022-07-02 10:52:55 +05:30
committed by GitHub
parent 856cc1798f
commit 03b0a01aad
3 changed files with 162 additions and 49 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ func (u *UpTrackManager) AddSubscriber(sub types.LocalParticipant, params types.
for _, track := range tracks {
trackIDs = append(trackIDs, track.ID())
}
u.params.Logger.Debugw("subscribing new participant to tracks",
u.params.Logger.Debugw("subscribing participant to tracks",
"subscriber", sub.Identity(),
"subscriberID", sub.ID(),
"trackIDs", trackIDs)