Skip to content

Commit 2f313fe

Browse files
clearer commentS
1 parent e541387 commit 2f313fe

1 file changed

Lines changed: 25 additions & 17 deletions

File tree

include/livekit/subscription_thread_dispatcher.h

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@ using DataFrameCallbackId = std::uint64_t;
6767
///
6868
/// `SubscriptionThreadDispatcher` is the low-level companion to @ref Room's
6969
/// remote track subscription flow. `Room` forwards user-facing callback
70-
/// registration requests here, and then calls @ref handleTrackSubscribed and
71-
/// @ref handleTrackUnsubscribed as room events arrive.
70+
/// registration requests here. For remote audio and video subscriptions it
71+
/// calls @ref handleTrackSubscribed and @ref handleTrackUnsubscribed; for
72+
/// data tracks it calls @ref handleDataTrackPublished and
73+
/// @ref handleDataTrackUnpublished.
7274
///
73-
/// For each registered `(participant identity, track name)` pair, this class
74-
/// may create a dedicated @ref AudioStream or @ref VideoStream and a matching
75-
/// reader thread. That thread blocks on stream reads and invokes the
76-
/// registered callback with decoded frames.
75+
/// For each registered audio or video `(participant identity, track name)`
76+
/// pair, this class may create a dedicated @ref AudioStream or @ref
77+
/// VideoStream and a matching reader thread. That thread blocks on stream
78+
/// reads and invokes the registered callback with decoded frames.
7779
///
7880
/// This type is intentionally independent from @ref RoomDelegate. High-level
7981
/// room events such as `RoomDelegate::onTrackSubscribed()` remain in @ref Room,
@@ -153,27 +155,33 @@ class LIVEKIT_API SubscriptionThreadDispatcher {
153155
/// @param track_name Track name to clear.
154156
void clearOnVideoFrameCallback(const std::string& participant_identity, const std::string& track_name);
155157

156-
/// Start or restart reader dispatch for a newly subscribed remote track.
158+
/// Start or restart reader dispatch for a newly subscribed remote audio or
159+
/// video track.
157160
///
158161
/// @ref Room calls this after it has processed a track-subscription event and
159-
/// updated its publication state. If a matching callback registration exists,
160-
/// the dispatcher creates the appropriate stream type and launches a reader
161-
/// thread for the `(participant, track_name)` key.
162+
/// updated its publication state. If a matching audio or video callback
163+
/// registration exists, the dispatcher creates the appropriate @ref
164+
/// AudioStream or @ref VideoStream and launches a reader thread for the
165+
/// `(participant, track_name)` key.
162166
///
163-
/// If no matching callback is registered, this is a no-op.
167+
/// Remote data tracks are handled separately via @ref handleDataTrackPublished.
168+
/// If @p track is not audio or video, or no matching callback is registered,
169+
/// this is a no-op.
164170
///
165171
/// @param participant_identity Identity of the remote participant.
166172
/// @param track_name Track name associated with the subscription.
167-
/// @param track Subscribed remote track to read from.
173+
/// @param track Subscribed remote audio or video track to read from.
168174
void handleTrackSubscribed(const std::string& participant_identity, const std::string& track_name,
169175
const std::shared_ptr<Track>& track);
170176

171-
/// Stop reader dispatch for an unsubscribed remote track.
177+
/// Stop reader dispatch for an unsubscribed remote audio or video track.
172178
///
173-
/// @ref Room calls this when a remote track is unsubscribed. Any active
174-
/// reader stream for the given `(participant, track_name)` key is closed and its
175-
/// thread is joined. Callback registration is preserved so future
176-
/// re-subscription can start dispatch again automatically.
179+
/// @ref Room calls this when a remote audio or video track is unsubscribed.
180+
/// Any active reader stream for the given `(participant, track_name)` key is
181+
/// closed and its thread is joined. Callback registration is preserved so
182+
/// future re-subscription can start dispatch again automatically.
183+
///
184+
/// Remote data tracks are handled separately via @ref handleDataTrackUnpublished.
177185
///
178186
/// @param participant_identity Identity of the remote participant.
179187
/// @param source Track source associated with the subscription.

0 commit comments

Comments
 (0)