mirror of
https://github.com/livekit/livekit.git
synced 2026-04-08 01:05:40 +00:00
The following sequence caused early migration complete declaration 1. Audio track received 2. Audio track published callback in progress 3. Video track received, this clears the pending track 4. Audio track published callback finishes. This checks for pending tracks. As nothing is pending migration complete declared. 5. Due to the above, the remote video track is closed as not resuming. That causes an unsubscription. Fix - Wait till publish callback to finish to remove a track from pending fully. - Introducing a new map as pending tracks is used in OnClose too. So, did not want to delay removing from it as a close could happen while publish callback is happening. Also, moving the publish callback to a go routine (just like the recent change for running those in a go routine for migrated muted tracks)