1414 * limitations under the License.
1515 */
1616
17+ // / @file livekit_bridge.h
18+ // / @brief High-level bridge API for the LiveKit C++ SDK.
19+
1720#pragma once
1821
1922#include " livekit_bridge/bridge_audio_track.h"
@@ -266,8 +269,8 @@ class LiveKitBridge {
266269 friend class test ::CallbackKeyTest;
267270 friend class test ::LiveKitBridgeTest;
268271
269- // Composite key for the callback map: (participant_identity, source).
270- // Only one callback can exist per key -- re-registering overwrites.
272+ // / Composite key for the callback map: (participant_identity, source).
273+ // / Only one callback can exist per key -- re-registering overwrites.
271274 struct CallbackKey {
272275 std::string identity;
273276 livekit::TrackSource source;
@@ -279,33 +282,34 @@ class LiveKitBridge {
279282 std::size_t operator ()(const CallbackKey &k) const ;
280283 };
281284
282- // Active reader thread + stream for an incoming track
285+ // / Active reader thread + stream for an incoming track.
283286 struct ActiveReader {
284287 std::shared_ptr<livekit::AudioStream> audio_stream;
285288 std::shared_ptr<livekit::VideoStream> video_stream;
286289 std::thread thread;
287290 bool is_audio = false ;
288291 };
289292
290- // Called by BridgeRoomDelegate when a remote track is subscribed
293+ // / Called by BridgeRoomDelegate when a remote track is subscribed.
291294 void onTrackSubscribed (const std::string &participant_identity,
292295 livekit::TrackSource source,
293296 const std::shared_ptr<livekit::Track> &track);
294297
295- // Called by BridgeRoomDelegate when a remote track is unsubscribed
298+ // / Called by BridgeRoomDelegate when a remote track is unsubscribed.
296299 void onTrackUnsubscribed (const std::string &participant_identity,
297300 livekit::TrackSource source);
298301
299- // Close the stream and extract the thread for the caller to join
300- // (caller must hold mutex_)
302+ // / Extract the thread for the given callback key.
303+ // / @pre Caller must hold @c mutex_.
301304 std::thread extractReaderThread (const CallbackKey &key);
302305
303- // Start a reader thread for a subscribed track.
304- // Returns the old reader thread (if any) for the caller to join outside
305- // the lock. (caller must hold mutex_)
306+ // / Start a reader thread for a subscribed track.
307+ // / @return The reader thread for this track.
308+ // / @pre Caller must hold @c mutex_.
306309 std::thread startAudioReader (const CallbackKey &key,
307310 const std::shared_ptr<livekit::Track> &track,
308311 AudioFrameCallback cb);
312+ // / @copydoc startAudioReader
309313 std::thread startVideoReader (const CallbackKey &key,
310314 const std::shared_ptr<livekit::Track> &track,
311315 VideoFrameCallback cb);
@@ -320,20 +324,22 @@ class LiveKitBridge {
320324 std::unique_ptr<livekit::Room> room_;
321325 std::unique_ptr<BridgeRoomDelegate> delegate_;
322326
323- // Registered callbacks (may be registered before tracks are subscribed)
327+ // / Registered callbacks (may be registered before tracks are subscribed).
324328 std::unordered_map<CallbackKey, AudioFrameCallback, CallbackKeyHash>
325329 audio_callbacks_;
330+ // / @copydoc audio_callbacks_
326331 std::unordered_map<CallbackKey, VideoFrameCallback, CallbackKeyHash>
327332 video_callbacks_;
328333
329- // Active reader threads for subscribed tracks
334+ // / Active reader threads for subscribed tracks.
330335 std::unordered_map<CallbackKey, ActiveReader, CallbackKeyHash>
331336 active_readers_;
332337
333- // All tracks created by this bridge. The bridge retains a shared_ptr so
334- // it can force-release every track on disconnect() before the room is
335- // destroyed, preventing dangling participant_ pointers.
338+ // / All tracks created by this bridge. The bridge retains a shared_ptr so
339+ // / it can force-release every track on disconnect() before the room is
340+ // / destroyed, preventing dangling @c participant_ pointers.
336341 std::vector<std::shared_ptr<BridgeAudioTrack>> published_audio_tracks_;
342+ // / @copydoc published_audio_tracks_
337343 std::vector<std::shared_ptr<BridgeVideoTrack>> published_video_tracks_;
338344
339345};
0 commit comments