oRTP: /usr/obj/ports_mfs/ortp-0.24.2/ortp-0.24.2/include/ortp/rtcp.h Source File

oRTP 0.24.2

- Main Page
- Data Structures
- Files

- File List
- Globals

rtcp.h
1 /*
2 The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
3 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20
21 #ifndef RTCP_H
22 #define RTCP_H
23
24 #include <ortp/port.h>
25
26 #define RTCP_MAX_RECV_BUFSIZE 1500
27
28 #define RTCP_SENDER_INFO_SIZE 20
29 #define RTCP_REPORT_BLOCK_SIZE 24
30 #define RTCP_COMMON_HEADER_SIZE 4
31 #define RTCP_SSRC_FIELD_SIZE 4
32
33 #ifdef __cplusplus
34 extern "C"{
35 #endif
36
37 /* RTCP common header */
38
39 typedef enum {
40 RTCP_SR = 200,
41 RTCP_RR = 201,
42 RTCP_SDES = 202,
43 RTCP_BYE = 203,
44 RTCP_APP = 204,
45 RTCP_RTPFB = 205,
46 RTCP_PSFB = 206,
47 RTCP_XR = 207
48 } rtcp_type_t;
49
50
51 typedef struct rtcp_common_header
52 {
53 #ifdef ORTP_BIGENDIAN
54 uint16_t version:2;
55 uint16_t padbit:1;
56 uint16_t rc:5;
57 uint16_t packet_type:8;
58 #else
59 uint16_t rc:5;
60 uint16_t padbit:1;
61 uint16_t version:2;
62 uint16_t packet_type:8;
63 #endif
64 uint16_t length:16;
65 } rtcp_common_header_t;
66
67 #define rtcp_common_header_set_version(ch,v) (ch)->version=v
68 #define rtcp_common_header_set_padbit(ch,p) (ch)->padbit=p
69 #define rtcp_common_header_set_rc(ch,rc) (ch)->rc=rc
70 #define rtcp_common_header_set_packet_type(ch,pt) (ch)->packet_type=pt
71 #define rtcp_common_header_set_length(ch,l) (ch)->length=htons(l)
72
73 #define rtcp_common_header_get_version(ch) ((ch)->version)
74 #define rtcp_common_header_get_padbit(ch) ((ch)->padbit)
75 #define rtcp_common_header_get_rc(ch) ((ch)->rc)
76 #define rtcp_common_header_get_packet_type(ch) ((ch)->packet_type)
77 #define rtcp_common_header_get_length(ch) ntohs((ch)->length)
78
79
80 /* SR or RR packets */
81
82 typedef struct sender_info
83 {
84 uint32_t ntp_timestamp_msw;
85 uint32_t ntp_timestamp_lsw;
86 uint32_t rtp_timestamp;
87 uint32_t senders_packet_count;
88 uint32_t senders_octet_count;
89 } sender_info_t;
90
91 uint64_t sender_info_get_ntp_timestamp(const sender_info_t *si);
92 #define sender_info_get_rtp_timestamp(si) ((si)->rtp_timestamp)
93 #define sender_info_get_packet_count(si) \
94 ntohl((si)->senders_packet_count)
95 #define sender_info_get_octet_count(si) \
96 ntohl((si)->senders_octet_count)
97
98
99 typedef struct report_block
100 {
101 uint32_t ssrc;
102 uint32_t fl_cnpl;/*fraction lost + cumulative number of packet lost*/
103 uint32_t ext_high_seq_num_rec; /*extended highest sequence number received */
104 uint32_t interarrival_jitter;
105 uint32_t lsr; /*last SR */
106 uint32_t delay_snc_last_sr; /*delay since last sr*/
107 } report_block_t;
108
109 static ORTP_INLINE uint32_t report_block_get_ssrc(const report_block_t * rb) {
110 return ntohl(rb->ssrc);
111 }
112 static ORTP_INLINE uint32_t report_block_get_high_ext_seq(const report_block_t * rb) {
113 return ntohl(rb->ext_high_seq_num_rec);
114 }
115 static ORTP_INLINE uint32_t report_block_get_interarrival_jitter(const report_block_t * rb) {
116 return ntohl(rb->interarrival_jitter);
117 }
118
119 static ORTP_INLINE uint32_t report_block_get_last_SR_time(const report_block_t * rb) {
120 return ntohl(rb->lsr);
121 }
122 static ORTP_INLINE uint32_t report_block_get_last_SR_delay(const report_block_t * rb) {
123 return ntohl(rb->delay_snc_last_sr);
124 }
125 static ORTP_INLINE uint32_t report_block_get_fraction_lost(const report_block_t * rb) {
126 return (ntohl(rb->fl_cnpl)>>24);
127 }
128 static ORTP_INLINE int32_t report_block_get_cum_packet_lost(const report_block_t * rb){
129 int cum_loss = ntohl(rb->fl_cnpl);
130 if (((cum_loss>>23)&1)==0)
131 return 0x00FFFFFF & cum_loss;
132 else
133 return 0xFF000000 | (cum_loss-0xFFFFFF-1);
134 }
135
136 static ORTP_INLINE void report_block_set_fraction_lost(report_block_t * rb, int fl){
137 rb->fl_cnpl = htonl( (ntohl(rb->fl_cnpl) & 0xFFFFFF) | (fl&0xFF)<<24);
138 }
139
140 static ORTP_INLINE void report_block_set_cum_packet_lost(report_block_t * rb, int64_t cpl) {
141 uint32_t clamp = (uint32_t)((1<<24) + ((cpl>=0) ? (cpl>0x7FFFFF?0x7FFFFF:cpl) : (-cpl>0x800000?-0x800000:cpl)));
142
143 rb->fl_cnpl=htonl(
144 (ntohl(rb->fl_cnpl) & 0xFF000000) |
145 (cpl >= 0 ? clamp&0x7FFFFF : clamp|0x800000)
146 );
147 }
148
149 /* SDES packets */
150
151 typedef enum {
152 RTCP_SDES_END = 0,
153 RTCP_SDES_CNAME = 1,
154 RTCP_SDES_NAME = 2,
155 RTCP_SDES_EMAIL = 3,
156 RTCP_SDES_PHONE = 4,
157 RTCP_SDES_LOC = 5,
158 RTCP_SDES_TOOL = 6,
159 RTCP_SDES_NOTE = 7,
160 RTCP_SDES_PRIV = 8,
161 RTCP_SDES_MAX = 9
162 } rtcp_sdes_type_t;
163
164 typedef struct sdes_chunk
165 {
166 uint32_t csrc;
167 } sdes_chunk_t;
168
169
170 #define sdes_chunk_get_csrc(c) ntohl((c)->csrc)
171
172 typedef struct sdes_item
173 {
174 uint8_t item_type;
175 uint8_t len;
176 char content[1];
177 } sdes_item_t;
178
179 #define RTCP_SDES_MAX_STRING_SIZE 255
180 #define RTCP_SDES_ITEM_HEADER_SIZE 2
181 #define RTCP_SDES_CHUNK_DEFAULT_SIZE 1024
182 #define RTCP_SDES_CHUNK_HEADER_SIZE (sizeof(sdes_chunk_t))
183
184 /* RTCP bye packet */
185
186 typedef struct rtcp_bye_reason
187 {
188 uint8_t len;
189 char content[1];
190 } rtcp_bye_reason_t;
191
192 typedef struct rtcp_bye
193 {
194 rtcp_common_header_t ch;
195 uint32_t ssrc[1]; /* the bye may contain several ssrc/csrc */
196 } rtcp_bye_t;
197 #define RTCP_BYE_HEADER_SIZE sizeof(rtcp_bye_t)
198 #define RTCP_BYE_REASON_MAX_STRING_SIZE 255
199
200
201 /* RTCP XR packet */
202
203 #define RTCP_XR_VOIP_METRICS_CONFIG_PLC_STD ((1 << 7) | (1 << 6))
204 #define RTCP_XR_VOIP_METRICS_CONFIG_PLC_ENH (1 << 7)
205 #define RTCP_XR_VOIP_METRICS_CONFIG_PLC_DIS (1 << 6)
206 #define RTCP_XR_VOIP_METRICS_CONFIG_PLC_UNS 0
207 #define RTCP_XR_VOIP_METRICS_CONFIG_JBA_ADA ((1 << 5) | (1 << 4))
208 #define RTCP_XR_VOIP_METRICS_CONFIG_JBA_NON (1 << 5)
209 #define RTCP_XR_VOIP_METRICS_CONFIG_JBA_UNK 0
210
211 typedef enum {
212 RTCP_XR_LOSS_RLE = 1,
213 RTCP_XR_DUPLICATE_RLE = 2,
214 RTCP_XR_PACKET_RECEIPT_TIMES = 3,
215 RTCP_XR_RCVR_RTT = 4,
216 RTCP_XR_DLRR = 5,
217 RTCP_XR_STAT_SUMMARY = 6,
218 RTCP_XR_VOIP_METRICS = 7
219 } rtcp_xr_block_type_t;
220
221 typedef struct rtcp_xr_header {
222 rtcp_common_header_t ch;
223 uint32_t ssrc;
224 } rtcp_xr_header_t;
225
226 typedef struct rtcp_xr_generic_block_header {
227 uint8_t bt;
228 uint8_t flags;
229 uint16_t length;
230 } rtcp_xr_generic_block_header_t;
231
232 typedef struct rtcp_xr_rcvr_rtt_report_block {
233 rtcp_xr_generic_block_header_t bh;
234 uint32_t ntp_timestamp_msw;
235 uint32_t ntp_timestamp_lsw;
236 } rtcp_xr_rcvr_rtt_report_block_t;
237
238 typedef struct rtcp_xr_dlrr_report_subblock {
239 uint32_t ssrc;
240 uint32_t lrr;
241 uint32_t dlrr;
242 } rtcp_xr_dlrr_report_subblock_t;
243
244 typedef struct rtcp_xr_dlrr_report_block {
245 rtcp_xr_generic_block_header_t bh;
246 rtcp_xr_dlrr_report_subblock_t content[1];
247 } rtcp_xr_dlrr_report_block_t;
248
249 typedef struct rtcp_xr_stat_summary_report_block {
250 rtcp_xr_generic_block_header_t bh;
251 uint32_t ssrc;
252 uint16_t begin_seq;
253 uint16_t end_seq;
254 uint32_t lost_packets;
255 uint32_t dup_packets;
256 uint32_t min_jitter;
257 uint32_t max_jitter;
258 uint32_t mean_jitter;
259 uint32_t dev_jitter;
260 uint8_t min_ttl_or_hl;
261 uint8_t max_ttl_or_hl;
262 uint8_t mean_ttl_or_hl;
263 uint8_t dev_ttl_or_hl;
264 } rtcp_xr_stat_summary_report_block_t;
265
266 typedef struct rtcp_xr_voip_metrics_report_block {
267 rtcp_xr_generic_block_header_t bh;
268 uint32_t ssrc;
269 uint8_t loss_rate;
270 uint8_t discard_rate;
271 uint8_t burst_density;
272 uint8_t gap_density;
273 uint16_t burst_duration;
274 uint16_t gap_duration;
275 uint16_t round_trip_delay;
276 uint16_t end_system_delay;
277 uint8_t signal_level;
278 uint8_t noise_level;
279 uint8_t rerl;
280 uint8_t gmin;
281 uint8_t r_factor;
282 uint8_t ext_r_factor;
283 uint8_t mos_lq;
284 uint8_t mos_cq;
285 uint8_t rx_config;
286 uint8_t reserved2;
287 uint16_t jb_nominal;
288 uint16_t jb_maximum;
289 uint16_t jb_abs_max;
290 } rtcp_xr_voip_metrics_report_block_t;
291
292 #define MIN_RTCP_XR_PACKET_SIZE (sizeof(rtcp_xr_header_t) + 4)
293
294 typedef enum {
295 RTCP_RTPFB_NACK = 1,
296 RTCP_RTPFB_TMMBR = 3,
297 RTCP_RTPFB_TMMBN = 4
298 } rtcp_rtpfb_type_t;
299
300 typedef enum {
301 RTCP_PSFB_PLI = 1,
302 RTCP_PSFB_SLI = 2,
303 RTCP_PSFB_RPSI = 3,
304 RTCP_PSFB_FIR = 4,
305 RTCP_PSFB_AFB = 15
306 } rtcp_psfb_type_t;
307
308 typedef struct rtcp_fb_header {
309 uint32_t packet_sender_ssrc;
310 uint32_t media_source_ssrc;
311 } rtcp_fb_header_t;
312
313 typedef struct rtcp_fb_tmmbr_fci {
314 uint32_t ssrc;
315 uint32_t value;
316 } rtcp_fb_tmmbr_fci_t;
317
318 #define rtcp_fb_tmmbr_fci_get_ssrc(tmmbr) ntohl((tmmbr)->ssrc)
319 #define rtcp_fb_tmmbr_fci_get_mxtbr_exp(tmmbr) \
320 ((uint8_t)((ntohl((tmmbr)->value) >> 26) & 0x0000003F))
321 #define rtcp_fb_tmmbr_fci_set_mxtbr_exp(tmmbr, mxtbr_exp) \
322 ((tmmbr)->value) = htonl((ntohl((tmmbr)->value) & 0x03FFFFFF) | (((mxtbr_exp) & 0x0000003F) << 26))
323 #define rtcp_fb_tmmbr_fci_get_mxtbr_mantissa(tmmbr) \
324 ((uint32_t)((ntohl((tmmbr)->value) >> 9) & 0x0001FFFF))
325 #define rtcp_fb_tmmbr_fci_set_mxtbr_mantissa(tmmbr, mxtbr_mantissa) \
326 ((tmmbr)->value) = htonl((ntohl((tmmbr)->value) & 0xFC0001FF) | (((mxtbr_mantissa) & 0x0001FFFF) << 9))
327 #define rtcp_fb_tmmbr_fci_get_measured_overhead(tmmbr) \
328 ((uint16_t)(ntohl((tmmbr)->value) & 0x000001FF))
329 #define rtcp_fb_tmmbr_fci_set_measured_overhead(tmmbr, measured_overhead) \
330 ((tmmbr)->value) = htonl((ntohl((tmmbr)->value) & 0xFFFFFE00) | ((measured_overhead) & 0x000001FF))
331
332 typedef struct rtcp_fb_fir_fci {
333 uint32_t ssrc;
334 uint8_t seq_nr;
335 uint8_t pad1;
336 uint16_t pad2;
337 } rtcp_fb_fir_fci_t;
338
339 #define rtcp_fb_fir_fci_get_ssrc(fci) ntohl((fci)->ssrc)
340 #define rtcp_fb_fir_fci_get_seq_nr(fci) (fci)->seq_nr
341
342 typedef struct rtcp_fb_sli_fci {
343 uint32_t value;
344 } rtcp_fb_sli_fci_t;
345
346 #define rtcp_fb_sli_fci_get_first(fci) \
347 ((uint16_t)((ntohl((fci)->value) >> 19) & 0x00001FFF))
348 #define rtcp_fb_sli_fci_set_first(fci, first) \
349 ((fci)->value) = htonl((ntohl((fci)->value) & 0x0007FFFF) | (((first) & 0x00001FFF) << 19))
350 #define rtcp_fb_sli_fci_get_number(fci) \
351 ((uint16_t)((ntohl((fci)->value) >> 6) & 0x00001FFF))
352 #define rtcp_fb_sli_fci_set_number(fci, number) \
353 ((fci)->value) = htonl((ntohl((fci)->value) & 0xFFF8003F) | (((number) & 0x00001FFF) << 6))
354 #define rtcp_fb_sli_fci_get_picture_id(fci) \
355 ((uint8_t)(ntohl((fci)->value) & 0x0000003F))
356 #define rtcp_fb_sli_fci_set_picture_id(fci, picture_id) \
357 ((fci)->value) = htonl((ntohl((fci)->value) & 0xFFFFFFC0) | ((picture_id) & 0x0000003F))
358
359 typedef struct rtcp_fb_rpsi_fci {
360 uint8_t pb;
361 uint8_t payload_type;
362 uint16_t bit_string[1];
363 } rtcp_fb_rpsi_fci_t;
364
365 #define rtcp_fb_rpsi_fci_get_payload_type(fci) (fci)->payload_type
366 #define rtcp_fb_rpsi_fci_get_bit_string(fci) ((uint8_t *)(fci)->bit_string)
367
368 #define MIN_RTCP_PSFB_PACKET_SIZE (sizeof(rtcp_common_header_t) + sizeof(rtcp_fb_header_t))
369 #define MIN_RTCP_RTPFB_PACKET_SIZE (sizeof(rtcp_common_header_t) + sizeof(rtcp_fb_header_t))
370
371
372
373 typedef struct rtcp_sr{
374 rtcp_common_header_t ch;
375 uint32_t ssrc;
376 sender_info_t si;
377 report_block_t rb[1];
378 } rtcp_sr_t;
379
380 typedef struct rtcp_rr{
381 rtcp_common_header_t ch;
382 uint32_t ssrc;
383 report_block_t rb[1];
384 } rtcp_rr_t;
385
386 typedef struct rtcp_app{
387 rtcp_common_header_t ch;
388 uint32_t ssrc;
389 char name[4];
390 } rtcp_app_t;
391
392 struct _RtpSession;
393 struct _RtpStream;
394 ORTP_PUBLIC void rtp_session_rtcp_process_send(struct _RtpSession *s);
395 ORTP_PUBLIC void rtp_session_rtcp_process_recv(struct _RtpSession *s);
396
397
398 #define RTCP_DEFAULT_REPORT_INTERVAL 5000 /* in milliseconds */
399
400
401 /* packet parsing api */
402
403 /*in case of coumpound packet, set read pointer of m to the beginning of the next RTCP
404 packet */
405 ORTP_PUBLIC bool_t rtcp_next_packet(mblk_t *m);
406 /* put the read pointer at the first RTCP packet of the compound packet (as before any previous calls ot rtcp_next_packet() */
407 ORTP_PUBLIC void rtcp_rewind(mblk_t *m);
408 /* get common header*/
409 ORTP_PUBLIC const rtcp_common_header_t * rtcp_get_common_header(const mblk_t *m);
410
411 /*Sender Report accessors */
412 /* check if this packet is a SR and if it is correct */
413 ORTP_PUBLIC bool_t rtcp_is_SR(const mblk_t *m);
414 ORTP_PUBLIC uint32_t rtcp_SR_get_ssrc(const mblk_t *m);
415 ORTP_PUBLIC const sender_info_t * rtcp_SR_get_sender_info(const mblk_t *m);
416 ORTP_PUBLIC const report_block_t * rtcp_SR_get_report_block(const mblk_t *m, int idx);
417
418 /*Receiver report accessors*/
419 ORTP_PUBLIC bool_t rtcp_is_RR(const mblk_t *m);
420 ORTP_PUBLIC uint32_t rtcp_RR_get_ssrc(const mblk_t *m);
421 ORTP_PUBLIC const report_block_t * rtcp_RR_get_report_block(const mblk_t *m,int idx);
422
423 /*SDES accessors */
424 ORTP_PUBLIC bool_t rtcp_is_SDES(const mblk_t *m);
425 typedef void (*SdesItemFoundCallback)(void *user_data, uint32_t csrc, rtcp_sdes_type_t t, const char *content, uint8_t content_len);
426 ORTP_PUBLIC void rtcp_sdes_parse(const mblk_t *m, SdesItemFoundCallback cb, void *user_data);
427
428 /*BYE accessors */
429 ORTP_PUBLIC bool_t rtcp_is_BYE(const mblk_t *m);
430 ORTP_PUBLIC bool_t rtcp_BYE_get_ssrc(const mblk_t *m, int idx, uint32_t *ssrc);
431 ORTP_PUBLIC bool_t rtcp_BYE_get_reason(const mblk_t *m, const char **reason, int *reason_len);
432
433 /*APP accessors */
434 ORTP_PUBLIC bool_t rtcp_is_APP(const mblk_t *m);
435 ORTP_PUBLIC int rtcp_APP_get_subtype(const mblk_t *m);
436 ORTP_PUBLIC uint32_t rtcp_APP_get_ssrc(const mblk_t *m);
437 /* name argument is supposed to be at least 4 characters (note: no '\0' written)*/
438 ORTP_PUBLIC void rtcp_APP_get_name(const mblk_t *m, char *name);
439 /* retrieve the data. when returning, data points directly into the mblk_t */
440 ORTP_PUBLIC void rtcp_APP_get_data(const mblk_t *m, uint8_t **data, int *len);
441
442 /* RTCP XR accessors */
443 ORTP_PUBLIC bool_t rtcp_is_XR(const mblk_t *m);
444 ORTP_PUBLIC rtcp_xr_block_type_t rtcp_XR_get_block_type(const mblk_t *m);
445 ORTP_PUBLIC uint32_t rtcp_XR_get_ssrc(const mblk_t *m);
446 ORTP_PUBLIC uint64_t rtcp_XR_rcvr_rtt_get_ntp_timestamp(const mblk_t *m);
447 ORTP_PUBLIC uint32_t rtcp_XR_dlrr_get_ssrc(const mblk_t *m);
448 ORTP_PUBLIC uint32_t rtcp_XR_dlrr_get_lrr(const mblk_t *m);
449 ORTP_PUBLIC uint32_t rtcp_XR_dlrr_get_dlrr(const mblk_t *m);
450 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_flags(const mblk_t *m);
451 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_ssrc(const mblk_t *m);
452 ORTP_PUBLIC uint16_t rtcp_XR_stat_summary_get_begin_seq(const mblk_t *m);
453 ORTP_PUBLIC uint16_t rtcp_XR_stat_summary_get_end_seq(const mblk_t *m);
454 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_lost_packets(const mblk_t *m);
455 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_dup_packets(const mblk_t *m);
456 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_min_jitter(const mblk_t *m);
457 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_max_jitter(const mblk_t *m);
458 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_mean_jitter(const mblk_t *m);
459 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_dev_jitter(const mblk_t *m);
460 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_min_ttl_or_hl(const mblk_t *m);
461 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_max_ttl_or_hl(const mblk_t *m);
462 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_mean_ttl_or_hl(const mblk_t *m);
463 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_dev_ttl_or_hl(const mblk_t *m);
464 ORTP_PUBLIC uint32_t rtcp_XR_voip_metrics_get_ssrc(const mblk_t *m);
465 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_loss_rate(const mblk_t *m);
466 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_discard_rate(const mblk_t *m);
467 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_burst_density(const mblk_t *m);
468 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_gap_density(const mblk_t *m);
469 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_burst_duration(const mblk_t *m);
470 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_gap_duration(const mblk_t *m);
471 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_round_trip_delay(const mblk_t *m);
472 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_end_system_delay(const mblk_t *m);
473 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_signal_level(const mblk_t *m);
474 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_noise_level(const mblk_t *m);
475 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_rerl(const mblk_t *m);
476 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_gmin(const mblk_t *m);
477 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_r_factor(const mblk_t *m);
478 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_ext_r_factor(const mblk_t *m);
479 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_mos_lq(const mblk_t *m);
480 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_mos_cq(const mblk_t *m);
481 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_rx_config(const mblk_t *m);
482 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_jb_nominal(const mblk_t *m);
483 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_jb_maximum(const mblk_t *m);
484 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_jb_abs_max(const mblk_t *m);
485
486 /* RTCP RTPFB accessors */
487 ORTP_PUBLIC bool_t rtcp_is_RTPFB(const mblk_t *m);
488 ORTP_PUBLIC rtcp_rtpfb_type_t rtcp_RTPFB_get_type(const mblk_t *m);
489 ORTP_PUBLIC rtcp_fb_tmmbr_fci_t * rtcp_RTPFB_tmmbr_get_fci(const mblk_t *m);
490 ORTP_PUBLIC uint32_t rtcp_RTPFB_get_packet_sender_ssrc(const mblk_t *m);
491 ORTP_PUBLIC uint32_t rtcp_RTPFB_get_media_source_ssrc(const mblk_t *m);
492
493 /* RTCP PSFB accessors */
494 ORTP_PUBLIC bool_t rtcp_is_PSFB(const mblk_t *m);
495 ORTP_PUBLIC rtcp_psfb_type_t rtcp_PSFB_get_type(const mblk_t *m);
496 ORTP_PUBLIC uint32_t rtcp_PSFB_get_packet_sender_ssrc(const mblk_t *m);
497 ORTP_PUBLIC uint32_t rtcp_PSFB_get_media_source_ssrc(const mblk_t *m);
498 ORTP_PUBLIC rtcp_fb_fir_fci_t * rtcp_PSFB_fir_get_fci(const mblk_t *m, unsigned int idx);
499 ORTP_PUBLIC rtcp_fb_sli_fci_t * rtcp_PSFB_sli_get_fci(const mblk_t *m, unsigned int idx);
500 ORTP_PUBLIC rtcp_fb_rpsi_fci_t * rtcp_PSFB_rpsi_get_fci(const mblk_t *m);
501 ORTP_PUBLIC uint16_t rtcp_PSFB_rpsi_get_fci_bit_string_len(const mblk_t *m);
502
503
504 typedef struct OrtpLossRateEstimator{
505 int min_packet_count_interval;
506 uint64_t min_time_ms_interval;
507 uint64_t last_estimate_time_ms;
508 int32_t last_cum_loss;
509 int32_t last_ext_seq;
510 float loss_rate;
515 int32_t last_dup_packet_sent_count;
520 int32_t last_packet_sent_count;
521 }OrtpLossRateEstimator;
522
523
524 ORTP_PUBLIC OrtpLossRateEstimator * ortp_loss_rate_estimator_new(int min_packet_count_interval, uint64_t min_time_ms_interval, struct _RtpSession *session);
525
526 ORTP_PUBLIC void ortp_loss_rate_estimator_init(OrtpLossRateEstimator *obj, int min_packet_count_interval, uint64_t min_time_ms_interval, struct _RtpSession *session);
527
528
544 ORTP_PUBLIC bool_t ortp_loss_rate_estimator_process_report_block(OrtpLossRateEstimator *obj,
545 const struct _RtpStream *stream,
546 const report_block_t *rb);
553 ORTP_PUBLIC float ortp_loss_rate_estimator_get_value(OrtpLossRateEstimator *obj);
554
555 ORTP_PUBLIC void ortp_loss_rate_estimator_uninit(OrtpLossRateEstimator *obj);
556
557 ORTP_PUBLIC void ortp_loss_rate_estimator_destroy(OrtpLossRateEstimator *obj);
558
559 #ifdef __cplusplus
560 }
561 #endif
562
563 #endif
report_block
Definition: rtcp.h:99
rtcp_xr_stat_summary_report_block
Definition: rtcp.h:249
OrtpLossRateEstimator::last_packet_sent_count
int32_t last_packet_sent_count
Definition: rtcp.h:520
rtcp_xr_voip_metrics_report_block
Definition: rtcp.h:266
rtcp_bye
Definition: rtcp.h:192
rtcp_fb_rpsi_fci
Definition: rtcp.h:359
_RtpSession
Definition: rtpsession.h:348
msgb
Definition: str_utils.h:49
rtcp_xr_header
Definition: rtcp.h:221
OrtpLossRateEstimator
Definition: rtcp.h:504
rtcp_xr_generic_block_header
Definition: rtcp.h:226
rtcp_common_header
Definition: rtcp.h:51
_RtpStream
Definition: rtpsession.h:284
rtcp_xr_dlrr_report_block
Definition: rtcp.h:244
rtcp_bye_reason
Definition: rtcp.h:186
rtcp_app
Definition: rtcp.h:386
rtcp_rr
Definition: rtcp.h:380
rtcp_xr_rcvr_rtt_report_block
Definition: rtcp.h:232
sdes_item
Definition: rtcp.h:172
rtcp_xr_dlrr_report_subblock
Definition: rtcp.h:238
OrtpLossRateEstimator::last_dup_packet_sent_count
int32_t last_dup_packet_sent_count
Definition: rtcp.h:515
rtcp_fb_fir_fci
Definition: rtcp.h:332
rtcp_fb_tmmbr_fci
Definition: rtcp.h:313
rtcp_fb_header
Definition: rtcp.h:308
sdes_chunk
Definition: rtcp.h:164
rtcp_sr
Definition: rtcp.h:373
rtcp_fb_sli_fci
Definition: rtcp.h:342
sender_info
Definition: rtcp.h:82