22#include <unordered_map>
26#include "livekit/visibility.h"
35class ReceivedRtpStreamStats;
36class InboundRtpStreamStats;
37class SentRtpStreamStats;
38class OutboundRtpStreamStats;
39class RemoteInboundRtpStreamStats;
40class RemoteOutboundRtpStreamStats;
41class MediaSourceStats;
42class AudioSourceStats;
43class VideoSourceStats;
44class AudioPlayoutStats;
45class PeerConnectionStats;
46class DataChannelStats;
48class CandidatePairStats;
49class IceCandidateStats;
50class CertificateStats;
149 std::int64_t timestamp_ms;
154 std::uint32_t payload_type;
155 std::string transport_id;
156 std::string mime_type;
157 std::uint32_t clock_rate;
158 std::uint32_t channels;
159 std::string sdp_fmtp_line;
166 std::string transport_id;
167 std::string codec_id;
172 std::uint64_t packets_received;
173 std::int64_t packets_lost;
179 std::string track_identifier;
181 std::string remote_id;
182 std::uint32_t frames_decoded;
183 std::uint32_t key_frames_decoded;
184 std::uint32_t frames_rendered;
185 std::uint32_t frames_dropped;
186 std::uint32_t frame_width;
187 std::uint32_t frame_height;
188 double frames_per_second;
189 std::uint64_t qp_sum;
190 double total_decode_time;
191 double total_inter_frame_delay;
192 double total_squared_inter_frame_delay;
193 std::uint32_t pause_count;
194 double total_pause_duration;
195 std::uint32_t freeze_count;
196 double total_freeze_duration;
197 double last_packet_received_timestamp;
198 std::uint64_t header_bytes_received;
199 std::uint64_t packets_discarded;
200 std::uint64_t fec_bytes_received;
201 std::uint64_t fec_packets_received;
202 std::uint64_t fec_packets_discarded;
203 std::uint64_t bytes_received;
204 std::uint32_t nack_count;
205 std::uint32_t fir_count;
206 std::uint32_t pli_count;
207 double total_processing_delay;
208 double estimated_playout_timestamp;
209 double jitter_buffer_delay;
210 double jitter_buffer_target_delay;
211 std::uint64_t jitter_buffer_emitted_count;
212 double jitter_buffer_minimum_delay;
213 std::uint64_t total_samples_received;
214 std::uint64_t concealed_samples;
215 std::uint64_t silent_concealed_samples;
216 std::uint64_t concealment_events;
217 std::uint64_t inserted_samples_for_deceleration;
218 std::uint64_t removed_samples_for_acceleration;
220 double total_audio_energy;
221 double total_samples_duration;
222 std::uint64_t frames_received;
223 std::string decoder_implementation;
224 std::string playout_id;
225 bool power_efficient_decoder;
226 std::uint64_t frames_assembled_from_multiple_packets;
227 double total_assembly_time;
228 std::uint64_t retransmitted_packets_received;
229 std::uint64_t retransmitted_bytes_received;
230 std::uint32_t rtx_ssrc;
231 std::uint32_t fec_ssrc;
236 std::uint64_t packets_sent;
237 std::uint64_t bytes_sent;
243 std::string media_source_id;
244 std::string remote_id;
246 std::uint64_t header_bytes_sent;
247 std::uint64_t retransmitted_packets_sent;
248 std::uint64_t retransmitted_bytes_sent;
249 std::uint32_t rtx_ssrc;
250 double target_bitrate;
251 std::uint64_t total_encoded_bytes_target;
252 std::uint32_t frame_width;
253 std::uint32_t frame_height;
254 double frames_per_second;
255 std::uint32_t frames_sent;
256 std::uint32_t huge_frames_sent;
257 std::uint32_t frames_encoded;
258 std::uint32_t key_frames_encoded;
259 std::uint64_t qp_sum;
260 double total_encode_time;
261 double total_packet_send_delay;
263 std::unordered_map<std::string, double> quality_limitation_durations;
264 std::uint32_t quality_limitation_resolution_changes;
265 std::uint32_t nack_count;
266 std::uint32_t fir_count;
267 std::uint32_t pli_count;
268 std::string encoder_implementation;
269 bool power_efficient_encoder;
271 std::string scalability_mode;
276 std::string local_id;
277 double round_trip_time;
278 double total_round_trip_time;
279 double fraction_lost;
280 std::uint64_t round_trip_time_measurements;
285 std::string local_id;
286 double remote_timestamp;
287 std::uint64_t reports_sent;
288 double round_trip_time;
289 double total_round_trip_time;
290 std::uint64_t round_trip_time_measurements;
295 std::string track_identifier;
302 double total_audio_energy;
303 double total_samples_duration;
304 double echo_return_loss;
305 double echo_return_loss_enhancement;
306 double dropped_samples_duration;
307 std::uint32_t dropped_samples_events;
308 double total_capture_delay;
309 std::uint64_t total_samples_captured;
315 std::uint32_t height;
316 std::uint32_t frames;
317 double frames_per_second;
337 std::uint32_t data_channels_opened;
338 std::uint32_t data_channels_closed;
344 std::string protocol;
345 std::int32_t data_channel_identifier;
346 std::optional<DataChannelState> state;
347 std::uint32_t messages_sent;
348 std::uint64_t bytes_sent;
349 std::uint32_t messages_received;
350 std::uint64_t bytes_received;
355 std::uint64_t packets_sent;
356 std::uint64_t packets_received;
357 std::uint64_t bytes_sent;
358 std::uint64_t bytes_received;
360 std::string ice_local_username_fragment;
361 std::optional<DtlsTransportState> dtls_state;
362 std::optional<IceTransportState> ice_state;
363 std::string selected_candidate_pair_id;
364 std::string local_certificate_id;
365 std::string remote_certificate_id;
366 std::string tls_version;
367 std::string dtls_cipher;
369 std::string srtp_cipher;
370 std::uint32_t selected_candidate_pair_changes;
375 std::string transport_id;
376 std::string local_candidate_id;
377 std::string remote_candidate_id;
378 std::optional<IceCandidatePairState> state;
380 std::uint64_t packets_sent;
381 std::uint64_t packets_received;
382 std::uint64_t bytes_sent;
383 std::uint64_t bytes_received;
384 double last_packet_sent_timestamp;
385 double last_packet_received_timestamp;
386 double total_round_trip_time;
387 double current_round_trip_time;
388 double available_outgoing_bitrate;
389 double available_incoming_bitrate;
390 std::uint64_t requests_received;
391 std::uint64_t requests_sent;
392 std::uint64_t responses_received;
393 std::uint64_t responses_sent;
394 std::uint64_t consent_requests_sent;
395 std::uint32_t packets_discarded_on_send;
396 std::uint64_t bytes_discarded_on_send;
401 std::string transport_id;
404 std::string protocol;
405 std::optional<IceCandidateType> candidate_type;
406 std::int32_t priority;
408 std::optional<IceServerTransportProtocol> relay_protocol;
409 std::string foundation;
410 std::string related_address;
411 std::int32_t related_port;
412 std::string username_fragment;
413 std::optional<IceTcpCandidateType> tcp_type;
418 std::string fingerprint;
419 std::string fingerprint_algorithm;
420 std::string base64_certificate;
421 std::string issuer_certificate_id;
427 std::string stream_identifier;
536using RtcStatsVariant =
544 RtcStatsVariant stats;
559LIVEKIT_API
RtcStatsData fromProto(
const proto::RtcStatsData&);
561LIVEKIT_API
CodecStats fromProto(
const proto::CodecStats&);
562LIVEKIT_API
RtpStreamStats fromProto(
const proto::RtpStreamStats&);
575LIVEKIT_API
TransportStats fromProto(
const proto::TransportStats&);
579LIVEKIT_API
StreamStats fromProto(
const proto::StreamStats&);
582LIVEKIT_API
RtcStats fromProto(
const proto::RtcStats&);
585LIVEKIT_API std::vector<RtcStats> fromProto(
const std::vector<proto::RtcStats>&);
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25
IceCandidatePairState
State of an ICE candidate pair.
Definition stats.h:108
DtlsTransportState
DTLS transport state.
Definition stats.h:79
DtlsRole
DTLS role used by a transport.
Definition stats.h:101
IceRole
ICE role used by a transport.
Definition stats.h:72
IceTcpCandidateType
TCP candidate type for an ICE candidate.
Definition stats.h:135
QualityLimitationReason
Reason outbound media quality is currently limited.
Definition stats.h:64
DataChannelState
State of a WebRTC data channel.
Definition stats.h:55
IceTransportState
ICE transport state.
Definition stats.h:89
IceServerTransportProtocol
Transport protocol used by an ICE server.
Definition stats.h:127
IceCandidateType
Type of ICE candidate.
Definition stats.h:118
Statistics for audio playout performance.
Definition stats.h:324
std::string kind
The type of media ("audio").
Definition stats.h:325
double total_playout_delay
Cumulative playout delay in seconds.
Definition stats.h:331
double synthesized_samples_duration
Duration of synthesized samples in seconds.
Definition stats.h:326
std::uint32_t synthesized_samples_events
Number of synthesis events (e.g., concealment).
Definition stats.h:328
std::uint64_t total_samples_count
Total number of samples played out.
Definition stats.h:332
double total_samples_duration
Total duration of all samples in seconds.
Definition stats.h:330
Statistics for a local audio source.
Definition stats.h:300
Statistics for a selected or candidate ICE pair.
Definition stats.h:374
Statistics for a DTLS certificate.
Definition stats.h:417
Codec statistics for an RTP stream.
Definition stats.h:153
Statistics for a WebRTC data channel.
Definition stats.h:342
Statistics for a local or remote ICE candidate.
Definition stats.h:400
Statistics for inbound RTP media.
Definition stats.h:178
Statistics for outbound RTP media.
Definition stats.h:241
Statistics for a peer connection.
Definition stats.h:336
Statistics for received RTP streams.
Definition stats.h:171
Statistics reported by a remote receiver for a local outbound RTP stream.
Definition stats.h:275
Statistics reported by a remote sender for a local inbound RTP stream.
Definition stats.h:284
Typed RTC stats wrapper for ICE candidate pair statistics.
Definition stats.h:505
Typed RTC stats wrapper for certificate statistics.
Definition stats.h:523
Typed RTC stats wrapper for codec statistics.
Definition stats.h:435
Typed RTC stats wrapper for data channel statistics.
Definition stats.h:493
Typed RTC stats wrapper for inbound RTP statistics.
Definition stats.h:441
Typed RTC stats wrapper for local ICE candidate statistics.
Definition stats.h:511
Typed RTC stats wrapper for outbound RTP statistics.
Definition stats.h:449
Typed RTC stats wrapper for peer connection statistics.
Definition stats.h:487
Typed RTC stats wrapper for remote ICE candidate statistics.
Definition stats.h:517
Typed RTC stats wrapper for remote inbound RTP statistics.
Definition stats.h:457
Typed RTC stats wrapper for remote outbound RTP statistics.
Definition stats.h:465
Base data shared by RTC stats records.
Definition stats.h:147
Variant wrapper for typed RTC stats records.
Definition stats.h:543
Typed RTC stats wrapper for media stream statistics.
Definition stats.h:529
Typed RTC stats wrapper for transport statistics.
Definition stats.h:499
Base statistics for an RTP stream.
Definition stats.h:163
Statistics for sent RTP streams.
Definition stats.h:235
Aggregated WebRTC stats for a connected room session.
Definition stats.h:548
std::vector< RtcStats > publisher_stats
Stats from the publisher peer connection (outbound media).
Definition stats.h:550
std::vector< RtcStats > subscriber_stats
Stats from the subscriber peer connection (inbound media).
Definition stats.h:552
Statistics for a media stream.
Definition stats.h:425
Statistics for a WebRTC transport.
Definition stats.h:354
Statistics for a local video source.
Definition stats.h:313