a-oRTP  5.2.0
rtpsession.h
Go to the documentation of this file.
1 /*
2 The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
3 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
4 
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9 
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
29 #ifndef RTPSESSION_H
30 #define RTPSESSION_H
31 
32 #include <ortp/port.h>
33 #include <ortp/rtp.h>
34 #include <ortp/payloadtype.h>
35 #include <ortp/rtcp.h>
36 #include <ortp/str_utils.h>
37 #include <ortp/rtpsignaltable.h>
38 #include <ortp/event.h>
39 #include <ortp/rtptransport.h>
40 #include <ortp/stun.h>
41 #include <ortp/turn.h>
42 
43 typedef enum { RTP_SESSION_RECVONLY, RTP_SESSION_SENDONLY, RTP_SESSION_SENDRECV } RtpSessionMode;
44 
45 typedef enum { RTP_SESSION_SETUP_PASSIVE, RTP_SESSION_SETUP_ACTIVE, RTP_SESSION_SETUP_ACTPASS, RTP_SESSION_SETUP_HOLDCONN } RtpSessionSetup;
46 
47 typedef struct JitterStatistics {
48  uint32_t num_entries;
49  uint16_t period;
50  uint16_t interval;
51  float *min_skews;
52  float *max_skews;
53  struct timeval *times;
54  uint32_t index_last;
55  float total_skews;
56  uint32_t min_skew_index;
57  uint32_t max_skew_index;
59 
62 typedef struct _JBParameters {
63  int min_size;
64  int nom_size;
65  int max_size;
66  bool_t adaptive;
67  bool_t pad[3];
70 
71 typedef struct _JitterControl {
72  int count;
73  int jitt_comp; /* the user jitt_comp in miliseconds*/
74  int jitt_comp_ts; /* the jitt_comp converted in rtp time (same unit as timestamp) */
75  int adapt_jitt_comp_ts;
76  int32_t slide;
77  int32_t prev_slide;
78  float jitter;
79  float max_jitter;
80 
81  JitterStatistics jitter_long_stats;
82  JitterStatistics jitter_stats;
83 
84  int cum_late_packet;
85  float cur_max_late_packet;
86  int32_t olddiff;
87  float inter_jitter; /* interarrival jitter as defined in the RFC */
88  int corrective_step;
89  int corrective_slide;
90  bool_t adaptive;
91  bool_t enabled;
92  int burst_factor;
93  int clock_rate;
94  uint64_t average_buffer_size;
95  int average_buffer_size_count;
96 
97  uint32_t prev_packet_ts;
98  uint32_t prev_app_ts;
100 
101 typedef struct BandwidthStatistics {
102  uint32_t final_bytes;
103  uint32_t final_overhead_bytes;
104 
105  uint32_t current_total_bitrate;
106  uint32_t current_overhead_bitrate;
107  uint32_t num_entries;
108  uint16_t period;
109  uint32_t *bytes; /* updated to contains more than 65535 bytes */
110  uint16_t *overhead_bytes;
111  struct timeval *times;
112  uint32_t index_last;
113  uint32_t total_bytes;
114  uint32_t total_overhead_bytes;
116 
117 struct ccmtmmbr_bitrate_table { /* used for ccm tmmbr */
118  uint32_t recv_overhead_realtime_bytes; /* average per packet overhead */
119  uint32_t bitrates_table[20]; /* average per packet overhead */
120  float bitrates_tables_loss[20];
121  uint32_t previous_tmmbr_value;
122  uint32_t max_bitrate;
123 };
124 
125 typedef struct _RtpStream {
126  ortp_socket_t socketv4[10];
127  struct _RtpTransport *tr;
128  int sockfamily[10];
129  int max_rq_size;
130  int time_jump;
131  uint32_t ts_jump;
132  queue_t rq;
133  queue_t tev_rq;
134  mblk_t *cached_mp;
135  int loc_port;
136  struct sockaddr_storage rem_addr;
137  int rem_addrlen;
138  void *QoSHandle;
139  unsigned long QoSFlowID;
140  JitterControl jittctl;
141 
142  /* Information about outgoing RTP stream */
143  uint16_t snd_seq; /* send sequence number */
144  uint32_t snd_last_ts; /* the last stream timestamp sent */
145 
146  // uint32_t snd_time_offset;/*the scheduler time when the application send its first timestamp*/
147  // uint32_t snd_ts_offset; /* the first application timestamp sent by the application */
148  // uint32_t snd_rand_offset; /* a random number added to the user offset to make the stream timestamp*/
149  // uint32_t rcv_time_offset; /*the scheduler time when the application ask for its first timestamp*/
150  // uint32_t rcv_ts_offset; /* the first stream timestamp */
151  // uint32_t rcv_query_ts_offset; /* the first user timestamp asked by the application */
152  // uint32_t rcv_last_ret_ts; /* the timestamp of the last sample returned (only for continuous audio)*/
153 
154  /* local timestamp Information about incoming RTP stream */
155  uint32_t rcv_last_app_ts; /* the last application timestamp asked by the application */
156  /* Information about incoming RTP stream */
157  uint32_t rcv_last_ts; /* the last stream timestamp got by the application */
158  uint32_t hwrcv_extseq; /* last received on socket extended sequence number */
159  uint32_t hwrcv_seq_at_last_SR;
160  uint32_t hwrcv_since_last_SR;
161  uint32_t last_rcv_SR_ts; /* NTP timestamp (middle 32 bits) of last received SR */
162  struct timeval last_rcv_SR_time; /* time at which last SR was received */
163 
164  /* Information for outgoing RTCP packets */
165  uint32_t last_rtcp_report_snt_r; /* the time of the last rtcp report sent, in recv timestamp unit */
166  uint32_t last_rtcp_report_snt_s; /* the time of the last rtcp report sent, in send timestamp unit */
167  uint32_t rtcp_report_snt_interval; /* the interval in timestamp unit between rtcp report sent */
168  uint32_t last_rtcp_packet_count; /*the sender's octet count in the last sent RTCP SR*/
169 
170  uint32_t sent_payload_bytes; /*used for RTCP sender reports*/
171  unsigned int sent_bytes; /* used for bandwidth estimation */
172  struct timeval send_bw_start; /* used for bandwidth estimation */
173  unsigned int recv_bytes; /* used for bandwidth estimation */
174  struct timeval recv_bw_start; /* used for bandwidth estimation */
175  BandwidthStatistics sent_total_rtp_bitrate; /* total sent bandwidth: valid RTP+overhead / overhead is IP_UDP_OVERHEAD(28) */
176  BandwidthStatistics sent_total_rtcp_bitrate; /* total sent bandwidth: RTCP+overhead / overhead is IP_UDP_OVERHEAD(28) */
177  BandwidthStatistics sent_total_stun_bitrate; /* total sent bandwidth: STUN, ...+overhead / overhead is IP_UDP_OVERHEAD(28) */
178  BandwidthStatistics sent_total_other_bitrate; /* total sent bandwidth: DTLS, ...+overhead / overhead is IP_UDP_OVERHEAD(28) */
179 
180  BandwidthStatistics recv_total_rtp_bitrate; /* total recv bandwidth: valid RTP+overhead / overhead is IP_UDP_OVERHEAD(28) */
181  BandwidthStatistics recv_total_rtcp_bitrate; /* total recv bandwidth: RTCP+overhead / overhead is IP_UDP_OVERHEAD(28) */
182  BandwidthStatistics recv_total_stun_bitrate; /* total recv bandwidth: STUN, ...+overhead / overhead is IP_UDP_OVERHEAD(28) */
183  BandwidthStatistics recv_total_other_bitrate; /* total recv bandwidth: DTLS, ...+overhead / overhead is IP_UDP_OVERHEAD(28) */
184  BandwidthStatistics recv_total_bad_bitrate; /* total recv bandwidth: BAD+overhead (bad format, wrong ssrc...) / overhead is IP_UDP_OVERHEAD(28) */
185  BandwidthStatistics recv_total_rtppayload_bitrate; /* used for ccm tmmbr: RTP PAYLOAD DATA+overhead // overhead is rtp header + IP_UDP_OVERHEAD(28) */
186  struct ccmtmmbr_bitrate_table cur_bitrate_table;
187 
188  rtp_stats_t stats;
189  rtp_extended_stats_t extended_stats;
190  int recv_errno;
191  int send_errno;
192  int snd_socket_size;
193  int rcv_socket_size;
194  int ssrc_changed_thres;
195 } RtpStream;
196 
197 typedef struct _RtcpStream {
198  ortp_socket_t socketv4[10];
199  int sockfamily[10];
200  mblk_t *cached_mp;
201  struct sockaddr_storage rem_addr;
202  int rem_addrlen;
203  bool_t enabled; /*tells whether we can send RTCP packets */
204  unsigned int sent_bytes; /* used for bandwidth estimation */
205  struct timeval send_bw_start; /* used for bandwidth estimation */
206  unsigned int recv_bytes; /* used for bandwidth estimation */
207  struct timeval recv_bw_start; /* used for bandwidth estimation */
208 } RtcpStream;
209 
210 typedef struct _RtpSession RtpSession;
211 
212 struct _tc_qos_ifc;
213 
214 struct _tc_qos {
215  struct _tc_qos_ifc *ifc;
216  int num_ifc;
217 };
218 
219 struct _RtcpXrStats {
220  uint32_t last_rcvr_rtt_ts; /* NTP timestamp (middle 32 bits) of last received XR rcvr-rtt */
221  struct timeval last_rcvr_rtt_time; /* Time at which last XR rcvr-rtt was received */
222 };
223 
224 typedef struct _RtcpXrStats RtcpXrStats;
225 
227  float rtt_limit;
228  float rtt_high;
229  float rtt_medium;
230  float rtt_low;
231 
232  uint32_t bitrate_severe_issue;
233  uint32_t bitrate_medium_issue;
234  uint32_t bitrate_minor_issue;
235 
236  float loss_severe;
237  float loss_high;
238  float loss_medium;
239  float loss_low;
240 };
241 
242 typedef struct _ZigzagParams ZigzagParams;
243 
244 
246  int rtp_ext;
247  int id;
248  char uri[128];
249 };
250 
251 typedef struct _RtpExtension RtpExtension;
252 
261 struct _RtpSession {
262  RtpSession *next; /* next RtpSession, when the session are enqueued by the scheduler */
263  int mask_pos; /* the position in the scheduler mask of RtpSession : do not move this field: it is part of the ABI since the session_set macros use it*/
264  struct {
265  RtpProfile *profile;
266  int pt;
267  unsigned int ssrc;
268  int telephone_events_pt; /* the payload type used for telephony events */
269  char sdes_mid[32];
270  } snd, rcv;
271  unsigned int inc_ssrc_candidate;
272  int inc_same_ssrc_count;
273  int inc_same_ssrc_new_origin_count;
274  int hw_recv_pt; /* recv payload type before jitter buffer */
275  int recv_buf_size;
276  RtpSignalTable on_ssrc_changed;
277  RtpSignalTable on_payload_type_changed;
278  RtpSignalTable on_telephone_event_packet;
279  RtpSignalTable on_telephone_event;
280  RtpSignalTable on_timestamp_jump;
281  RtpSignalTable on_network_error;
282  RtpSignalTable on_rtcp_bye;
283  struct _OList *signal_tables;
284  struct _OList *eventqs;
285  msgb_allocator_t allocator;
286  RtpStream rtp;
287  RtcpStream rtcp;
288  struct _OList *modules_tables;
289  RtpSessionMode mode;
290  struct _RtpScheduler *sched;
291  uint32_t flags;
292  int dscp;
293  struct _tc_qos tc_qos;
294  int multicast_ttl;
295  int multicast_loopback;
296  void *user_data;
297  /* FIXME: Should be a table for all session participants. */
298  struct timeval last_recv_time; /* Time of receiving the RTP/RTCP packet. */
299  mblk_t *pending;
300  /* telephony events extension */
301  mblk_t *current_tev; /* the pending telephony events */
302  mblk_t *sd;
303  queue_t contributing_sources;
304  bool_t symmetric_rtp;
305  bool_t permissive; /*use the permissive algorithm*/
306  bool_t ssrc_set;
307  bool_t rtcp_mux;
308  bool_t rtcp_rsize;
309  struct IceCheckList *rtp_icechecklist;
310  struct IceCheckList *rtcp_icechecklist;
311  RtpSessionSetup rfc4145_setup;
312  unsigned char remote_fingerprint[64];
313  struct _RtpBundle *bundle; /* if this is set, a bundle thread will be used to read data */
314  bool_t use_bundle; /* BUNDLE is active */
315  bool_t rtcpfeedback_pli; /* rtcp feedback with nack pli mode */
316  bool_t rtcpfeedback_nack; /* rtcp feedback with nack mode */
317  bool_t rtcpfeedback_ccm_tmmbr; /* rtcp feedback with tmmbr mode */
318  bool_t rtcpfeedback_goog_remb; /* rtcp feedback with goog-remb mode */
319  bool_t rtcpxr_voip_metrics; /* rtcp xr with voip-metrics */
320  bool_t rtcpxr_send_one_dlrr; /* one rtcp dlrr must be sent */
321  uint16_t rtcpfeedback_nack_retransmission;
322 #if 0
323  uint16_t rtcpfeedback_nack_retransmission2;
324 #endif
325  RtcpXrStats rtcp_xr_stats;
326 
327  int FEC_N_interval;
328  ZigzagParams zparams;
329  queue_t nack_rtpq;
330  struct _OList *rtpExtensions;
331 };
332 
333 typedef struct _RtpMedia {
334  RtpSession session;
335 } RtpMedia;
336 
337 /* the first "media" will be used when bundle is active */
338 typedef struct _RtpBundle {
339  struct _OList *rtpMedias;
340  ortp_thread_t thread;
341  bool_t run;
342  ortp_mutex_t lock;
343 } RtpBundle;
344 
345 struct ortp_dtls_srtp;
346 
347 #ifdef __cplusplus
348 extern "C" {
349 #endif
350 
351 /* public API */
352 void JitterStatistics_init(JitterStatistics *jt_stats, int period, int interval);
353 void JitterStatistics_update(JitterStatistics *jt_stats, float skew, struct timeval *now);
354 void JitterStatistics_destroy(JitterStatistics *jt_stats);
355 
356 void BandwidthStatistics_init(BandwidthStatistics *bw_stats, int period);
357 void BandwidthStatistics_update(BandwidthStatistics *bw_stats, int nbytes, int nbytes_overhead, struct timeval *now);
358 void BandwidthStatistics_destroy(BandwidthStatistics *bw_stats);
359 
360 RtpBundle *rtp_bundle_new(void);
361 void rtp_bundle_destroy(RtpBundle *bundle);
362 void rtp_bundle_lock(RtpBundle *bundle);
363 void rtp_bundle_unlock(RtpBundle *bundle);
364 void rtp_bundle_media_add(RtpBundle *bundle, RtpMedia *_RtpMedia, int pos);
365 void rtp_bundle_media_remove(RtpBundle *bundle, RtpMedia *_RtpMedia);
366 void rtp_bundle_start(RtpBundle *bundle);
367 void rtp_bundle_stop(RtpBundle *bundle);
368 RtpMedia *rtp_media_new(int session_mode, bool_t use_bundle);
369 void rtp_media_destroy(RtpMedia *media);
370 void rtp_session_set_bundle(RtpSession *session, struct _RtpBundle *bundle);
371 
372 RtpSession *rtp_session_new(int mode);
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);
377 void rtp_session_set_profile(RtpSession *session, RtpProfile *profile);
378 void rtp_session_set_send_profile(RtpSession *session, RtpProfile *profile);
379 void rtp_session_set_recv_profile(RtpSession *session, RtpProfile *profile);
380 RtpProfile *rtp_session_get_profile(RtpSession *session);
381 RtpProfile *rtp_session_get_send_profile(RtpSession *session);
382 RtpProfile *rtp_session_get_recv_profile(RtpSession *session);
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);
389 
390 void rtp_session_enable_jitter_buffer(RtpSession *session, bool_t enabled);
391 bool_t rtp_session_jitter_buffer_enabled(const RtpSession *session);
392 void rtp_session_set_jitter_buffer_params(RtpSession *session, const JBParameters *par);
393 void rtp_session_get_jitter_buffer_params(RtpSession *session, JBParameters *par);
394 float rtp_session_get_average_buffer_size(RtpSession *session);
395 
396 /*deprecated jitter control functions*/
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);
400 
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);
404 
405 int rtp_session_set_remote_addr_full(RtpSession *session, int idx, const char *addr, int rtp_port, int rtcp_port);
406 /*same as previous function, old name:*/
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);
409 void rtp_session_set_transports(RtpSession *session, RtpTransport *rtptr);
410 void rtp_session_add_module(RtpSession *session, RtpModule *module);
411 RtpModule *rtp_session_get_module(RtpSession *session, const char *name);
412 int rtp_session_remove_module(RtpSession *session, const char *name);
413 void rtp_session_module_remove_all(RtpSession *session);
414 
415 /* QOS / DSCP */
416 int rtp_session_set_dscp(RtpSession *session, int idx, int dscp);
417 int rtp_session_get_dscp(const RtpSession *session);
418 
419 /* Multicast methods */
420 int rtp_session_set_multicast_ttl(RtpSession *session, int idx, int ttl);
421 int rtp_session_get_multicast_ttl(RtpSession *session);
422 
423 int rtp_session_set_multicast_loopback(RtpSession *session, int idx, int yesno);
424 int rtp_session_get_multicast_loopback(RtpSession *session);
425 
426 int rtp_session_set_send_payload_type(RtpSession *session, int paytype);
427 int rtp_session_get_send_payload_type(const RtpSession *session);
428 
429 int rtp_session_get_recv_payload_type(const RtpSession *session);
430 int rtp_session_set_recv_payload_type(RtpSession *session, int pt);
431 
432 int rtp_session_set_payload_type(RtpSession *session, int pt);
433 
434 void rtp_session_set_symmetric_rtp(RtpSession *session, bool_t yesno);
435 
436 void rtp_session_set_rtcp_mux(RtpSession *session, bool_t yesno);
437 
438 void rtp_session_set_rtcp_rsize(RtpSession *session, bool_t yesno);
439 
440 void rtp_session_set_rtcp_fb_nack(RtpSession *session, bool_t yesno);
441 
442 void rtp_session_set_rtcp_fb_pli(RtpSession *session, bool_t yesno);
443 
444 void rtp_session_set_rtcp_fb_ccm_tmmbr(RtpSession *session, bool_t yesno);
445 
446 void rtp_session_set_rtcp_fb_goog_remb(RtpSession *session, bool_t yesno);
447 
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);
450 
451 void rtp_session_enable_rtcp(RtpSession *session, bool_t yesno);
452 
453 void rtp_session_set_ssrc_changed_threshold(RtpSession *session, int numpackets);
454 
455 /*low level recv and send functions */
456 mblk_t *rtp_session_recvm_with_ts(RtpSession *session, uint32_t user_ts);
457 mblk_t *rtp_session_recvm_with_ts_extended(RtpSession *session, uint32_t user_ts, mblk_t **last_dropped);
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); /* usefull for test purpose */
463 /* high level recv and send functions */
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);
466 
467 /* send data without applying module */
468 int rtp_session_data_send(RtpSession *session, mblk_t *m, int packettype);
469 
470 /* event API*/
471 void rtp_session_register_event_queue(RtpSession *session, OrtpEvQueue *q);
472 void rtp_session_unregister_event_queue(RtpSession *session, OrtpEvQueue *q);
473 
474 /* IP bandwidth usage estimation functions, returning bits/s*/
475 float rtp_session_get_sent_rtp_bandwidth(RtpSession *session, BandwidthStatistics *val);
476 float rtp_session_get_recv_rtp_bandwidth(RtpSession *session, BandwidthStatistics *val);
477 float rtp_session_get_sent_stun_bandwidth(RtpSession *session, BandwidthStatistics *val);
478 float rtp_session_get_recv_stun_bandwidth(RtpSession *session, BandwidthStatistics *val);
479 float rtp_session_get_sent_other_bandwidth(RtpSession *session, BandwidthStatistics *val);
480 float rtp_session_get_recv_other_bandwidth(RtpSession *session, BandwidthStatistics *val);
481 float rtp_session_get_recv_bad_bandwidth(RtpSession *session, BandwidthStatistics *val);
482 float rtp_session_get_sent_rtcp_bandwidth(RtpSession *session, BandwidthStatistics *val);
483 float rtp_session_get_recv_rtcp_bandwidth(RtpSession *session, BandwidthStatistics *val);
484 float rtp_session_get_recv_rtppayload_bandwidth(RtpSession *session, BandwidthStatistics *val);
485 
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);
491 
492 void rtp_session_send_rtcp_APP(RtpSession *session, uint8_t subtype, const char *name, const uint8_t *data, int datalen);
493 
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);
498 void rtp_session_resync(RtpSession *session);
499 void rtp_session_reset(RtpSession *session);
500 void rtp_session_destroy(RtpSession *session);
501 
502 const rtp_stats_t *rtp_session_get_stats(const RtpSession *session);
503 const rtp_extended_stats_t *rtp_session_get_extented_stats(const RtpSession *session);
504 void rtp_session_reset_stats(RtpSession *session);
505 
506 void rtp_session_set_data(RtpSession *session, void *data);
507 void *rtp_session_get_data(const RtpSession *session);
508 
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);
512 
513 /* in use with the scheduler to convert a timestamp in scheduler time unit (ms) */
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);
516 /* this function aims at simulating senders with "imprecise" clocks, resulting in
517 rtp packets sent with timestamp uncorrelated with the system clock .
518 This is only availlable to sessions working with the oRTP scheduler */
519 void rtp_session_make_time_distorsion(RtpSession *session, int milisec);
520 
521 int rtp_session_set_icechecklist(RtpSession *session, struct IceCheckList *rtp_checklist, struct IceCheckList *rtcp_checklist);
522 int rtp_session_set_max_recv_bitrate(RtpSession *session, uint32_t max_ccm_bitrate);
523 
524 /*RTCP functions */
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);
528 mblk_t *rtp_session_create_rtcp_sdes_packet(RtpSession *session);
529 mblk_t *rtp_session_create_rtcp_xr_vm_packet(RtpSession *session);
530 mblk_t *rtp_session_create_rtcp_xr_rr_packet(RtpSession *session);
531 mblk_t *rtp_session_create_rtcp_xr_dlrr_packet(RtpSession *session);
532 
533 void rtp_session_get_last_recv_time(RtpSession *session, struct timeval *tv);
534 int rtp_session_bye(RtpSession *session, const char *reason);
535 
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);
541 
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);
546 
547 /*private */
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)
551 void rtp_session_uninit(RtpSession *session);
552 
553 void rtp_session_dispatch_event(RtpSession *session, OrtpEvent *ev);
554 
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);
558 
559 #ifdef __cplusplus
560 }
561 #endif
562 
563 #endif
Using and creating standart and custom RTP profiles.
struct _JBParameters JBParameters
The RtpTransport api.
Definition: rtpsession.h:101
Definition: turn.h:192
Definition: rtpsession.h:47
Definition: event.h:76
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: ortp.h:167
Definition: rtpsession.h:197
Definition: rtpsession.h:219
Definition: rtpsession.h:338
Definition: rtpsession.h:245
Definition: rtpsession.h:333
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
Definition: rtp.h:100
Definition: rtp.h:65