34 #include <ortp/port.h>
39 #include <ortp/rtcp.h>
40 #include <ortp/str_utils.h>
41 #include <ortp/rtpsignaltable.h>
42 #include <ortp/event.h>
69 int adapt_jitt_comp_ts;
77 uint64_t cum_jitter_buffer_size;
78 unsigned int cum_jitter_buffer_count;
96 int (*t_sendto)(
struct _RtpTransport *t,
mblk_t *msg ,
int flags,
const struct sockaddr *to, socklen_t tolen);
97 int (*t_recvfrom)(
struct _RtpTransport *t,
mblk_t *msg,
int flags,
struct sockaddr *from, socklen_t *fromlen);
99 void (*t_close)(
struct _RtpTransport *transport,
void *userData);
113 struct timeval last_check;
118 ortp_socket_t socket;
129 struct sockaddr_storage rem_addr;
131 struct sockaddr_in rem_addr;
135 unsigned long QoSFlowID;
137 uint32_t snd_time_offset;
138 uint32_t snd_ts_offset;
139 uint32_t snd_rand_offset;
140 uint32_t snd_last_ts;
141 uint32_t rcv_time_offset;
142 uint32_t rcv_ts_offset;
143 uint32_t rcv_query_ts_offset;
144 uint32_t rcv_last_ts;
145 uint32_t rcv_last_app_ts;
146 uint32_t rcv_last_ret_ts;
147 uint32_t hwrcv_extseq;
148 uint32_t hwrcv_seq_at_last_SR;
149 uint32_t hwrcv_since_last_SR;
150 uint32_t last_rcv_SR_ts;
151 struct timeval last_rcv_SR_time;
153 uint32_t last_rtcp_packet_count;
154 uint32_t sent_payload_bytes;
155 unsigned int sent_bytes;
156 struct timeval send_bw_start;
157 unsigned int recv_bytes;
158 struct timeval recv_bw_start;
164 int ssrc_changed_thres;
170 ortp_socket_t socket;
176 struct sockaddr_storage rem_addr;
178 struct sockaddr_in rem_addr;
182 uint32_t last_rtcp_report_snt_r;
183 uint32_t last_rtcp_report_snt_s;
184 uint32_t rtcp_report_snt_interval_r;
185 uint32_t rtcp_report_snt_interval_s;
209 int telephone_events_pt;
211 unsigned int inc_ssrc_candidate;
212 int inc_same_ssrc_count;
222 struct _OList *signal_tables;
232 int multicast_loopback;
235 struct timeval last_recv_time;
241 unsigned int lost_packets_test_vector;
242 unsigned int interarrival_jitter_test_vector;
243 unsigned int delay_test_vector;
246 bool_t symmetric_rtp;
280 ORTP_PUBLIC
void rtp_session_enable_jitter_buffer(
RtpSession *session , bool_t enabled);
281 ORTP_PUBLIC bool_t rtp_session_jitter_buffer_enabled(
const RtpSession *session);
287 ORTP_PUBLIC
void rtp_session_enable_adaptive_jitter_compensation(
RtpSession *session, bool_t val);
288 ORTP_PUBLIC bool_t rtp_session_adaptive_jitter_compensation_enabled(
RtpSession *session);
297 ORTP_PUBLIC
int rtp_session_set_remote_addr_and_port (
RtpSession * session,
const char * addr,
int rtp_port,
int rtcp_port);
301 ORTP_PUBLIC
void rtp_session_set_sockets(
RtpSession *session,
int rtpfd,
int rtcpfd);
305 ORTP_PUBLIC ortp_socket_t rtp_session_get_rtp_socket(
const RtpSession *session);
306 ORTP_PUBLIC ortp_socket_t rtp_session_get_rtcp_socket(
const RtpSession *session);
360 ORTP_PUBLIC
float rtp_session_compute_send_bandwidth(
RtpSession *session);
361 ORTP_PUBLIC
float rtp_session_compute_recv_bandwidth(
RtpSession *session);
363 ORTP_PUBLIC
void rtp_session_send_rtcp_APP(
RtpSession *session, uint8_t subtype,
const char *name,
const uint8_t *data,
int datalen);
375 ORTP_PUBLIC
void rtp_session_reset_stats(
RtpSession *session);
385 ORTP_PUBLIC uint32_t rtp_session_ts_to_time(
RtpSession *session,uint32_t timestamp);
386 ORTP_PUBLIC uint32_t rtp_session_time_to_ts(
RtpSession *session,
int millisecs);
390 ORTP_PUBLIC
void rtp_session_make_time_distorsion(
RtpSession *session,
int milisec);
394 const char *name,
const char *email,
const char *phone,
395 const char *loc,
const char *tool,
const char *note);
396 ORTP_PUBLIC
void rtp_session_add_contributing_source(
RtpSession *session, uint32_t csrc,
397 const char *cname,
const char *name,
const char *email,
const char *phone,
398 const char *loc,
const char *tool,
const char *note);
399 ORTP_PUBLIC
void rtp_session_remove_contributing_sources(
RtpSession *session, uint32_t csrc);
400 ORTP_PUBLIC
mblk_t* rtp_session_create_rtcp_sdes_packet(
RtpSession *session);
405 ORTP_PUBLIC
int rtp_session_get_last_send_error_code(
RtpSession *session);
406 ORTP_PUBLIC
void rtp_session_clear_send_error_code(
RtpSession *session);
407 ORTP_PUBLIC
int rtp_session_get_last_recv_error_code(
RtpSession *session);
408 ORTP_PUBLIC
void rtp_session_clear_recv_error_code(
RtpSession *session);
420 ORTP_PUBLIC
void rtp_session_init(
RtpSession *session,
int mode);
421 #define rtp_session_set_flag(session,flag) (session)->flags|=(flag)
422 #define rtp_session_unset_flag(session,flag) (session)->flags&=~(flag)
423 ORTP_PUBLIC
void rtp_session_uninit(
RtpSession *session);
426 ORTP_PUBLIC
void rtp_session_set_reuseaddr(
RtpSession *session, bool_t yes);
ORTP_PUBLIC int rtp_session_set_payload_type(RtpSession *session, int pt)
Definition: rtpsession.c:739
ORTP_PUBLIC RtpProfile * rtp_session_get_send_profile(RtpSession *session)
Definition: rtpsession.c:482
ORTP_PUBLIC mblk_t * rtp_session_create_packet_with_data(RtpSession *session, uint8_t *payload, int payload_size, void(*freefn)(void *))
Definition: rtpsession.c:805
Definition: rtpsession.h:168
ORTP_PUBLIC void rtp_session_rtcp_set_delay_value(RtpSession *session, const unsigned int value)
For test purpose only, simulates a constant RTT (Round Trip Time) value by setting the LSR field with...
Definition: rtpsession.c:1582
ORTP_PUBLIC void rtp_session_set_connected_mode(RtpSession *session, bool_t yesno)
Definition: rtpsession.c:1637
ORTP_PUBLIC int rtp_session_get_multicast_ttl(RtpSession *session)
Definition: rtpsession_inet.c:482
ORTP_PUBLIC void rtp_session_rtcp_set_jitter_value(RtpSession *session, const unsigned int value)
For test purpose only, sets a constant interarrival_jitter value within all RTCP output packets...
Definition: rtpsession.c:1556
Definition: rtpsession.h:102
ORTP_PUBLIC uint32_t rtp_session_get_rcv_ext_seq_number(RtpSession *session)
Definition: rtpsession.c:618
int max_packets
Definition: rtpsession.h:61
ORTP_PUBLIC int rtp_session_get_dscp(const RtpSession *session)
Definition: rtpsession_inet.c:690
Definition of payload types.
ORTP_PUBLIC int rtp_session_set_remote_addr_full(RtpSession *session, const char *rtp_addr, int rtp_port, const char *rtcp_addr, int rtcp_port)
Definition: rtpsession_inet.c:760
ORTP_PUBLIC uint32_t rtp_session_get_recv_ssrc(RtpSession *session)
Definition: rtpsession.c:652
Definition: rtpsession.h:200
ORTP_PUBLIC void rtp_session_flush_sockets(RtpSession *session)
Definition: rtpsession_inet.c:918
Definition: str_utils.h:49
ORTP_PUBLIC RtpProfile * rtp_session_get_recv_profile(RtpSession *session)
Definition: rtpsession.c:492
ORTP_PUBLIC uint16_t rtp_session_get_seq_number(RtpSession *session)
Definition: rtpsession.c:611
ORTP_PUBLIC void rtp_session_set_recv_buf_size(RtpSession *session, int bufsize)
Definition: rtpsession.c:504
ORTP_PUBLIC RtpSession * rtp_session_new(int mode)
Definition: rtpsession.c:308
ORTP_PUBLIC mblk_t * rtp_session_recvm_with_ts(RtpSession *session, uint32_t user_ts)
Definition: rtpsession.c:1052
ORTP_PUBLIC int rtp_session_set_multicast_loopback(RtpSession *session, int yesno)
Definition: rtpsession_inet.c:498
Definition: rtpsession.h:116
ORTP_PUBLIC int rtp_session_set_local_addr(RtpSession *session, const char *addr, int rtp_port, int rtcp_port)
Definition: rtpsession_inet.c:308
ORTP_PUBLIC const jitter_stats_t * rtp_session_get_jitter_stats(const RtpSession *session)
Definition: rtpsession.c:1533
ORTP_PUBLIC int rtp_session_set_multicast_ttl(RtpSession *session, int ttl)
Definition: rtpsession_inet.c:428
Definition: rtpsession.h:84
ORTP_PUBLIC int rtp_session_signal_connect(RtpSession *session, const char *signal_name, RtpCallback cb, unsigned long user_data)
Definition: rtpsession.c:558
int min_size
Definition: rtpsession.h:56
ORTP_PUBLIC void rtp_session_destroy(RtpSession *session)
Definition: rtpsession.c:1705
Definition: rtpsignaltable.h:27
ORTP_PUBLIC void rtp_session_set_blocking_mode(RtpSession *session, int yesno)
Definition: rtpsession.c:370
Definition: str_utils.h:75
ORTP_PUBLIC int rtp_session_get_local_port(const RtpSession *session)
Definition: rtpsession_inet.c:706
ORTP_PUBLIC void rtp_session_get_last_recv_time(RtpSession *session, struct timeval *tv)
Definition: rtpsession.c:1796
ORTP_PUBLIC void rtp_session_set_rtp_socket_recv_buffer_size(RtpSession *session, unsigned int size)
Definition: rtpsession.c:520
struct _JBParameters JBParameters
int max_size
Definition: rtpsession.h:58
ORTP_PUBLIC int rtp_session_get_multicast_loopback(RtpSession *session)
Definition: rtpsession_inet.c:558
ORTP_PUBLIC uint32_t rtp_session_get_send_ssrc(RtpSession *session)
Definition: rtpsession.c:642
ORTP_PUBLIC void rtp_session_set_time_jump_limit(RtpSession *session, int miliseconds)
Definition: rtpsession.c:1342
Definition: rtpsession.h:108
ORTP_PUBLIC int rtp_session_recv_with_ts(RtpSession *session, uint8_t *buffer, int len, uint32_t ts, int *have_more)
Definition: rtpsession.c:1241
ORTP_PUBLIC void rtp_session_set_ssrc_changed_threshold(RtpSession *session, int numpackets)
Definition: rtpsession.c:1475
Definition: rtpsession.h:92
ORTP_PUBLIC mblk_t * rtp_session_pick_with_cseq(RtpSession *session, const uint16_t sequence_number)
Definition: rtpsession.c:1009
ORTP_PUBLIC void rtp_session_set_recv_profile(RtpSession *session, RtpProfile *profile)
Definition: rtpsession.c:458
ORTP_PUBLIC void rtp_session_reset(RtpSession *session)
Definition: rtpsession.c:1498
ORTP_PUBLIC int rtp_session_set_pktinfo(RtpSession *session, int activate)
Definition: rtpsession_inet.c:366
ORTP_PUBLIC void rtp_session_set_seq_number(RtpSession *session, uint16_t seq)
Definition: rtpsession.c:603
ORTP_PUBLIC int rtp_session_send_with_ts(RtpSession *session, const uint8_t *buffer, int len, uint32_t userts)
Definition: rtpsession.c:968
ORTP_PUBLIC int rtp_session_set_recv_payload_type(RtpSession *session, int pt)
Definition: rtpsession.c:709
ORTP_PUBLIC mblk_t * rtp_session_create_packet_in_place(RtpSession *session, uint8_t *buffer, int size, void(*freefn)(void *))
Definition: rtpsession.c:837
ORTP_PUBLIC void rtp_session_set_send_profile(RtpSession *session, RtpProfile *profile)
Definition: rtpsession.c:440
Definition: rtpsession.h:55
ORTP_PUBLIC void rtp_session_set_source_description(RtpSession *session, const char *cname, const char *name, const char *email, const char *phone, const char *loc, const char *tool, const char *note)
Definition: rtcp.c:86
int nom_size
Definition: rtpsession.h:57
ORTP_PUBLIC void rtp_session_set_data(RtpSession *session, void *data)
Definition: rtpsession.c:1597
Definition: str_utils.h:149
ORTP_PUBLIC void rtp_session_set_symmetric_rtp(RtpSession *session, bool_t yesno)
Definition: rtpsession.c:1619
Definition: scheduler.h:28
ORTP_PUBLIC void rtp_session_set_rtp_socket_send_buffer_size(RtpSession *session, unsigned int size)
Definition: rtpsession.c:512
ORTP_PUBLIC void rtp_session_set_profile(RtpSession *session, RtpProfile *profile)
Definition: rtpsession.c:389
ORTP_PUBLIC void rtp_session_rtcp_set_lost_packet_value(RtpSession *session, const unsigned int value)
For test purpose only, sets a constant lost packet value within all RTCP output packets. .
Definition: rtpsession.c:1544
ORTP_PUBLIC void rtp_session_enable_rtcp(RtpSession *session, bool_t yesno)
Definition: rtpsession.c:404
ORTP_PUBLIC RtpProfile * rtp_session_get_profile(RtpSession *session)
Definition: rtpsession.c:471
ORTP_PUBLIC const rtp_stats_t * rtp_session_get_stats(const RtpSession *session)
Definition: rtpsession.c:1526
ORTP_PUBLIC uint32_t rtp_session_get_current_recv_ts(RtpSession *session)
Definition: rtpsession.c:1315
ORTP_PUBLIC int rtp_session_set_send_payload_type(RtpSession *session, int paytype)
Definition: rtpsession.c:682
Sending and receiving multiple streams together with only one thread.
ORTP_PUBLIC void rtp_session_release_sockets(RtpSession *session)
Definition: rtpsession.c:1353
ORTP_PUBLIC int rtp_session_signal_disconnect_by_callback(RtpSession *session, const char *signal_name, RtpCallback cb)
Definition: rtpsession.c:582
ORTP_PUBLIC void rtp_session_set_ssrc(RtpSession *session, uint32_t ssrc)
Definition: rtpsession.c:631
ORTP_PUBLIC int rtp_session_get_recv_payload_type(const RtpSession *session)
Definition: rtpsession.c:726
ORTP_PUBLIC float rtp_session_get_round_trip_propagation(RtpSession *session)
Definition: rtpsession.c:1695
Using and creating standart and custom RTP profiles.
ORTP_PUBLIC int rtp_session_get_send_payload_type(const RtpSession *session)
Definition: rtpsession.c:693
Definition: rtpprofile.h:41
ORTP_PUBLIC int rtp_session_set_dscp(RtpSession *session, int dscp)
Definition: rtpsession_inet.c:573
Definition: rtpsession.h:64
ORTP_PUBLIC mblk_t * rtp_session_create_packet(RtpSession *session, int header_size, const uint8_t *payload, int payload_size)
Definition: rtpsession.c:771
ORTP_PUBLIC int rtp_session_bye(RtpSession *session, const char *reason)
Definition: rtcp.c:452
ORTP_PUBLIC void rtp_session_set_scheduling_mode(RtpSession *session, int yesno)
Definition: rtpsession.c:335
ORTP_PUBLIC void rtp_session_set_jitter_compensation(RtpSession *session, int milisec)
Definition: jitterctl.c:164
ORTP_PUBLIC int rtp_session_set_remote_addr(RtpSession *session, const char *addr, int port)
Definition: rtpsession_inet.c:740
ORTP_PUBLIC int rtp_session_sendm_with_ts(RtpSession *session, mblk_t *mp, uint32_t userts)
Definition: rtpsession.c:948
ORTP_PUBLIC void * rtp_session_get_data(const RtpSession *session)
Definition: rtpsession.c:1605
ORTP_PUBLIC void rtp_session_register_event_queue(RtpSession *session, OrtpEvQueue *q)
Definition: rtpsession.c:1385
ORTP_PUBLIC void rtp_session_resync(RtpSession *session)
Definition: rtpsession.c:1485
ORTP_PUBLIC uint32_t rtp_session_get_current_send_ts(RtpSession *session)
Definition: rtpsession.c:1289
ORTP_PUBLIC void rtp_session_set_rtcp_report_interval(RtpSession *session, int value_ms)
Definition: rtpsession.c:412