MillicastSDK 2.5.0
Loading...
Searching...
No Matches
rts_stats.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef __cplusplus
4
5#include <cstdint>
6#include <optional>
7#include <string>
8#include <vector>
9
10#include "exports.h"
11
12namespace millicast {
13
20struct MILLICAST_API RtsTrackStats {
21 enum class Type { AUDIO = 0, VIDEO };
22 Type type;
23
24 int64_t timestamp;
25
26 // Service information
27 std::optional<std::string> source_id;
28
29 // WebRTC identification information
30 std::string mid;
31 std::string track_identifier;
32
33 // packet/retransmission information
34 std::optional<uint64_t> bytes_received;
35 std::optional<uint64_t> retransmitted_bytes_received;
36 std::optional<uint64_t> packets_received;
37 std::optional<uint64_t> retransmitted_packets_received;
38 std::optional<uint64_t> packets_lost;
39 std::optional<uint32_t> nack_count;
40 std::optional<uint64_t> bitrate_bps;
41
42 // jitter information
43 std::optional<double> jitter;
44 // Those are already normalized based on the emitted count.
45 std::optional<double> jitter_buffer_delay;
46 std::optional<double> jitter_buffer_minimum_delay;
47
48 // This is normalized against the number of frames decoded.
49 std::optional<double> processing_delay;
50
51 std::string mime_type;
52 uint32_t payload_type;
53
54 // The rest is video information (not available when it's an audio track)
55 std::optional<std::string> decoder_implementation;
56 std::optional<uint32_t> frame_width;
57 std::optional<uint32_t> frame_height;
58 std::optional<uint32_t> frames_per_second;
59
60 std::optional<uint32_t> frames_received;
61 std::optional<uint32_t> frames_decoded;
62 std::optional<uint32_t> key_frames_decoded;
63 std::optional<uint32_t> frames_dropped;
64
65 // This is normalized against the number of frames decoded (video only).
66 std::optional<double> decode_time;
67
68 std::optional<uint32_t> pause_count;
69 std::optional<uint32_t> freeze_count;
70
71 std::optional<double> total_pauses_duration;
72 std::optional<double> total_freezes_duration;
73
74 std::optional<uint32_t> fir_count;
75 std::optional<uint32_t> pli_count;
76};
77
83class MILLICAST_API RtsViewerStats {
84 public:
88 enum class Level { FULL, SIMPLIFIED };
89
90 std::string cluster_id;
91 std::string stream_view_id;
92 std::string subscriber_id;
93 std::string stream_id;
94
95 int64_t timestamp;
96 std::optional<double> total_round_trip_time;
97 std::optional<double> current_round_trip_time;
98
99 /*
100 * @brief statistics of all the enabled tracks.
101 * */
102 std::vector<std::shared_ptr<const RtsTrackStats>> track_stats;
103
104 RtsViewerStats() = default;
105
114 [[nodiscard]] virtual std::string to_json(Level level) const = 0;
115
116 virtual ~RtsViewerStats() = default;
117
118 protected:
119 RtsViewerStats(const RtsViewerStats&) noexcept = default;
120 RtsViewerStats(RtsViewerStats&&) noexcept = default;
121 RtsViewerStats& operator=(RtsViewerStats&&) noexcept = default;
122 RtsViewerStats& operator=(const RtsViewerStats&) noexcept = default;
123};
124} // namespace millicast
125
126#endif //__cplusplus
#define MILLICAST_API
Definition exports.h:51