1#ifndef MILLICAST_API_STATS_H
2#define MILLICAST_API_STATS_H
58 return static_cast<const T*
>(
this);
106 std::optional<std::string>
mid;
238 std::map<std::string, StatObject>::const_iterator _it;
254 return _it == other._it;
257 return !(*
this == other);
266 const std::string&
id)
const = 0;
267 template <
typename T>
268 const T*
get_as(
const std::string&
id)
const {
270 if (!stats || stats->
type != T::STYPE) {
274 return stats->
cast_to<
const T>();
280 template <
typename T>
282 std::vector<const T*> stats_of_type;
283 for (
const auto& stats : *
this) {
284 if (stats.type == T::STYPE) {
285 stats_of_type.push_back(stats.cast_to<
const T>());
288 return stats_of_type;
300 [[nodiscard]]
virtual size_t size()
const = 0;
const_iterator(std::map< std::string, StatObject >::const_iterator it)
Definition stats.h:241
const_iterator(const_iterator &&other)=default
const_iterator & operator++(int)
Definition stats.h:250
const rtcstats::Stats & operator*() const
Definition stats.h:251
const rtcstats::Stats * operator->() const
Definition stats.h:252
bool operator!=(const const_iterator &other) const
Definition stats.h:256
const_iterator & operator++()
Definition stats.h:246
bool operator==(const const_iterator &other) const
Definition stats.h:253
~const_iterator()=default
virtual ~StatsReport()=default
const T * get_as(const std::string &id) const
Definition stats.h:268
virtual const rtcstats::Stats * get(const std::string &id) const =0
std::vector< const T * > get_stats_of_type() const
Definition stats.h:281
virtual const_iterator end() const =0
virtual StreamDetails stream_details() const =0
Get the current stream details associated with this session.
virtual const_iterator begin() const =0
virtual void add_stats(StatObject stats)=0
virtual size_t size() const =0
virtual StatObject take(const std::string &id)=0
#define MILLICAST_API
Definition exports.h:51
Type
Definition stats.h:23
Definition capabilities.h:15
std::variant< StreamViewDetails, StreamPublishDetails > StreamDetails
Definition diagnostics.h:33
std::unique_ptr< const rtcstats::Stats > StatObject
Definition stats.h:233
static constexpr auto STYPE
Definition stats.h:224
std::optional< double > echo_return_loss_enhancement
Definition stats.h:229
std::optional< double > total_samples_duration
Definition stats.h:227
std::optional< double > total_audio_energy
Definition stats.h:226
std::optional< double > echo_return_loss
Definition stats.h:228
std::optional< double > audio_level
Definition stats.h:225
std::string transport_id
Definition stats.h:69
std::string mime_type
Definition stats.h:70
std::optional< unsigned long > clock_rate
Definition stats.h:73
std::optional< unsigned long > channels
Definition stats.h:74
static constexpr auto STYPE
Definition stats.h:66
std::optional< Type > codec_type
Definition stats.h:72
std::optional< std::string > sdp_fmtp_line
Definition stats.h:75
unsigned long payload_type
Definition stats.h:68
Type
Definition stats.h:65
std::optional< unsigned long long > fir_count
Definition stats.h:111
std::optional< double > total_pauses_duration
Definition stats.h:150
std::optional< unsigned long long > frames_assembled_from_multiple_packets
Definition stats.h:130
std::optional< uint64_t > estimated_playout_timestamp
Definition stats.h:153
std::optional< double > total_freezes_duration
Definition stats.h:147
std::optional< unsigned long long > retransmitted_packets_received
Definition stats.h:134
std::optional< unsigned long long > last_packet_received_timestamp
Definition stats.h:119
std::optional< unsigned long long > concealment_events
Definition stats.h:127
std::optional< double > total_samples_duration
Definition stats.h:131
std::optional< double > total_assembly_time
Definition stats.h:142
std::optional< unsigned long > frames_received
Definition stats.h:113
std::optional< std::string > decoder_implementation
Definition stats.h:132
std::optional< double > total_audio_energy
Definition stats.h:121
std::optional< unsigned long long > concealed_samples
Definition stats.h:125
std::optional< double > jitter_buffer_target_delay
Definition stats.h:138
std::optional< std::string > mid
Definition stats.h:106
std::optional< unsigned long long > total_samples_received
Definition stats.h:124
std::optional< double > jitter_buffer_delay
Definition stats.h:137
std::optional< unsigned long > nack_count
Definition stats.h:110
std::optional< unsigned long long > pli_count
Definition stats.h:112
std::optional< unsigned long long > header_bytes_received
Definition stats.h:118
std::optional< unsigned long > frame_width
Definition stats.h:114
std::optional< unsigned long > frame_height
Definition stats.h:115
std::optional< unsigned long long > removed_samples_for_acceleration
Definition stats.h:129
std::optional< double > frames_per_second
Definition stats.h:116
std::optional< unsigned long long > bytes_received
Definition stats.h:117
std::optional< std::string > track_identifier
Definition stats.h:107
std::optional< double > total_decode_time
Definition stats.h:141
std::optional< uint32_t > freeze_count
Definition stats.h:146
std::optional< unsigned long > key_frames_decoded
Definition stats.h:109
std::optional< double > total_processing_delay
Definition stats.h:140
std::optional< unsigned long long > inserted_samples_for_deceleration
Definition stats.h:128
std::optional< uint64_t > jitter_buffer_emitted_count
Definition stats.h:152
std::optional< double > min_playout_delay
Definition stats.h:154
std::optional< double > audio_level
Definition stats.h:120
std::optional< unsigned long long > fec_packets_received
Definition stats.h:122
std::optional< uint32_t > pause_count
Definition stats.h:149
std::optional< unsigned long long > fec_packets_discarded
Definition stats.h:123
std::optional< double > total_inter_frame_delay
Definition stats.h:143
std::optional< double > jitter_buffer_minimum_delay
Definition stats.h:139
std::optional< unsigned long long > retransmitted_bytes_received
Definition stats.h:135
std::optional< std::string > remote_id
Definition stats.h:105
std::optional< double > total_squared_inter_frame_delay
Definition stats.h:144
std::optional< unsigned long > frames_decoded
Definition stats.h:108
static constexpr auto STYPE
Definition stats.h:103
std::optional< unsigned long long > silent_concealed_samples
Definition stats.h:126
std::optional< unsigned long > huge_frames_sent
Definition stats.h:175
std::optional< unsigned int > quality_limitation_resolution_changes
Definition stats.h:185
std::optional< std::string > sender_id
Definition stats.h:168
static constexpr auto STYPE
Definition stats.h:167
std::optional< std::string > quality_limitation_durations
Definition stats.h:184
std::optional< std::string > encoder_implementation
Definition stats.h:187
std::optional< std::string > remote_id
Definition stats.h:169
std::optional< unsigned long > frames_sent
Definition stats.h:174
std::optional< unsigned long > pli_count
Definition stats.h:182
std::optional< unsigned long > frames_encoded
Definition stats.h:177
std::optional< double > target_bitrate
Definition stats.h:170
std::optional< unsigned long > qp_sum
Definition stats.h:183
std::optional< unsigned long > frame_height
Definition stats.h:172
std::optional< unsigned long > nack_count
Definition stats.h:180
std::optional< unsigned long > total_packet_send_delay
Definition stats.h:176
std::optional< unsigned long > fir_count
Definition stats.h:181
std::optional< double > frames_per_second
Definition stats.h:173
std::optional< unsigned long > total_encoded_bytes_target
Definition stats.h:179
std::optional< unsigned long > key_frames_encoded
Definition stats.h:178
std::optional< std::string > quality_limitation_reason
Definition stats.h:186
std::optional< unsigned long > frame_width
Definition stats.h:171
std::optional< double > total_round_trip_time
Definition stats.h:80
std::optional< double > available_outgoing_bitrate
Definition stats.h:82
std::optional< double > current_round_trip_time
Definition stats.h:81
static constexpr auto STYPE
Definition stats.h:79
std::optional< double > available_incoming_bitrate
Definition stats.h:83
std::optional< unsigned long long > frames_dropped
Definition stats.h:99
std::optional< unsigned long long > packets_received
Definition stats.h:96
std::optional< long long > packets_lost
Definition stats.h:98
static constexpr auto STYPE
Definition stats.h:94
std::optional< double > jitter
Definition stats.h:97
double total_round_trip_time
Definition stats.h:204
unsigned long round_trip_time_measurements
Definition stats.h:205
double fraction_lost
Definition stats.h:206
std::string local_id
Definition stats.h:202
double round_trip_time
Definition stats.h:203
static constexpr auto STYPE
Definition stats.h:201
double round_trip_time
Definition stats.h:195
double total_round_trip_time
Definition stats.h:197
unsigned long long round_trip_time_measurements
Definition stats.h:196
unsigned long long reports_sent
Definition stats.h:194
double remote_timestamp
Definition stats.h:193
std::string local_id
Definition stats.h:192
static constexpr auto STYPE
Definition stats.h:191
std::optional< std::string > codec_id
Definition stats.h:90
std::optional< std::string > transport_id
Definition stats.h:89
unsigned long ssrc
Definition stats.h:87
std::string kind
Definition stats.h:88
unsigned long long bytes_sent
Definition stats.h:161
unsigned long retransmitted_bytes_sent
Definition stats.h:162
unsigned long retransmitted_packets_sent
Definition stats.h:160
static constexpr auto STYPE
Definition stats.h:158
unsigned long long header_bytes_sent
Definition stats.h:163
unsigned long packets_sent
Definition stats.h:159
std::string id
The WebRTC identifier for the statistics.
Definition stats.h:45
Type type
Type of statistics.
Definition stats.h:50
int64_t timestamp
The timestamp in Milliseconds since Unix Epoch (Jan 1, 1970 00:00:00 UTC).
Definition stats.h:40
const T * cast_to() const
Cast the statistics to their true type. Make sure to use.
Definition stats.h:57
std::optional< unsigned long > frames
Definition stats.h:219
static constexpr auto STYPE
Definition stats.h:216
std::optional< unsigned long > width
Definition stats.h:217
std::optional< double > frames_per_second
Definition stats.h:220
std::optional< unsigned long > height
Definition stats.h:218