Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
reports.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Roc Streaming authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_rtcp/reports.h
10//! @brief RTCP reports.
11
12#ifndef ROC_RTCP_REPORTS_H_
13#define ROC_RTCP_REPORTS_H_
14
15#include "roc_core/stddefs.h"
16#include "roc_core/time.h"
17#include "roc_packet/units.h"
18
19namespace roc {
20namespace rtcp {
21
22//! Sender report, for inspection on receiver.
23//! @remarks
24//! This struct accumulates data of SDES, SR, and XR packets.
25//! On sender, it's queried from pipeline and used to generate RTCP packets.
26//! On receiver, it's filled from RTCP packets and passed to pipeline.
27struct SendReport {
28 //! CNAME of sender.
29 //! Should not change.
30 //! On sender, should be same as local CNAME.
31 const char* sender_cname;
32
33 //! SSRC of sender.
34 //! Should not change.
35 //! On sender, should be same as local SSRC.
37
38 //! Absolute timestamp of report in nanoseconds since Unix epoch.
39 //! Defines time when report was sent in sender's clock domain.
41
42 //! RTP timestamp corresponding to absolute timestamp.
43 //! Estimated stream timestamp (STS) of the sample being captured at the time
44 //! corresponding to report_timestamp.
46
47 //! Number of RTP timestamp units per second.
48 //! Write-only field. You should set it to non-zero value on sender, however
49 //! on receiver it is always zero.
51
52 //! Number of packets sent.
53 //! The total number of RTP data packets transmitted by the sender since starting
54 //! transmission up until the time of this report.
55 uint64_t packet_count;
56
57 //! Number of bytes sent.
58 //! The total number of payload octets (i.e., not including header or padding)
59 //! transmitted in RTP data packets by the sender since starting transmission
60 //! up until the time this report.
61 uint64_t byte_count;
62
63 //! Estimated offset of remote clock relative to local clock.
64 //! If you add it to local timestamp, you get estimated remote timestamp.
65 //! If you subtract it from remote timestamp, you get estimated local timestamp.
66 //! Read-only field. You can read it on receiver, but you should not set
67 //! it on sender.
69
70 //! Estimated round-trip time between sender and receiver.
71 //! Computed based on NTP-like timestamp exchange implemennted by RTCP protocol.
72 //! Read-only field. You can read it on receiver, but you should not set
73 //! it on sender.
75
77 : sender_cname(NULL)
81 , sample_rate(0)
82 , packet_count(0)
83 , byte_count(0)
84 , clock_offset(0)
85 , rtt(0) {
86 }
87};
88
89//! Receiver report, for inspection on sender.
90//! @remarks
91//! This struct accumulates data of SDES, RR and XR packets.
92//! On receiver, it's queried from pipeline and used to generate RTCP packets.
93//! On sender, it's filled from RTCP packets and passed to pipeline.
94struct RecvReport {
95 //! CNAME of receiver.
96 //! Should not change.
97 //! On receiver, should be same as local CNAME.
98 const char* receiver_cname;
99
100 //! SSRC of receiver.
101 //! Should not change.
102 //! On receiver, should be same as local SSRC.
104
105 //! SSRC of sender.
106 //! Should not change.
108
109 //! Absolute timestamp of report in nanoseconds since Unix epoch.
110 //! Defines time when report was sent in receiver's clock domain.
112
113 //! Number RTP timestamp units per second.
114 //! Write-only field. You should set it to non-zero value on receiver, however
115 //! on sender it is always zero.
117
118 //! Extended lowest sequence number received.
119 //! The low 16 bits contain the highest sequence number received in an RTP data
120 //! packet, and the high 16 bits extend that sequence number with the corresponding
121 //! count of sequence number cycles.
123
124 //! Extended highest sequence number received.
125 //! The low 16 bits contain the highest sequence number received in an RTP data
126 //! packet, and the high 16 bits extend that sequence number with the corresponding
127 //! count of sequence number cycles.
129
130 //! Number of packets expected.
131 //! On sender it's derived from ext_first_seqnum and ext_last_seqnum and may
132 //! be zero if necessary XR blocks are not supported.
133 uint64_t packet_count;
134
135 //! Cumulative count of lost packets.
136 //! The total number of RTP data packets that have been lost since the beginning
137 //! of reception. Defined to be the number of packets expected minus the number of
138 //! packets actually received, where the number of packets received includes any
139 //! which are late or duplicates. Packets that arrive late are not counted as lost,
140 //! and the loss may be negative if there are duplicates.
141 int64_t cum_loss;
142
143 //! Estimated interarrival jitter.
144 //! An estimate of the statistical variance of the RTP data packet
145 //! interarrival time.
147
148 //! Estimated network incoming queue latency.
149 //! An estimate of how much media is buffered in receiver packet queue.
151
152 //! Network incoming queue stalling.
153 //! How much time elapsed since last received packet.
155
156 //! Estimated end-to-end latency.
157 //! An estimate of the time from recording a frame on sender to playing it
158 //! on receiver.
160
161 //! Estimated offset of remote clock relative to local clock.
162 //! If you add it to local timestamp, you get estimated remote timestamp.
163 //! Read-only field. You can read it on sender, but you should not set
164 //! it on receiver.
166
167 //! Estimated round-trip time between sender and receiver.
168 //! Computed based on NTP-like timestamp exchange implemennted by RTCP protocol.
169 //! Read-only field. You can read it on sender, but you should not set
170 //! it on receiver.
172
173 RecvReport()
174 : receiver_cname(NULL)
178 , sample_rate(0)
180 , ext_last_seqnum(0)
181 , packet_count(0)
182 , cum_loss(0)
183 , jitter(0)
184 , niq_latency(0)
185 , niq_stalling(0)
186 , e2e_latency(0)
187 , clock_offset(0)
188 , rtt(0) {
189 }
190};
191
192} // namespace rtcp
193} // namespace roc
194
195#endif // ROC_RTCP_REPORTS_H_
int64_t nanoseconds_t
Nanoseconds.
Definition time.h:58
uint32_t ext_seqnum_t
Extended sequence number.
Definition units.h:103
uint32_t stream_source_t
Packet stream identifier.
Definition units.h:27
uint32_t stream_timestamp_t
Packet stream timestamp.
Definition units.h:36
Root namespace.
Commonly used types and functions.
Receiver report, for inspection on sender.
Definition reports.h:94
core::nanoseconds_t clock_offset
Estimated offset of remote clock relative to local clock. If you add it to local timestamp,...
Definition reports.h:165
core::nanoseconds_t e2e_latency
Estimated end-to-end latency. An estimate of the time from recording a frame on sender to playing it ...
Definition reports.h:159
core::nanoseconds_t niq_stalling
Network incoming queue stalling. How much time elapsed since last received packet.
Definition reports.h:154
uint64_t packet_count
Number of packets expected. On sender it's derived from ext_first_seqnum and ext_last_seqnum and may ...
Definition reports.h:133
packet::stream_source_t receiver_source_id
SSRC of receiver. Should not change. On receiver, should be same as local SSRC.
Definition reports.h:103
core::nanoseconds_t report_timestamp
Absolute timestamp of report in nanoseconds since Unix epoch. Defines time when report was sent in re...
Definition reports.h:111
const char * receiver_cname
CNAME of receiver. Should not change. On receiver, should be same as local CNAME.
Definition reports.h:98
core::nanoseconds_t rtt
Estimated round-trip time between sender and receiver. Computed based on NTP-like timestamp exchange ...
Definition reports.h:171
packet::ext_seqnum_t ext_last_seqnum
Extended highest sequence number received. The low 16 bits contain the highest sequence number receiv...
Definition reports.h:128
core::nanoseconds_t jitter
Estimated interarrival jitter. An estimate of the statistical variance of the RTP data packet interar...
Definition reports.h:146
int64_t cum_loss
Cumulative count of lost packets. The total number of RTP data packets that have been lost since the ...
Definition reports.h:141
packet::stream_source_t sender_source_id
SSRC of sender. Should not change.
Definition reports.h:107
packet::ext_seqnum_t ext_first_seqnum
Extended lowest sequence number received. The low 16 bits contain the highest sequence number receive...
Definition reports.h:122
core::nanoseconds_t niq_latency
Estimated network incoming queue latency. An estimate of how much media is buffered in receiver packe...
Definition reports.h:150
size_t sample_rate
Number RTP timestamp units per second. Write-only field. You should set it to non-zero value on recei...
Definition reports.h:116
Sender report, for inspection on receiver.
Definition reports.h:27
core::nanoseconds_t report_timestamp
Absolute timestamp of report in nanoseconds since Unix epoch. Defines time when report was sent in se...
Definition reports.h:40
size_t sample_rate
Number of RTP timestamp units per second. Write-only field. You should set it to non-zero value on se...
Definition reports.h:50
uint64_t packet_count
Number of packets sent. The total number of RTP data packets transmitted by the sender since starting...
Definition reports.h:55
core::nanoseconds_t clock_offset
Estimated offset of remote clock relative to local clock. If you add it to local timestamp,...
Definition reports.h:68
packet::stream_source_t sender_source_id
SSRC of sender. Should not change. On sender, should be same as local SSRC.
Definition reports.h:36
packet::stream_timestamp_t stream_timestamp
RTP timestamp corresponding to absolute timestamp. Estimated stream timestamp (STS) of the sample bei...
Definition reports.h:45
uint64_t byte_count
Number of bytes sent. The total number of payload octets (i.e., not including header or padding) tran...
Definition reports.h:61
const char * sender_cname
CNAME of sender. Should not change. On sender, should be same as local CNAME.
Definition reports.h:31
core::nanoseconds_t rtt
Estimated round-trip time between sender and receiver. Computed based on NTP-like timestamp exchange ...
Definition reports.h:74
Time definitions.
Various units used in packets.