20#include "livekit/data_stream.h"
21#include "livekit/e2ee.h"
22#include "livekit/ffi_handle.h"
23#include "livekit/room_event_types.h"
24#include "livekit/subscription_thread_dispatcher.h"
40class LocalParticipant;
41class RemoteParticipant;
52 std::string credential;
58 int ice_transport_type = 0;
62 int continual_gathering_policy = 0;
65 std::vector<IceServer> ice_servers;
74 bool auto_subscribe =
true;
77 bool dynacast =
false;
82 bool single_peer_connection =
true;
85 std::optional<RtcConfig> rtc_config;
88 std::optional<E2EEOptions> encryption;
134 bool Connect(
const std::string &url,
const std::string &token,
194 void registerTextStreamHandler(
const std::string &topic,
195 TextStreamHandler handler);
201 void unregisterTextStreamHandler(
const std::string &topic);
220 void registerByteStreamHandler(
const std::string &topic,
221 ByteStreamHandler handler);
227 void unregisterByteStreamHandler(
const std::string &topic);
247 TrackSource source, AudioFrameCallback callback,
254 const std::string &track_name,
255 AudioFrameCallback callback,
262 TrackSource source, VideoFrameCallback callback,
269 const std::string &track_name,
270 VideoFrameCallback callback,
278 const std::string &track_name,
279 VideoFrameEventCallback callback,
291 const std::string &track_name);
303 const std::string &track_name);
310 const std::string &track_name,
311 DataFrameCallback callback);
319 friend class RoomCallbackTest;
321 mutable std::mutex lock_;
322 ConnectionState connection_state_ = ConnectionState::Disconnected;
325 std::shared_ptr<FfiHandle> room_handle_;
326 std::unique_ptr<LocalParticipant> local_participant_;
327 std::unordered_map<std::string, std::shared_ptr<RemoteParticipant>>
328 remote_participants_;
330 std::unordered_map<std::string, TextStreamHandler> text_stream_handlers_;
331 std::unordered_map<std::string, ByteStreamHandler> byte_stream_handlers_;
332 std::unordered_map<std::string, std::shared_ptr<TextStreamReader>>
333 text_stream_readers_;
334 std::unordered_map<std::string, std::shared_ptr<ByteStreamReader>>
335 byte_stream_readers_;
337 std::unique_ptr<E2EEManager> e2ee_manager_;
338 std::shared_ptr<SubscriptionThreadDispatcher> subscription_thread_dispatcher_;
343 void OnEvent(
const proto::FfiEvent &event);
Definition local_participant.h:57
Definition remote_participant.h:29
Definition room_delegate.h:34
void setOnVideoFrameEventCallback(const std::string &participant_identity, const std::string &track_name, VideoFrameEventCallback callback, const VideoStream::Options &opts={})
Sets the video frame event callback via SubscriptionThreadDispatcher.
void clearOnAudioFrameCallback(const std::string &participant_identity, TrackSource source)
Clears the audio frame callback via SubscriptionThreadDispatcher.
void setOnAudioFrameCallback(const std::string &participant_identity, TrackSource source, AudioFrameCallback callback, const AudioStream::Options &opts={})
Sets the audio frame callback via SubscriptionThreadDispatcher.
void setOnVideoFrameCallback(const std::string &participant_identity, TrackSource source, VideoFrameCallback callback, const VideoStream::Options &opts={})
Sets the video frame callback via SubscriptionThreadDispatcher.
void clearOnVideoFrameCallback(const std::string &participant_identity, TrackSource source)
Clears the video frame callback via SubscriptionThreadDispatcher.
void removeOnDataFrameCallback(DataFrameCallbackId id)
Removes the data frame callback via SubscriptionThreadDispatcher.
void setOnVideoFrameCallback(const std::string &participant_identity, const std::string &track_name, VideoFrameCallback callback, const VideoStream::Options &opts={})
Sets the video frame callback via SubscriptionThreadDispatcher.
std::vector< std::shared_ptr< RemoteParticipant > > remoteParticipants() const
Returns a snapshot of all current remote participants.
void clearOnVideoFrameCallback(const std::string &participant_identity, const std::string &track_name)
Clears the video frame callback via SubscriptionThreadDispatcher.
void setOnAudioFrameCallback(const std::string &participant_identity, const std::string &track_name, AudioFrameCallback callback, const AudioStream::Options &opts={})
Sets the audio frame callback via SubscriptionThreadDispatcher.
DataFrameCallbackId addOnDataFrameCallback(const std::string &participant_identity, const std::string &track_name, DataFrameCallback callback)
Adds a data frame callback via SubscriptionThreadDispatcher.
void clearOnAudioFrameCallback(const std::string &participant_identity, const std::string &track_name)
Clears the audio frame callback via SubscriptionThreadDispatcher.
E2EEManager * e2eeManager() const
Configuration options for AudioStream creation.
Definition audio_stream.h:67
Definition room_event_types.h:141
Definition video_stream.h:68