32 #include <ortp/port.h>
35 #include <ortp/rtcp.h>
36 #include <ortp/str_utils.h>
37 #include <ortp/rtpsignaltable.h>
38 #include <ortp/event.h>
40 #include <ortp/stun.h>
41 #include <ortp/turn.h>
43 typedef enum { RTP_SESSION_RECVONLY, RTP_SESSION_SENDONLY, RTP_SESSION_SENDRECV } RtpSessionMode;
45 typedef enum { RTP_SESSION_SETUP_PASSIVE, RTP_SESSION_SETUP_ACTIVE, RTP_SESSION_SETUP_ACTPASS, RTP_SESSION_SETUP_HOLDCONN } RtpSessionSetup;
53 struct timeval *times;
56 uint32_t min_skew_index;
57 uint32_t max_skew_index;
75 int adapt_jitt_comp_ts;
85 float cur_max_late_packet;
94 uint64_t average_buffer_size;
95 int average_buffer_size_count;
97 uint32_t prev_packet_ts;
102 uint32_t final_bytes;
103 uint32_t final_overhead_bytes;
105 uint32_t current_total_bitrate;
106 uint32_t current_overhead_bitrate;
107 uint32_t num_entries;
110 uint16_t *overhead_bytes;
111 struct timeval *times;
113 uint32_t total_bytes;
114 uint32_t total_overhead_bytes;
118 uint32_t recv_overhead_realtime_bytes;
119 uint32_t bitrates_table[20];
120 float bitrates_tables_loss[20];
121 uint32_t previous_tmmbr_value;
122 uint32_t max_bitrate;
126 ortp_socket_t socketv4[10];
136 struct sockaddr_storage rem_addr;
139 unsigned long QoSFlowID;
144 uint32_t snd_last_ts;
155 uint32_t rcv_last_app_ts;
157 uint32_t rcv_last_ts;
158 uint32_t hwrcv_extseq;
159 uint32_t hwrcv_seq_at_last_SR;
160 uint32_t hwrcv_since_last_SR;
161 uint32_t last_rcv_SR_ts;
162 struct timeval last_rcv_SR_time;
165 uint32_t last_rtcp_report_snt_r;
166 uint32_t last_rtcp_report_snt_s;
167 uint32_t rtcp_report_snt_interval;
168 uint32_t last_rtcp_packet_count;
170 uint32_t sent_payload_bytes;
171 unsigned int sent_bytes;
172 struct timeval send_bw_start;
173 unsigned int recv_bytes;
174 struct timeval recv_bw_start;
194 int ssrc_changed_thres;
198 ortp_socket_t socketv4[10];
201 struct sockaddr_storage rem_addr;
204 unsigned int sent_bytes;
205 struct timeval send_bw_start;
206 unsigned int recv_bytes;
207 struct timeval recv_bw_start;
215 struct _tc_qos_ifc *ifc;
220 uint32_t last_rcvr_rtt_ts;
221 struct timeval last_rcvr_rtt_time;
232 uint32_t bitrate_severe_issue;
233 uint32_t bitrate_medium_issue;
234 uint32_t bitrate_minor_issue;
268 int telephone_events_pt;
271 unsigned int inc_ssrc_candidate;
272 int inc_same_ssrc_count;
273 int inc_same_ssrc_new_origin_count;
283 struct _OList *signal_tables;
288 struct _OList *modules_tables;
290 struct _RtpScheduler *sched;
295 int multicast_loopback;
298 struct timeval last_recv_time;
304 bool_t symmetric_rtp;
311 RtpSessionSetup rfc4145_setup;
312 unsigned char remote_fingerprint[64];
315 bool_t rtcpfeedback_pli;
316 bool_t rtcpfeedback_nack;
317 bool_t rtcpfeedback_ccm_tmmbr;
318 bool_t rtcpfeedback_goog_remb;
319 bool_t rtcpxr_voip_metrics;
320 bool_t rtcpxr_send_one_dlrr;
321 uint16_t rtcpfeedback_nack_retransmission;
323 uint16_t rtcpfeedback_nack_retransmission2;
330 struct _OList *rtpExtensions;
340 ortp_thread_t thread;
345 struct ortp_dtls_srtp;
352 void JitterStatistics_init(
JitterStatistics *jt_stats,
int period,
int interval);
353 void JitterStatistics_update(
JitterStatistics *jt_stats,
float skew,
struct timeval *now);
357 void BandwidthStatistics_update(
BandwidthStatistics *bw_stats,
int nbytes,
int nbytes_overhead,
struct timeval *now);
361 void rtp_bundle_destroy(
RtpBundle *bundle);
363 void rtp_bundle_unlock(
RtpBundle *bundle);
366 void rtp_bundle_start(
RtpBundle *bundle);
368 RtpMedia *rtp_media_new(
int session_mode, bool_t use_bundle);
369 void rtp_media_destroy(
RtpMedia *media);
373 void rtp_session_enable_sendrecv(
RtpSession *session);
374 void rtp_session_disable_sendrecv(
RtpSession *session);
375 void rtp_session_set_scheduling_mode(
RtpSession *session,
int yesno);
376 void rtp_session_set_blocking_mode(
RtpSession *session,
int yesno);
383 int rtp_session_signal_connect(
RtpSession *session,
const char *signal_name, RtpCallback cb, uintptr_t user_data);
384 int rtp_session_signal_disconnect_by_callback(
RtpSession *session,
const char *signal_name, RtpCallback cb);
385 void rtp_session_set_ssrc(
RtpSession *session, uint32_t ssrc);
386 void rtp_session_set_recv_ssrc(
RtpSession *session, uint32_t ssrc);
387 void rtp_session_set_seq_number(
RtpSession *session, uint16_t seq);
388 uint16_t rtp_session_get_seq_number(
RtpSession *session);
390 void rtp_session_enable_jitter_buffer(
RtpSession *session, bool_t enabled);
391 bool_t rtp_session_jitter_buffer_enabled(
const RtpSession *session);
394 float rtp_session_get_average_buffer_size(
RtpSession *session);
397 void rtp_session_set_jitter_compensation(
RtpSession *session,
int milisec);
398 void rtp_session_enable_adaptive_jitter_compensation(
RtpSession *session, bool_t val);
399 bool_t rtp_session_adaptive_jitter_compensation_enabled(
RtpSession *session);
401 void rtp_session_set_time_jump_limit(
RtpSession *session,
int miliseconds);
402 int rtp_session_set_local_addr(
RtpSession *session,
int idx,
const char *addr,
int port);
403 int rtp_session_get_local_port(
const RtpSession *session);
405 int rtp_session_set_remote_addr_full(
RtpSession *session,
int idx,
const char *addr,
int rtp_port,
int rtcp_port);
407 int rtp_session_set_remote_addr_and_port(
RtpSession *session,
int idx,
const char *addr,
int rtp_port,
int rtcp_port);
408 int rtp_session_set_remote_addr(
RtpSession *session,
int idx,
const char *addr,
int port);
412 int rtp_session_remove_module(
RtpSession *session,
const char *name);
413 void rtp_session_module_remove_all(
RtpSession *session);
416 int rtp_session_set_dscp(
RtpSession *session,
int idx,
int dscp);
417 int rtp_session_get_dscp(
const RtpSession *session);
420 int rtp_session_set_multicast_ttl(
RtpSession *session,
int idx,
int ttl);
421 int rtp_session_get_multicast_ttl(
RtpSession *session);
423 int rtp_session_set_multicast_loopback(
RtpSession *session,
int idx,
int yesno);
424 int rtp_session_get_multicast_loopback(
RtpSession *session);
426 int rtp_session_set_send_payload_type(
RtpSession *session,
int paytype);
427 int rtp_session_get_send_payload_type(
const RtpSession *session);
429 int rtp_session_get_recv_payload_type(
const RtpSession *session);
430 int rtp_session_set_recv_payload_type(
RtpSession *session,
int pt);
432 int rtp_session_set_payload_type(
RtpSession *session,
int pt);
434 void rtp_session_set_symmetric_rtp(
RtpSession *session, bool_t yesno);
436 void rtp_session_set_rtcp_mux(
RtpSession *session, bool_t yesno);
438 void rtp_session_set_rtcp_rsize(
RtpSession *session, bool_t yesno);
440 void rtp_session_set_rtcp_fb_nack(
RtpSession *session, bool_t yesno);
442 void rtp_session_set_rtcp_fb_pli(
RtpSession *session, bool_t yesno);
444 void rtp_session_set_rtcp_fb_ccm_tmmbr(
RtpSession *session, bool_t yesno);
446 void rtp_session_set_rtcp_fb_goog_remb(
RtpSession *session, bool_t yesno);
448 void rtp_session_set_rtcp_xr_voip_metrics(
RtpSession *session, bool_t yesno);
449 void rtp_session_update_voip_metrics(
RtpSession *session,
int packet_received,
int packet_lost,
int packet_discarded);
451 void rtp_session_enable_rtcp(
RtpSession *session, bool_t yesno);
453 void rtp_session_set_ssrc_changed_threshold(
RtpSession *session,
int numpackets);
458 mblk_t *rtp_session_create_packet(
RtpSession *session,
int header_size,
const uint8_t *payload,
int payload_size);
459 mblk_t *rtp_session_create_packet_with_data(
RtpSession *session, uint8_t *payload,
int payload_size,
void (*freefn)(
void *));
460 mblk_t *rtp_session_create_packet_in_place(
RtpSession *session, uint8_t *buffer,
int size,
void (*freefn)(
void *));
461 int rtp_session_sendm_with_ts(
RtpSession *session,
mblk_t *mp, uint32_t userts);
462 int __rtp_session_sendm_with_ts(
RtpSession *session,
mblk_t *mp, uint32_t packet_ts, uint32_t send_ts);
464 int rtp_session_recv_with_ts(
RtpSession *session, uint8_t *buffer,
int len, uint32_t ts,
int *have_more);
465 int rtp_session_send_with_ts(
RtpSession *session,
const uint8_t *buffer,
int len, uint32_t userts);
486 float rtp_session_compute_send_bandwidth(
RtpSession *session);
487 float rtp_session_compute_recv_bandwidth(
RtpSession *session);
488 float rtp_session_compute_rtcp_recv_bandwidth(
RtpSession *session);
489 float rtp_session_compute_rtcp_send_bandwidth(
RtpSession *session);
490 float rtp_session_compute_average_jitter(
RtpSession *session);
492 void rtp_session_send_rtcp_APP(
RtpSession *session, uint8_t subtype,
const char *name,
const uint8_t *data,
int datalen);
494 uint32_t rtp_session_get_current_send_ts(
RtpSession *session);
495 uint32_t rtp_session_get_current_recv_ts(
RtpSession *session);
496 void rtp_session_flush_sockets(
RtpSession *session);
497 void rtp_session_release_sockets(
RtpSession *session);
500 void rtp_session_destroy(
RtpSession *session);
504 void rtp_session_reset_stats(
RtpSession *session);
506 void rtp_session_set_data(
RtpSession *session,
void *data);
507 void *rtp_session_get_data(
const RtpSession *session);
509 void rtp_session_set_recv_buf_size(
RtpSession *session,
int bufsize);
510 void rtp_session_set_rtp_socket_send_buffer_size(
RtpSession *session,
unsigned int size);
511 void rtp_session_set_rtp_socket_recv_buffer_size(
RtpSession *session,
unsigned int size);
514 uint32_t rtp_session_ts_to_time(
RtpSession *session, uint32_t timestamp);
515 uint32_t rtp_session_time_to_ts(
RtpSession *session,
int millisecs);
519 void rtp_session_make_time_distorsion(
RtpSession *session,
int milisec);
522 int rtp_session_set_max_recv_bitrate(
RtpSession *session, uint32_t max_ccm_bitrate);
525 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);
526 void rtp_session_add_contributing_source(
RtpSession *session, uint32_t csrc,
const char *cname,
const char *name,
const char *email,
const char *phone,
const char *loc,
const char *tool,
const char *note);
527 void rtp_session_remove_contributing_sources(
RtpSession *session, uint32_t csrc);
533 void rtp_session_get_last_recv_time(
RtpSession *session,
struct timeval *tv);
534 int rtp_session_bye(
RtpSession *session,
const char *reason);
536 void rtp_session_send_rtcp_fb_NACK(
RtpSession *session,
const uint16_t cseq,
const uint16_t bits);
537 void rtp_session_send_rtcp_fb_RPSI(
RtpSession *session,
const uint8_t *bitstring,
int bitstring_len);
538 void rtp_session_send_rtcp_fb_PLI(
RtpSession *session);
539 void rtp_session_send_rtcp_fb_TMMB(
RtpSession *session,
const uint8_t subtype,
const uint32_t ssrc,
const uint32_t bitrate,
const uint32_t overhead);
540 void rtp_session_send_rtcp_fb_GOOGREMB(
RtpSession *session,
const uint32_t ssrc,
const uint32_t bitrate);
542 int rtp_session_get_last_send_error_code(
RtpSession *session);
543 void rtp_session_clear_send_error_code(
RtpSession *session);
544 int rtp_session_get_last_recv_error_code(
RtpSession *session);
545 void rtp_session_clear_recv_error_code(
RtpSession *session);
548 void rtp_session_init(
RtpSession *session,
int mode);
549 #define rtp_session_set_flag(session, flag) (session)->flags |= (flag)
550 #define rtp_session_unset_flag(session, flag) (session)->flags &= ~(flag)
555 int rtp_session_add_extension(
RtpSession *session,
char *extmap);
556 void rtp_session_set_recv_sdes_mid(
RtpSession *session,
char *sdes_mid);
557 void rtp_session_set_send_sdes_mid(
RtpSession *session,
char *sdes_mid);
Using and creating standart and custom RTP profiles.
struct _JBParameters JBParameters
Definition: rtpsession.h:101
Definition: rtpsession.h:47
Definition: rtpsession.h:62
int max_size
Definition: rtpsession.h:65
int max_packets
Definition: rtpsession.h:68
int nom_size
Definition: rtpsession.h:64
int min_size
Definition: rtpsession.h:63
Definition: rtpsession.h:71
Definition: rtpsession.h:197
Definition: rtpsession.h:219
Definition: rtpsession.h:338
Definition: rtpsession.h:245
Definition: rtptransport.h:40
Definition: payloadtype.h:84
Definition: rtpsession.h:261
Definition: rtpsignaltable.h:27
Definition: rtpsession.h:125
Definition: rtptransport.h:54
Definition: rtpsession.h:226
Definition: str_utils.h:188
Definition: str_utils.h:47
Definition: rtpsession.h:214
Definition: rtpsession.h:117
Definition: str_utils.h:25