Files
livekit/pkg/rtc
Raja SubramanianandClaude Opus 5.5 6816ccdd9c fix: keep one subscription when first subscribes race (#4944)
* fix: keep one subscription when first subscribes race

SubscribeToTrack and SubscribeToDataTrack looked up the subscription,
then created one and stored it under a separate lock. Two concurrent
first subscribes, or a subscribe and a settings update, could each
store their own entry. The replaced entry could still add the down
track, which nothing owned after that, and the settings could land on
the replaced entry.

Find or create the subscription and set it as desired under one lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep early settings and a racing data track resubscribe

A settings or options update before the first subscribe creates an
entry that is not desired. Cleanup removed it on the next pass, so the
subscribe created a new entry without the settings. Keep such an entry
for notFoundTimeout.

After a data track unsubscribe, the entry was deleted even if a
subscribe set it as desired during the removal. Delete it only if it
is still not desired, else reconcile it again.

Cleanup deletes only the entry it checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 00:58:49 +05:30
..
2024-03-21 02:48:26 -07:00
2025-08-28 05:20:25 -07:00