23 #include <ortp/port.h>
25 #define RTCP_MAX_RECV_BUFSIZE 1500
27 #define RTCP_SENDER_INFO_SIZE 20
28 #define RTCP_REPORT_BLOCK_SIZE 24
29 #define RTCP_XREPORT_BLOCK_SIZE 4
30 #define RTCP_COMMON_HEADER_SIZE 4
31 #define RTCP_SSRC_FIELD_SIZE 4
55 uint16_t packet_type : 8;
60 uint16_t packet_type : 8;
65 #define rtcp_common_header_set_version(ch, v) (ch)->version = v
66 #define rtcp_common_header_set_padbit(ch, p) (ch)->padbit = p
67 #define rtcp_common_header_set_rc(ch, rc) (ch)->rc = rc
68 #define rtcp_common_header_set_packet_type(ch, pt) (ch)->packet_type = pt
69 #define rtcp_common_header_set_length(ch, l) (ch)->length = htons(l)
71 #define rtcp_common_header_get_version(ch) ((ch)->version)
72 #define rtcp_common_header_get padbit(ch)((ch)->padbit)
73 #define rtcp_common_header_get_rc(ch) ((ch)->rc)
74 #define rtcp_common_header_get_packet_type(ch) ((ch)->packet_type)
75 #define rtcp_common_header_get_length(ch) ntohs((ch)->length)
80 uint32_t ntp_timestamp_msw;
81 uint32_t ntp_timestamp_lsw;
82 uint32_t rtp_timestamp;
83 uint32_t senders_packet_count;
84 uint32_t senders_octet_count;
87 uint64_t sender_info_get_ntp_timestamp(
const sender_info_t *si);
88 #define sender_info_get_rtp_timestamp(si) ((si)->rtp_timestamp)
89 #define sender_info_get_packet_count(si) ntohl((si)->senders_packet_count)
90 #define sender_info_get_octet_count(si) ntohl((si)->senders_octet_count)
95 uint32_t ext_high_seq_num_rec;
96 uint32_t interarrival_jitter;
98 uint32_t delay_snc_last_sr;
101 #define report_block_get_ssrc(rb) ntohl((rb)->ssrc)
102 #define report_block_get_fraction_lost(rb) (((uint32_t) ntohl((rb)->fl_cnpl)) >> 24)
103 #define report_block_get_cum_packet_loss(rb) (((uint32_t) ntohl((rb)->fl_cnpl)) & 0xFFFFFF)
104 #define report_block_get_high_ext_seq(rb) ntohl(((report_block_t *) (rb))->ext_high_seq_num_rec)
105 #define report_block_get_interarrival_jitter(rb) ntohl(((report_block_t *) (rb))->interarrival_jitter)
106 #define report_block_get_last_SR_time(rb) ntohl(((report_block_t *) (rb))->lsr)
107 #define report_block_get_last_SR_delay(rb) ntohl(((report_block_t *) (rb))->delay_snc_last_sr)
109 #define report_block_set_fraction_lost(rb, fl) ((rb)->fl_cnpl) = htonl((ntohl((rb)->fl_cnpl) & 0xFFFFFF) | (((fl) &0xFF) << 24))
111 #define report_block_set_cum_packet_lost(rb, cpl) ((rb)->fl_cnpl) = htonl((ntohl((rb)->fl_cnpl) & 0xFF000000) | (((cpl) &0xFFFFFF)))
115 typedef enum { RTCP_SDES_END = 0, RTCP_SDES_CNAME = 1, RTCP_SDES_NAME = 2, RTCP_SDES_EMAIL = 3, RTCP_SDES_PHONE = 4, RTCP_SDES_LOC = 5, RTCP_SDES_TOOL = 6, RTCP_SDES_NOTE = 7, RTCP_SDES_PRIV = 8, RTCP_SDES_MAX = 9 } rtcp_sdes_type_t;
121 #define sdes_chunk_get_csrc(c) ntohl((c)->csrc)
129 #define RTCP_SDES_MAX_STRING_SIZE 255
130 #define RTCP_SDES_ITEM_HEADER_SIZE 2
131 #define RTCP_SDES_CHUNK_DEFAULT_SIZE 1024
132 #define RTCP_SDES_CHUNK_HEADER_SIZE (sizeof(sdes_chunk_t))
145 #define RTCP_BYE_HEADER_SIZE sizeof(rtcp_bye_t)
146 #define RTCP_BYE_REASON_MAX_STRING_SIZE 255
168 #define RTCP_XR_LRLE 1
169 #define RTCP_XR_DRLE 2
170 #define RTCP_XR_PRT 3
172 #define RTCP_XR_DLRR 5
175 #define RTCP_XR_DM 16
178 #define RTCP_XR_DJB 23
181 uint32_t ntp_timestamp_msw;
182 uint32_t ntp_timestamp_lsw;
188 uint32_t delaysince_last_rr;
196 uint32_t lost_packets;
197 uint32_t dup_packets;
200 uint32_t mean_jitter;
202 uint8_t min_ttl_or_hl;
203 uint8_t max_ttl_or_hl;
204 uint8_t mean_ttl_or_hl;
205 uint8_t dev_ttl_or_hl;
211 uint8_t discard_rate;
212 uint8_t burst_density;
214 uint16_t burst_duration;
215 uint16_t gap_duration;
216 uint16_t round_trip_delay;
217 uint16_t end_system_delay;
218 uint8_t signal_level;
223 uint8_t ext_R_factor;
235 uint16_t djb_nominal;
236 uint16_t djb_maximum;
237 uint16_t djb_highwater_mark;
238 uint16_t djb_lowwater_mark;
243 uint8_t type_specific : 8;
244 uint16_t block_len : 16;
255 uint32_t ssrc_sender;
260 void rtp_session_rtcp_process_send(
struct _RtpSession *s);
261 void rtp_session_rtcp_process_recv(
struct _RtpSession *s);
263 #define RTCP_DEFAULT_REPORT_INTERVAL 5
264 #define RTCP_DEFAULT_REPORT_INTERVAL_VIDEO 1
270 bool_t rtcp_next_packet(
mblk_t *m);
272 void rtcp_rewind(
mblk_t *m);
278 bool_t rtcp_is_SR(
const mblk_t *m);
279 uint32_t rtcp_SR_get_ssrc(
const mblk_t *m);
284 bool_t rtcp_is_RR(
const mblk_t *m);
285 uint32_t rtcp_RR_get_ssrc(
const mblk_t *m);
289 bool_t rtcp_is_SDES(
const mblk_t *m);
290 typedef void (*SdesItemFoundCallback)(
void *user_data, uint32_t csrc, rtcp_sdes_type_t t,
const char *content, uint8_t content_len);
291 void rtcp_sdes_parse(
const mblk_t *m, SdesItemFoundCallback cb,
void *user_data);
294 bool_t rtcp_is_BYE(
const mblk_t *m);
295 bool_t rtcp_BYE_get_ssrc(
const mblk_t *m,
int idx, uint32_t *ssrc);
296 bool_t rtcp_BYE_get_reason(
const mblk_t *m,
const char **reason,
int *reason_len);
299 bool_t rtcp_is_APP(
const mblk_t *m);
300 int rtcp_APP_get_subtype(
const mblk_t *m);
301 uint32_t rtcp_APP_get_ssrc(
const mblk_t *m);
303 void rtcp_APP_get_name(
const mblk_t *m,
char *name);
305 void rtcp_APP_get_data(
const mblk_t *m, uint8_t **data,
int *len);
307 bool_t rtcp_is_RTPFB(
const mblk_t *m);
308 bool_t rtcp_is_PSFB(
const mblk_t *m);
Definition: rtpsession.h:261
Definition: str_utils.h:25