34 #include <ortp/port.h>
38 #include <ortp/rtcp.h>
39 #include <ortp/str_utils.h>
40 #include <ortp/rtpsignaltable.h>
41 #include <ortp/event.h>
68 int adapt_jitt_comp_ts;
92 int (*t_sendto)(
struct _RtpTransport *t,
mblk_t *msg ,
int flags,
const struct sockaddr *to, socklen_t tolen);
93 int (*t_recvfrom)(
struct _RtpTransport *t,
mblk_t *msg,
int flags,
struct sockaddr *from, socklen_t *fromlen);
95 void (*t_close)(
struct _RtpTransport *transport,
void *userData);
109 struct timeval last_check;
114 ortp_socket_t socket;
125 struct sockaddr_storage rem_addr;
127 struct sockaddr_in rem_addr;
131 unsigned long QoSFlowID;
133 uint32_t snd_time_offset;
134 uint32_t snd_ts_offset;
135 uint32_t snd_rand_offset;
136 uint32_t snd_last_ts;
137 uint32_t rcv_time_offset;
138 uint32_t rcv_ts_offset;
139 uint32_t rcv_query_ts_offset;
140 uint32_t rcv_last_ts;
141 uint32_t rcv_last_app_ts;
142 uint32_t rcv_last_ret_ts;
143 uint32_t hwrcv_extseq;
144 uint32_t hwrcv_seq_at_last_SR;
145 uint32_t hwrcv_since_last_SR;
146 uint32_t last_rcv_SR_ts;
147 struct timeval last_rcv_SR_time;
149 uint32_t last_rtcp_packet_count;
150 uint32_t sent_payload_bytes;
151 unsigned int sent_bytes;
152 struct timeval send_bw_start;
153 unsigned int recv_bytes;
154 struct timeval recv_bw_start;
160 int ssrc_changed_thres;
166 ortp_socket_t socket;
171 struct sockaddr_storage rem_addr;
173 struct sockaddr_in rem_addr;
177 uint32_t last_rtcp_report_snt_r;
178 uint32_t last_rtcp_report_snt_s;
179 uint32_t rtcp_report_snt_interval_r;
180 uint32_t rtcp_report_snt_interval_s;
204 int telephone_events_pt;
206 unsigned int inc_ssrc_candidate;
207 int inc_same_ssrc_count;
217 struct _OList *signal_tables;
227 int multicast_loopback;
230 struct timeval last_recv_time;
236 unsigned int lost_packets_test_vector;
237 unsigned int interarrival_jitter_test_vector;
238 unsigned int delay_test_vector;
241 bool_t symmetric_rtp;
257 void rtp_session_set_scheduling_mode(
RtpSession *session,
int yesno);
258 void rtp_session_set_blocking_mode(
RtpSession *session,
int yesno);
265 int rtp_session_signal_connect(
RtpSession *session,
const char *signal_name, RtpCallback cb,
unsigned long user_data);
266 int rtp_session_signal_disconnect_by_callback(
RtpSession *session,
const char *signal_name, RtpCallback cb);
267 void rtp_session_set_ssrc(
RtpSession *session, uint32_t ssrc);
268 uint32_t rtp_session_get_send_ssrc(
RtpSession* session);
269 void rtp_session_set_seq_number(
RtpSession *session, uint16_t seq);
270 uint16_t rtp_session_get_seq_number(
RtpSession *session);
272 void rtp_session_enable_jitter_buffer(
RtpSession *session , bool_t enabled);
273 bool_t rtp_session_jitter_buffer_enabled(
const RtpSession *session);
278 void rtp_session_set_jitter_compensation(
RtpSession *session,
int milisec);
279 void rtp_session_enable_adaptive_jitter_compensation(
RtpSession *session, bool_t val);
280 bool_t rtp_session_adaptive_jitter_compensation_enabled(
RtpSession *session);
282 void rtp_session_set_time_jump_limit(
RtpSession *session,
int miliseconds);
283 int rtp_session_set_local_addr(
RtpSession *session,
const char *addr,
int port);
284 int rtp_session_get_local_port(
const RtpSession *session);
287 rtp_session_set_remote_addr_full (
RtpSession * session,
const char * addr,
int rtp_port,
int rtcp_port);
289 int rtp_session_set_remote_addr_and_port (
RtpSession * session,
const char * addr,
int rtp_port,
int rtcp_port);
290 int rtp_session_set_remote_addr(
RtpSession *session,
const char *addr,
int port);
293 void rtp_session_set_sockets(
RtpSession *session,
int rtpfd,
int rtcpfd);
297 ortp_socket_t rtp_session_get_rtp_socket(
const RtpSession *session);
298 ortp_socket_t rtp_session_get_rtcp_socket(
const RtpSession *session);
302 int rtp_session_set_dscp(
RtpSession *session,
int dscp);
303 int rtp_session_get_dscp(
const RtpSession *session);
307 int rtp_session_set_multicast_ttl(
RtpSession *session,
int ttl);
308 int rtp_session_get_multicast_ttl(
RtpSession *session);
310 int rtp_session_set_multicast_loopback(
RtpSession *session,
int yesno);
311 int rtp_session_get_multicast_loopback(
RtpSession *session);
315 int rtp_session_set_send_payload_type(
RtpSession *session,
int paytype);
316 int rtp_session_get_send_payload_type(
const RtpSession *session);
318 int rtp_session_get_recv_payload_type(
const RtpSession *session);
319 int rtp_session_set_recv_payload_type(
RtpSession *session,
int pt);
321 int rtp_session_set_payload_type(
RtpSession *session,
int pt);
323 void rtp_session_set_symmetric_rtp (
RtpSession * session, bool_t yesno);
325 void rtp_session_set_connected_mode(
RtpSession *session, bool_t yesno);
327 void rtp_session_enable_rtcp(
RtpSession *session, bool_t yesno);
329 void rtp_session_set_rtcp_report_interval(
RtpSession *session,
int value_ms);
331 void rtp_session_set_ssrc_changed_threshold(
RtpSession *session,
int numpackets);
334 mblk_t * rtp_session_recvm_with_ts (
RtpSession * session, uint32_t user_ts);
335 mblk_t * rtp_session_create_packet(
RtpSession *session,
int header_size,
const uint8_t *payload,
int payload_size);
336 mblk_t * rtp_session_create_packet_with_data(
RtpSession *session, uint8_t *payload,
int payload_size,
void (*freefn)(
void*));
337 mblk_t * rtp_session_create_packet_in_place(
RtpSession *session,uint8_t *buffer,
int size,
void (*freefn)(
void*) );
338 int rtp_session_sendm_with_ts (
RtpSession * session,
mblk_t *mp, uint32_t userts);
340 int rtp_session_recv_with_ts(
RtpSession *session, uint8_t *buffer,
int len, uint32_t ts,
int *have_more);
341 int rtp_session_send_with_ts(
RtpSession *session,
const uint8_t *buffer,
int len, uint32_t userts);
349 float rtp_session_compute_send_bandwidth(
RtpSession *session);
350 float rtp_session_compute_recv_bandwidth(
RtpSession *session);
352 void rtp_session_send_rtcp_APP(
RtpSession *session, uint8_t subtype,
const char *name,
const uint8_t *data,
int datalen);
354 uint32_t rtp_session_get_current_send_ts(
RtpSession *session);
355 uint32_t rtp_session_get_current_recv_ts(
RtpSession *session);
356 void rtp_session_flush_sockets(
RtpSession *session);
357 void rtp_session_release_sockets(
RtpSession *session);
360 void rtp_session_destroy(
RtpSession *session);
364 void rtp_session_reset_stats(
RtpSession *session);
366 void rtp_session_set_data(
RtpSession *session,
void *data);
367 void *rtp_session_get_data(
const RtpSession *session);
369 void rtp_session_set_recv_buf_size(
RtpSession *session,
int bufsize);
370 void rtp_session_set_rtp_socket_send_buffer_size(
RtpSession * session,
unsigned int size);
371 void rtp_session_set_rtp_socket_recv_buffer_size(
RtpSession * session,
unsigned int size);
374 uint32_t rtp_session_ts_to_time(
RtpSession *session,uint32_t timestamp);
375 uint32_t rtp_session_time_to_ts(
RtpSession *session,
int millisecs);
379 void rtp_session_make_time_distorsion(
RtpSession *session,
int milisec);
382 void rtp_session_set_source_description(
RtpSession *session,
const char *cname,
383 const char *name,
const char *email,
const char *phone,
384 const char *loc,
const char *tool,
const char *note);
385 void rtp_session_add_contributing_source(
RtpSession *session, uint32_t csrc,
386 const char *cname,
const char *name,
const char *email,
const char *phone,
387 const char *loc,
const char *tool,
const char *note);
388 void rtp_session_remove_contributing_sources(
RtpSession *session, uint32_t csrc);
391 void rtp_session_get_last_recv_time(
RtpSession *session,
struct timeval *tv);
392 int rtp_session_bye(
RtpSession *session,
const char *reason);
394 int rtp_session_get_last_send_error_code(
RtpSession *session);
395 void rtp_session_clear_send_error_code(
RtpSession *session);
396 int rtp_session_get_last_recv_error_code(
RtpSession *session);
397 void rtp_session_clear_recv_error_code(
RtpSession *session);
400 float rtp_session_get_round_trip_propagation(
RtpSession *session);
404 void rtp_session_rtcp_set_lost_packet_value(
RtpSession *session,
const unsigned int value );
405 void rtp_session_rtcp_set_jitter_value(
RtpSession *session,
const unsigned int value );
406 void rtp_session_rtcp_set_delay_value(
RtpSession *session,
const unsigned int value );
407 mblk_t * rtp_session_pick_with_cseq (
RtpSession * session,
const uint16_t sequence_number);
409 void rtp_session_init(
RtpSession *session,
int mode);
410 #define rtp_session_set_flag(session,flag) (session)->flags|=(flag)
411 #define rtp_session_unset_flag(session,flag) (session)->flags&=~(flag)