oRTP  0.25.0
include/ortp/rtcp.h
00001 /*
00002   The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
00003   Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014 
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 
00021 #ifndef RTCP_H
00022 #define RTCP_H
00023 
00024 #include <ortp/port.h>
00025 
00026 #define RTCP_MAX_RECV_BUFSIZE 1500
00027 
00028 #define RTCP_SENDER_INFO_SIZE 20
00029 #define RTCP_REPORT_BLOCK_SIZE 24
00030 #define RTCP_COMMON_HEADER_SIZE 4
00031 #define RTCP_SSRC_FIELD_SIZE 4
00032 
00033 #ifdef __cplusplus
00034 extern "C"{
00035 #endif
00036 
00037 /* RTCP common header */
00038 
00039 typedef enum {
00040         RTCP_SR = 200,
00041         RTCP_RR = 201,
00042         RTCP_SDES = 202,
00043         RTCP_BYE = 203,
00044         RTCP_APP = 204,
00045         RTCP_RTPFB = 205,
00046         RTCP_PSFB = 206,
00047         RTCP_XR = 207
00048 } rtcp_type_t;
00049 
00050 
00051 typedef struct rtcp_common_header
00052 {
00053 #ifdef ORTP_BIGENDIAN
00054         uint16_t version:2;
00055         uint16_t padbit:1;
00056         uint16_t rc:5;
00057         uint16_t packet_type:8;
00058 #else
00059         uint16_t rc:5;
00060         uint16_t padbit:1;
00061         uint16_t version:2;
00062         uint16_t packet_type:8;
00063 #endif
00064         uint16_t length:16;
00065 } rtcp_common_header_t;
00066 
00067 #define rtcp_common_header_set_version(ch,v) (ch)->version=v
00068 #define rtcp_common_header_set_padbit(ch,p) (ch)->padbit=p
00069 #define rtcp_common_header_set_rc(ch,rc) (ch)->rc=rc
00070 #define rtcp_common_header_set_packet_type(ch,pt) (ch)->packet_type=pt
00071 #define rtcp_common_header_set_length(ch,l)     (ch)->length=htons(l)
00072 
00073 #define rtcp_common_header_get_version(ch) ((ch)->version)
00074 #define rtcp_common_header_get_padbit(ch) ((ch)->padbit)
00075 #define rtcp_common_header_get_rc(ch) ((ch)->rc)
00076 #define rtcp_common_header_get_packet_type(ch) ((ch)->packet_type)
00077 #define rtcp_common_header_get_length(ch)       ntohs((ch)->length)
00078 
00079 
00080 /* SR or RR  packets */
00081 
00082 typedef struct sender_info
00083 {
00084         uint32_t ntp_timestamp_msw;
00085         uint32_t ntp_timestamp_lsw;
00086         uint32_t rtp_timestamp;
00087         uint32_t senders_packet_count;
00088         uint32_t senders_octet_count;
00089 } sender_info_t;
00090 
00091 uint64_t sender_info_get_ntp_timestamp(const sender_info_t *si);
00092 #define sender_info_get_rtp_timestamp(si)       ((si)->rtp_timestamp)
00093 #define sender_info_get_packet_count(si) \
00094         ntohl((si)->senders_packet_count)
00095 #define sender_info_get_octet_count(si) \
00096         ntohl((si)->senders_octet_count)
00097 
00098 
00099 typedef struct report_block
00100 {
00101         uint32_t ssrc;
00102         uint32_t fl_cnpl;/*fraction lost + cumulative number of packet lost*/
00103         uint32_t ext_high_seq_num_rec; /*extended highest sequence number received */
00104         uint32_t interarrival_jitter;
00105         uint32_t lsr; /*last SR */
00106         uint32_t delay_snc_last_sr; /*delay since last sr*/
00107 } report_block_t;
00108 
00109 static ORTP_INLINE uint32_t report_block_get_ssrc(const report_block_t * rb) {
00110         return ntohl(rb->ssrc);
00111 }
00112 static ORTP_INLINE uint32_t report_block_get_high_ext_seq(const report_block_t * rb) {
00113         return ntohl(rb->ext_high_seq_num_rec);
00114 }
00115 static ORTP_INLINE uint32_t report_block_get_interarrival_jitter(const report_block_t * rb) {
00116         return ntohl(rb->interarrival_jitter);
00117 }
00118 
00119 static ORTP_INLINE uint32_t report_block_get_last_SR_time(const report_block_t * rb) {
00120         return ntohl(rb->lsr);
00121 }
00122 static ORTP_INLINE uint32_t report_block_get_last_SR_delay(const report_block_t * rb) {
00123         return ntohl(rb->delay_snc_last_sr);
00124 }
00125 static ORTP_INLINE uint32_t report_block_get_fraction_lost(const report_block_t * rb) {
00126         return (ntohl(rb->fl_cnpl)>>24);
00127 }
00128 static ORTP_INLINE int32_t report_block_get_cum_packet_lost(const report_block_t * rb){
00129         int cum_loss = ntohl(rb->fl_cnpl);
00130         if (((cum_loss>>23)&1)==0)
00131                 return 0x00FFFFFF & cum_loss;
00132         else
00133                 return 0xFF000000 | (cum_loss-0xFFFFFF-1);
00134 }
00135 
00136 static ORTP_INLINE void report_block_set_fraction_lost(report_block_t * rb, int fl){
00137         rb->fl_cnpl = htonl( (ntohl(rb->fl_cnpl) & 0xFFFFFF) | (fl&0xFF)<<24);
00138 }
00139 
00140 static ORTP_INLINE void report_block_set_cum_packet_lost(report_block_t * rb, int64_t cpl) {
00141         uint32_t clamp = (uint32_t)((1<<24) + ((cpl>=0) ? (cpl>0x7FFFFF?0x7FFFFF:cpl) : (-cpl>0x800000?-0x800000:cpl)));
00142 
00143         rb->fl_cnpl=htonl(
00144                         (ntohl(rb->fl_cnpl) & 0xFF000000) |
00145                         (cpl >= 0 ? clamp&0x7FFFFF : clamp|0x800000)
00146                 );
00147 }
00148 
00149 /* SDES packets */
00150 
00151 typedef enum {
00152         RTCP_SDES_END = 0,
00153         RTCP_SDES_CNAME = 1,
00154         RTCP_SDES_NAME = 2,
00155         RTCP_SDES_EMAIL = 3,
00156         RTCP_SDES_PHONE = 4,
00157         RTCP_SDES_LOC = 5,
00158         RTCP_SDES_TOOL = 6,
00159         RTCP_SDES_NOTE = 7,
00160         RTCP_SDES_PRIV = 8,
00161         RTCP_SDES_MAX = 9
00162 } rtcp_sdes_type_t;
00163 
00164 typedef struct sdes_chunk
00165 {
00166         uint32_t csrc;
00167 } sdes_chunk_t;
00168 
00169 
00170 #define sdes_chunk_get_csrc(c)  ntohl((c)->csrc)
00171 
00172 typedef struct sdes_item
00173 {
00174         uint8_t item_type;
00175         uint8_t len;
00176         char content[1];
00177 } sdes_item_t;
00178 
00179 #define RTCP_SDES_MAX_STRING_SIZE 255
00180 #define RTCP_SDES_ITEM_HEADER_SIZE 2
00181 #define RTCP_SDES_CHUNK_DEFAULT_SIZE 1024
00182 #define RTCP_SDES_CHUNK_HEADER_SIZE (sizeof(sdes_chunk_t))
00183 
00184 /* RTCP bye packet */
00185 
00186 typedef struct rtcp_bye_reason
00187 {
00188         uint8_t len;
00189         char content[1];
00190 } rtcp_bye_reason_t;
00191 
00192 typedef struct rtcp_bye
00193 {
00194         rtcp_common_header_t ch;
00195         uint32_t ssrc[1];  /* the bye may contain several ssrc/csrc */
00196 } rtcp_bye_t;
00197 #define RTCP_BYE_HEADER_SIZE sizeof(rtcp_bye_t)
00198 #define RTCP_BYE_REASON_MAX_STRING_SIZE 255
00199 
00200 
00201 /* RTCP XR packet */
00202 
00203 #define RTCP_XR_VOIP_METRICS_CONFIG_PLC_STD ((1 << 7) | (1 << 6))
00204 #define RTCP_XR_VOIP_METRICS_CONFIG_PLC_ENH (1 << 7)
00205 #define RTCP_XR_VOIP_METRICS_CONFIG_PLC_DIS (1 << 6)
00206 #define RTCP_XR_VOIP_METRICS_CONFIG_PLC_UNS 0
00207 #define RTCP_XR_VOIP_METRICS_CONFIG_JBA_ADA ((1 << 5) | (1 << 4))
00208 #define RTCP_XR_VOIP_METRICS_CONFIG_JBA_NON (1 << 5)
00209 #define RTCP_XR_VOIP_METRICS_CONFIG_JBA_UNK 0
00210 
00211 typedef enum {
00212         RTCP_XR_LOSS_RLE = 1,
00213         RTCP_XR_DUPLICATE_RLE = 2,
00214         RTCP_XR_PACKET_RECEIPT_TIMES = 3,
00215         RTCP_XR_RCVR_RTT = 4,
00216         RTCP_XR_DLRR = 5,
00217         RTCP_XR_STAT_SUMMARY = 6,
00218         RTCP_XR_VOIP_METRICS = 7
00219 } rtcp_xr_block_type_t;
00220 
00221 typedef struct rtcp_xr_header {
00222         rtcp_common_header_t ch;
00223         uint32_t ssrc;
00224 } rtcp_xr_header_t;
00225 
00226 typedef struct rtcp_xr_generic_block_header {
00227         uint8_t bt;
00228         uint8_t flags;
00229         uint16_t length;
00230 } rtcp_xr_generic_block_header_t;
00231 
00232 typedef struct rtcp_xr_rcvr_rtt_report_block {
00233         rtcp_xr_generic_block_header_t bh;
00234         uint32_t ntp_timestamp_msw;
00235         uint32_t ntp_timestamp_lsw;
00236 } rtcp_xr_rcvr_rtt_report_block_t;
00237 
00238 typedef struct rtcp_xr_dlrr_report_subblock {
00239         uint32_t ssrc;
00240         uint32_t lrr;
00241         uint32_t dlrr;
00242 } rtcp_xr_dlrr_report_subblock_t;
00243 
00244 typedef struct rtcp_xr_dlrr_report_block {
00245         rtcp_xr_generic_block_header_t bh;
00246         rtcp_xr_dlrr_report_subblock_t content[1];
00247 } rtcp_xr_dlrr_report_block_t;
00248 
00249 typedef struct rtcp_xr_stat_summary_report_block {
00250         rtcp_xr_generic_block_header_t bh;
00251         uint32_t ssrc;
00252         uint16_t begin_seq;
00253         uint16_t end_seq;
00254         uint32_t lost_packets;
00255         uint32_t dup_packets;
00256         uint32_t min_jitter;
00257         uint32_t max_jitter;
00258         uint32_t mean_jitter;
00259         uint32_t dev_jitter;
00260         uint8_t min_ttl_or_hl;
00261         uint8_t max_ttl_or_hl;
00262         uint8_t mean_ttl_or_hl;
00263         uint8_t dev_ttl_or_hl;
00264 } rtcp_xr_stat_summary_report_block_t;
00265 
00266 typedef struct rtcp_xr_voip_metrics_report_block {
00267         rtcp_xr_generic_block_header_t bh;
00268         uint32_t ssrc;
00269         uint8_t loss_rate;
00270         uint8_t discard_rate;
00271         uint8_t burst_density;
00272         uint8_t gap_density;
00273         uint16_t burst_duration;
00274         uint16_t gap_duration;
00275         uint16_t round_trip_delay;
00276         uint16_t end_system_delay;
00277         uint8_t signal_level;
00278         uint8_t noise_level;
00279         uint8_t rerl;
00280         uint8_t gmin;
00281         uint8_t r_factor;
00282         uint8_t ext_r_factor;
00283         uint8_t mos_lq;
00284         uint8_t mos_cq;
00285         uint8_t rx_config;
00286         uint8_t reserved2;
00287         uint16_t jb_nominal;
00288         uint16_t jb_maximum;
00289         uint16_t jb_abs_max;
00290 } rtcp_xr_voip_metrics_report_block_t;
00291 
00292 #define MIN_RTCP_XR_PACKET_SIZE (sizeof(rtcp_xr_header_t) + 4)
00293 
00294 typedef enum {
00295         RTCP_RTPFB_NACK = 1,
00296         RTCP_RTPFB_TMMBR = 3,
00297         RTCP_RTPFB_TMMBN = 4
00298 } rtcp_rtpfb_type_t;
00299 
00300 typedef enum {
00301         RTCP_PSFB_PLI = 1,
00302         RTCP_PSFB_SLI = 2,
00303         RTCP_PSFB_RPSI = 3,
00304         RTCP_PSFB_FIR = 4,
00305         RTCP_PSFB_AFB = 15
00306 } rtcp_psfb_type_t;
00307 
00308 typedef struct rtcp_fb_header {
00309         uint32_t packet_sender_ssrc;
00310         uint32_t media_source_ssrc;
00311 } rtcp_fb_header_t;
00312 
00313 typedef struct rtcp_fb_generic_nack_fci {
00314         uint16_t pid;
00315         uint16_t blp;
00316 } rtcp_fb_generic_nack_fci_t;
00317 
00318 #define rtcp_fb_generic_nack_fci_get_pid(nack) ntohs((nack)->pid)
00319 #define rtcp_fb_generic_nack_fci_set_pid(nack, value) ((nack)->pid) = htons(value)
00320 #define rtcp_fb_generic_nack_fci_get_blp(nack) ntohs((nack)->blp)
00321 #define rtcp_fb_generic_nack_fci_set_blp(nack, value) ((nack)->blp) = htons(value)
00322 
00323 typedef struct rtcp_fb_tmmbr_fci {
00324         uint32_t ssrc;
00325         uint32_t value;
00326 } rtcp_fb_tmmbr_fci_t;
00327 
00328 #define rtcp_fb_tmmbr_fci_get_ssrc(tmmbr) ntohl((tmmbr)->ssrc)
00329 #define rtcp_fb_tmmbr_fci_get_mxtbr_exp(tmmbr) \
00330         ((uint8_t)((ntohl((tmmbr)->value) >> 26) & 0x0000003F))
00331 #define rtcp_fb_tmmbr_fci_set_mxtbr_exp(tmmbr, mxtbr_exp) \
00332         ((tmmbr)->value) = htonl((ntohl((tmmbr)->value) & 0x03FFFFFF) | (((mxtbr_exp) & 0x0000003F) << 26))
00333 #define rtcp_fb_tmmbr_fci_get_mxtbr_mantissa(tmmbr) \
00334         ((uint32_t)((ntohl((tmmbr)->value) >> 9) & 0x0001FFFF))
00335 #define rtcp_fb_tmmbr_fci_set_mxtbr_mantissa(tmmbr, mxtbr_mantissa) \
00336         ((tmmbr)->value) = htonl((ntohl((tmmbr)->value) & 0xFC0001FF) | (((mxtbr_mantissa) & 0x0001FFFF) << 9))
00337 #define rtcp_fb_tmmbr_fci_get_measured_overhead(tmmbr) \
00338         ((uint16_t)(ntohl((tmmbr)->value) & 0x000001FF))
00339 #define rtcp_fb_tmmbr_fci_set_measured_overhead(tmmbr, measured_overhead) \
00340         ((tmmbr)->value) = htonl((ntohl((tmmbr)->value) & 0xFFFFFE00) | ((measured_overhead) & 0x000001FF))
00341 
00342 typedef struct rtcp_fb_fir_fci {
00343         uint32_t ssrc;
00344         uint8_t seq_nr;
00345         uint8_t pad1;
00346         uint16_t pad2;
00347 } rtcp_fb_fir_fci_t;
00348 
00349 #define rtcp_fb_fir_fci_get_ssrc(fci) ntohl((fci)->ssrc)
00350 #define rtcp_fb_fir_fci_get_seq_nr(fci) (fci)->seq_nr
00351 
00352 typedef struct rtcp_fb_sli_fci {
00353         uint32_t value;
00354 } rtcp_fb_sli_fci_t;
00355 
00356 #define rtcp_fb_sli_fci_get_first(fci) \
00357         ((uint16_t)((ntohl((fci)->value) >> 19) & 0x00001FFF))
00358 #define rtcp_fb_sli_fci_set_first(fci, first) \
00359         ((fci)->value) = htonl((ntohl((fci)->value) & 0x0007FFFF) | (((first) & 0x00001FFF) << 19))
00360 #define rtcp_fb_sli_fci_get_number(fci) \
00361         ((uint16_t)((ntohl((fci)->value) >> 6) & 0x00001FFF))
00362 #define rtcp_fb_sli_fci_set_number(fci, number) \
00363         ((fci)->value) = htonl((ntohl((fci)->value) & 0xFFF8003F) | (((number) & 0x00001FFF) << 6))
00364 #define rtcp_fb_sli_fci_get_picture_id(fci) \
00365         ((uint8_t)(ntohl((fci)->value) & 0x0000003F))
00366 #define rtcp_fb_sli_fci_set_picture_id(fci, picture_id) \
00367         ((fci)->value) = htonl((ntohl((fci)->value) & 0xFFFFFFC0) | ((picture_id) & 0x0000003F))
00368 
00369 typedef struct rtcp_fb_rpsi_fci {
00370         uint8_t pb;
00371         uint8_t payload_type;
00372         uint16_t bit_string[1];
00373 } rtcp_fb_rpsi_fci_t;
00374 
00375 #define rtcp_fb_rpsi_fci_get_payload_type(fci) (fci)->payload_type
00376 #define rtcp_fb_rpsi_fci_get_bit_string(fci) ((uint8_t *)(fci)->bit_string)
00377 
00378 #define MIN_RTCP_PSFB_PACKET_SIZE (sizeof(rtcp_common_header_t) + sizeof(rtcp_fb_header_t))
00379 #define MIN_RTCP_RTPFB_PACKET_SIZE (sizeof(rtcp_common_header_t) + sizeof(rtcp_fb_header_t))
00380 
00381 
00382 
00383 typedef struct rtcp_sr{
00384         rtcp_common_header_t ch;
00385         uint32_t ssrc;
00386         sender_info_t si;
00387         report_block_t rb[1];
00388 } rtcp_sr_t;
00389 
00390 typedef struct rtcp_rr{
00391         rtcp_common_header_t ch;
00392         uint32_t ssrc;
00393         report_block_t rb[1];
00394 } rtcp_rr_t;
00395 
00396 typedef struct rtcp_app{
00397         rtcp_common_header_t ch;
00398         uint32_t ssrc;
00399         char name[4];
00400 } rtcp_app_t;
00401 
00402 struct _RtpSession;
00403 struct _RtpStream;
00404 ORTP_PUBLIC void rtp_session_rtcp_process_send(struct _RtpSession *s);
00405 ORTP_PUBLIC void rtp_session_rtcp_process_recv(struct _RtpSession *s);
00406 
00407 
00408 #define RTCP_DEFAULT_REPORT_INTERVAL 5000 /* in milliseconds */
00409 
00410 
00411 /* packet parsing api */
00412 
00413 /*in case of coumpound packet, set read pointer of m to the beginning of the next RTCP
00414 packet */
00415 ORTP_PUBLIC bool_t rtcp_next_packet(mblk_t *m);
00416 /* put the read pointer at the first RTCP packet of the compound packet (as before any previous calls ot rtcp_next_packet() */
00417 ORTP_PUBLIC void rtcp_rewind(mblk_t *m);
00418 /* get common header*/
00419 ORTP_PUBLIC const rtcp_common_header_t * rtcp_get_common_header(const mblk_t *m);
00420 
00421 /*Sender Report accessors */
00422 /* check if this packet is a SR and if it is correct */
00423 ORTP_PUBLIC bool_t rtcp_is_SR(const mblk_t *m);
00424 ORTP_PUBLIC uint32_t rtcp_SR_get_ssrc(const mblk_t *m);
00425 ORTP_PUBLIC const sender_info_t * rtcp_SR_get_sender_info(const mblk_t *m);
00426 ORTP_PUBLIC const report_block_t * rtcp_SR_get_report_block(const mblk_t *m, int idx);
00427 
00428 /*Receiver report accessors*/
00429 ORTP_PUBLIC bool_t rtcp_is_RR(const mblk_t *m);
00430 ORTP_PUBLIC uint32_t rtcp_RR_get_ssrc(const mblk_t *m);
00431 ORTP_PUBLIC const report_block_t * rtcp_RR_get_report_block(const mblk_t *m,int idx);
00432 
00433 /*SDES accessors */
00434 ORTP_PUBLIC bool_t rtcp_is_SDES(const mblk_t *m);
00435 typedef void (*SdesItemFoundCallback)(void *user_data, uint32_t csrc, rtcp_sdes_type_t t, const char *content, uint8_t content_len);
00436 ORTP_PUBLIC void rtcp_sdes_parse(const mblk_t *m, SdesItemFoundCallback cb, void *user_data);
00437 
00438 /*BYE accessors */
00439 ORTP_PUBLIC bool_t rtcp_is_BYE(const mblk_t *m);
00440 ORTP_PUBLIC bool_t rtcp_BYE_get_ssrc(const mblk_t *m, int idx, uint32_t *ssrc);
00441 ORTP_PUBLIC bool_t rtcp_BYE_get_reason(const mblk_t *m, const char **reason, int *reason_len);
00442 
00443 /*APP accessors */
00444 ORTP_PUBLIC bool_t rtcp_is_APP(const mblk_t *m);
00445 ORTP_PUBLIC int rtcp_APP_get_subtype(const mblk_t *m);
00446 ORTP_PUBLIC uint32_t rtcp_APP_get_ssrc(const mblk_t *m);
00447 /* name argument is supposed to be at least 4 characters (note: no '\0' written)*/
00448 ORTP_PUBLIC void rtcp_APP_get_name(const mblk_t *m, char *name);
00449 /* retrieve the data. when returning, data points directly into the mblk_t */
00450 ORTP_PUBLIC void rtcp_APP_get_data(const mblk_t *m, uint8_t **data, int *len);
00451 
00452 /* RTCP XR accessors */
00453 ORTP_PUBLIC bool_t rtcp_is_XR(const mblk_t *m);
00454 ORTP_PUBLIC rtcp_xr_block_type_t rtcp_XR_get_block_type(const mblk_t *m);
00455 ORTP_PUBLIC uint32_t rtcp_XR_get_ssrc(const mblk_t *m);
00456 ORTP_PUBLIC uint64_t rtcp_XR_rcvr_rtt_get_ntp_timestamp(const mblk_t *m);
00457 ORTP_PUBLIC uint32_t rtcp_XR_dlrr_get_ssrc(const mblk_t *m);
00458 ORTP_PUBLIC uint32_t rtcp_XR_dlrr_get_lrr(const mblk_t *m);
00459 ORTP_PUBLIC uint32_t rtcp_XR_dlrr_get_dlrr(const mblk_t *m);
00460 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_flags(const mblk_t *m);
00461 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_ssrc(const mblk_t *m);
00462 ORTP_PUBLIC uint16_t rtcp_XR_stat_summary_get_begin_seq(const mblk_t *m);
00463 ORTP_PUBLIC uint16_t rtcp_XR_stat_summary_get_end_seq(const mblk_t *m);
00464 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_lost_packets(const mblk_t *m);
00465 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_dup_packets(const mblk_t *m);
00466 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_min_jitter(const mblk_t *m);
00467 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_max_jitter(const mblk_t *m);
00468 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_mean_jitter(const mblk_t *m);
00469 ORTP_PUBLIC uint32_t rtcp_XR_stat_summary_get_dev_jitter(const mblk_t *m);
00470 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_min_ttl_or_hl(const mblk_t *m);
00471 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_max_ttl_or_hl(const mblk_t *m);
00472 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_mean_ttl_or_hl(const mblk_t *m);
00473 ORTP_PUBLIC uint8_t rtcp_XR_stat_summary_get_dev_ttl_or_hl(const mblk_t *m);
00474 ORTP_PUBLIC uint32_t rtcp_XR_voip_metrics_get_ssrc(const mblk_t *m);
00475 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_loss_rate(const mblk_t *m);
00476 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_discard_rate(const mblk_t *m);
00477 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_burst_density(const mblk_t *m);
00478 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_gap_density(const mblk_t *m);
00479 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_burst_duration(const mblk_t *m);
00480 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_gap_duration(const mblk_t *m);
00481 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_round_trip_delay(const mblk_t *m);
00482 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_end_system_delay(const mblk_t *m);
00483 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_signal_level(const mblk_t *m);
00484 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_noise_level(const mblk_t *m);
00485 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_rerl(const mblk_t *m);
00486 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_gmin(const mblk_t *m);
00487 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_r_factor(const mblk_t *m);
00488 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_ext_r_factor(const mblk_t *m);
00489 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_mos_lq(const mblk_t *m);
00490 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_mos_cq(const mblk_t *m);
00491 ORTP_PUBLIC uint8_t rtcp_XR_voip_metrics_get_rx_config(const mblk_t *m);
00492 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_jb_nominal(const mblk_t *m);
00493 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_jb_maximum(const mblk_t *m);
00494 ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_jb_abs_max(const mblk_t *m);
00495 
00496 /* RTCP RTPFB accessors */
00497 ORTP_PUBLIC bool_t rtcp_is_RTPFB(const mblk_t *m);
00498 ORTP_PUBLIC rtcp_rtpfb_type_t rtcp_RTPFB_get_type(const mblk_t *m);
00499 ORTP_PUBLIC rtcp_fb_generic_nack_fci_t * rtcp_RTPFB_generic_nack_get_fci(const mblk_t *m);
00500 ORTP_PUBLIC rtcp_fb_tmmbr_fci_t * rtcp_RTPFB_tmmbr_get_fci(const mblk_t *m);
00501 ORTP_PUBLIC uint32_t rtcp_RTPFB_get_packet_sender_ssrc(const mblk_t *m);
00502 ORTP_PUBLIC uint32_t rtcp_RTPFB_get_media_source_ssrc(const mblk_t *m);
00503 
00504 /* RTCP PSFB accessors */
00505 ORTP_PUBLIC bool_t rtcp_is_PSFB(const mblk_t *m);
00506 ORTP_PUBLIC rtcp_psfb_type_t rtcp_PSFB_get_type(const mblk_t *m);
00507 ORTP_PUBLIC uint32_t rtcp_PSFB_get_packet_sender_ssrc(const mblk_t *m);
00508 ORTP_PUBLIC uint32_t rtcp_PSFB_get_media_source_ssrc(const mblk_t *m);
00509 ORTP_PUBLIC rtcp_fb_fir_fci_t * rtcp_PSFB_fir_get_fci(const mblk_t *m, unsigned int idx);
00510 ORTP_PUBLIC rtcp_fb_sli_fci_t * rtcp_PSFB_sli_get_fci(const mblk_t *m, unsigned int idx);
00511 ORTP_PUBLIC rtcp_fb_rpsi_fci_t * rtcp_PSFB_rpsi_get_fci(const mblk_t *m);
00512 ORTP_PUBLIC uint16_t rtcp_PSFB_rpsi_get_fci_bit_string_len(const mblk_t *m);
00513 
00514 
00515 typedef struct OrtpLossRateEstimator{
00516         int min_packet_count_interval;
00517         uint64_t min_time_ms_interval;
00518         uint64_t last_estimate_time_ms;
00519         int32_t last_cum_loss;
00520         int32_t last_ext_seq;
00521         float loss_rate;
00526         int32_t last_dup_packet_sent_count;
00531         int32_t last_packet_sent_count;
00532 }OrtpLossRateEstimator;
00533 
00534 
00535 ORTP_PUBLIC OrtpLossRateEstimator * ortp_loss_rate_estimator_new(int min_packet_count_interval, uint64_t min_time_ms_interval, struct _RtpSession *session);
00536 
00537 ORTP_PUBLIC void ortp_loss_rate_estimator_init(OrtpLossRateEstimator *obj, int min_packet_count_interval, uint64_t min_time_ms_interval, struct _RtpSession *session);
00538 
00539 
00555 ORTP_PUBLIC bool_t ortp_loss_rate_estimator_process_report_block(OrtpLossRateEstimator *obj,
00556                                                                                                                                  const struct _RtpStream *stream,
00557                                                                                                                                  const report_block_t *rb);
00564 ORTP_PUBLIC float ortp_loss_rate_estimator_get_value(OrtpLossRateEstimator *obj);
00565 
00566 ORTP_PUBLIC void ortp_loss_rate_estimator_uninit(OrtpLossRateEstimator *obj);
00567 
00568 ORTP_PUBLIC void ortp_loss_rate_estimator_destroy(OrtpLossRateEstimator *obj);
00569 
00570 #ifdef __cplusplus
00571 }
00572 #endif
00573 
00574 #endif