oRTP
0.27.0
|
The RtpSession api. More...
#include <ortp/port.h>
#include <ortp/rtp.h>
#include <ortp/payloadtype.h>
#include <ortp/rtpprofile.h>
#include <ortp/sessionset.h>
#include <ortp/rtcp.h>
#include <ortp/str_utils.h>
#include <ortp/rtpsignaltable.h>
#include <ortp/event.h>
Data Structures | |
struct | _JBParameters |
struct | _JitterControl |
struct | _WaitPoint |
struct | _RtpTransportModifier |
struct | _RtpTransport |
struct | _OrtpNetworkSimulatorParams |
struct | _OrtpNetworkSimulatorCtx |
struct | OrtpRtcpSendAlgorithm |
struct | OrtpRtcpFbConfiguration |
struct | OrtpRtcpXrMediaCallbacks |
struct | OrtpRtcpXrConfiguration |
struct | OrtpRtcpXrStats |
struct | OrtpRtcpTmmbrInfo |
struct | _OrtpAddress |
struct | _OrtpStream |
struct | _RtpStream |
struct | _RtcpStream |
struct | _RtpSession |
Typedefs | |
typedef struct _JBParameters | JBParameters |
typedef struct _JitterControl | JitterControl |
typedef struct _WaitPoint | WaitPoint |
typedef struct _RtpTransportModifier | RtpTransportModifier |
typedef struct _RtpTransport | RtpTransport |
typedef enum _OrtpNetworkSimulatorMode | OrtpNetworkSimulatorMode |
typedef struct _OrtpNetworkSimulatorParams | OrtpNetworkSimulatorParams |
typedef struct _OrtpNetworkSimulatorCtx | OrtpNetworkSimulatorCtx |
typedef struct OrtpRtcpSendAlgorithm | OrtpRtcpSendAlgorithm |
typedef struct OrtpRtcpFbConfiguration | OrtpRtcpFbConfiguration |
typedef OrtpRtcpXrPlcStatus(* | OrtpRtcpXrPlcCallback )(void *userdata) |
typedef int(* | OrtpRtcpXrSignalLevelCallback )(void *userdata) |
typedef int(* | OrtpRtcpXrNoiseLevelCallback )(void *userdata) |
typedef float(* | OrtpRtcpXrAverageQualityIndicatorCallback )(void *userdata) |
typedef struct OrtpRtcpXrMediaCallbacks | OrtpRtcpXrMediaCallbacks |
typedef struct OrtpRtcpXrConfiguration | OrtpRtcpXrConfiguration |
typedef struct OrtpRtcpXrStats | OrtpRtcpXrStats |
typedef struct OrtpRtcpTmmbrInfo | OrtpRtcpTmmbrInfo |
typedef struct _OrtpAddress | OrtpAddress |
typedef struct _OrtpStream | OrtpStream |
typedef struct _RtpStream | RtpStream |
typedef struct _RtcpStream | RtcpStream |
typedef struct _RtpSession | RtpSession |
Enumerations | |
enum | RtpSessionMode { RTP_SESSION_RECVONLY, RTP_SESSION_SENDONLY, RTP_SESSION_SENDRECV } |
enum | _OrtpNetworkSimulatorMode { OrtpNetworkSimulatorInvalid =-1, OrtpNetworkSimulatorInbound, OrtpNetworkSimulatorOutbound, OrtpNetworkSimulatorOutboundControlled } |
enum | OrtpRtcpXrPlcStatus { OrtpRtcpXrNoPlc, OrtpRtcpXrSilencePlc, OrtpRtcpXrEnhancedPlc } |
enum | OrtpRtcpXrRcvrRttMode { OrtpRtcpXrRcvrRttNone, OrtpRtcpXrRcvrRttAll, OrtpRtcpXrRcvrRttSender } |
enum | OrtpRtcpXrStatSummaryFlag { OrtpRtcpXrStatSummaryLoss = (1 << 7), OrtpRtcpXrStatSummaryDup = (1 << 6), OrtpRtcpXrStatSummaryJitt = (1 << 5), OrtpRtcpXrStatSummaryTTL = (1 << 3), OrtpRtcpXrStatSummaryHL = (1 << 4) } |
Functions | |
const char * | ortp_network_simulator_mode_to_string (OrtpNetworkSimulatorMode mode) |
OrtpNetworkSimulatorMode | ortp_network_simulator_mode_from_string (const char *str) |
RtpSession * | rtp_session_new (int mode) |
void | rtp_session_set_scheduling_mode (RtpSession *session, int yesno) |
void | rtp_session_set_blocking_mode (RtpSession *session, int yesno) |
void | rtp_session_set_profile (RtpSession *session, RtpProfile *profile) |
void | rtp_session_set_send_profile (RtpSession *session, RtpProfile *profile) |
void | rtp_session_set_recv_profile (RtpSession *session, RtpProfile *profile) |
RtpProfile * | rtp_session_get_profile (RtpSession *session) |
RtpProfile * | rtp_session_get_send_profile (RtpSession *session) |
RtpProfile * | rtp_session_get_recv_profile (RtpSession *session) |
int | rtp_session_signal_connect (RtpSession *session, const char *signal_name, RtpCallback cb, void *user_data) |
int | rtp_session_signal_disconnect_by_callback (RtpSession *session, const char *signal_name, RtpCallback cb) |
void | rtp_session_set_ssrc (RtpSession *session, uint32_t ssrc) |
uint32_t | rtp_session_get_send_ssrc (RtpSession *session) |
uint32_t | rtp_session_get_recv_ssrc (RtpSession *session) |
void | rtp_session_set_seq_number (RtpSession *session, uint16_t seq) |
uint16_t | rtp_session_get_seq_number (RtpSession *session) |
uint32_t | rtp_session_get_rcv_ext_seq_number (RtpSession *session) |
int | rtp_session_get_cum_loss (RtpSession *session) |
void | rtp_session_set_duplication_ratio (RtpSession *session, float ratio) |
void | rtp_session_enable_jitter_buffer (RtpSession *session, bool_t enabled) |
bool_t | rtp_session_jitter_buffer_enabled (const RtpSession *session) |
void | rtp_session_set_jitter_buffer_params (RtpSession *session, const JBParameters *par) |
void | rtp_session_get_jitter_buffer_params (RtpSession *session, JBParameters *par) |
void | rtp_session_set_jitter_compensation (RtpSession *session, int milisec) |
void | rtp_session_enable_adaptive_jitter_compensation (RtpSession *session, bool_t val) |
bool_t | rtp_session_adaptive_jitter_compensation_enabled (RtpSession *session) |
void | rtp_session_set_time_jump_limit (RtpSession *session, int miliseconds) |
int | rtp_session_join_multicast_group (RtpSession *session, const char *ip) |
int | rtp_session_set_local_addr (RtpSession *session, const char *addr, int rtp_port, int rtcp_port) |
int | rtp_session_get_local_port (const RtpSession *session) |
int | rtp_session_get_local_rtcp_port (const RtpSession *session) |
int | rtp_session_set_remote_addr_full (RtpSession *session, const char *rtp_addr, int rtp_port, const char *rtcp_addr, int rtcp_port) |
int | rtp_session_set_remote_addr_and_port (RtpSession *session, const char *addr, int rtp_port, int rtcp_port) |
int | rtp_session_set_remote_addr (RtpSession *session, const char *addr, int port) |
int | rtp_session_add_aux_remote_addr_full (RtpSession *session, const char *rtp_addr, int rtp_port, const char *rtcp_addr, int rtcp_port) |
void | rtp_session_clear_aux_remote_addr (RtpSession *session) |
void | rtp_session_set_sockets (RtpSession *session, int rtpfd, int rtcpfd) |
void | rtp_session_get_transports (const RtpSession *session, RtpTransport **rtptr, RtpTransport **rtcptr) |
ortp_socket_t | rtp_session_get_rtp_socket (const RtpSession *session) |
ortp_socket_t | rtp_session_get_rtcp_socket (const RtpSession *session) |
void | rtp_session_refresh_sockets (RtpSession *session) |
int | rtp_session_set_dscp (RtpSession *session, int dscp) |
int | rtp_session_get_dscp (const RtpSession *session) |
int | rtp_session_set_pktinfo (RtpSession *session, int activate) |
int | rtp_session_set_multicast_ttl (RtpSession *session, int ttl) |
int | rtp_session_get_multicast_ttl (RtpSession *session) |
int | rtp_session_set_multicast_loopback (RtpSession *session, int yesno) |
int | rtp_session_get_multicast_loopback (RtpSession *session) |
int | rtp_session_set_send_payload_type (RtpSession *session, int paytype) |
int | rtp_session_get_send_payload_type (const RtpSession *session) |
int | rtp_session_get_recv_payload_type (const RtpSession *session) |
int | rtp_session_set_recv_payload_type (RtpSession *session, int pt) |
int | rtp_session_set_send_telephone_event_payload_type (RtpSession *session, int paytype) |
int | rtp_session_set_payload_type (RtpSession *session, int pt) |
void | rtp_session_set_symmetric_rtp (RtpSession *session, bool_t yesno) |
bool_t | rtp_session_get_symmetric_rtp (const RtpSession *session) |
void | rtp_session_enable_rtcp_mux (RtpSession *session, bool_t yesno) |
bool_t | rtp_session_rtcp_mux_enabled (RtpSession *session) |
void | rtp_session_set_connected_mode (RtpSession *session, bool_t yesno) |
void | rtp_session_enable_rtcp (RtpSession *session, bool_t yesno) |
bool_t | rtp_session_rtcp_enabled (const RtpSession *session) |
void | rtp_session_set_rtcp_report_interval (RtpSession *session, int value_ms) |
void | rtp_session_set_target_upload_bandwidth (RtpSession *session, int target_bandwidth) |
void | rtp_session_configure_rtcp_xr (RtpSession *session, const OrtpRtcpXrConfiguration *config) |
void | rtp_session_set_rtcp_xr_media_callbacks (RtpSession *session, const OrtpRtcpXrMediaCallbacks *cbs) |
void | rtp_session_set_ssrc_changed_threshold (RtpSession *session, int numpackets) |
mblk_t * | rtp_session_recvm_with_ts (RtpSession *session, uint32_t user_ts) |
mblk_t * | rtp_session_create_packet (RtpSession *session, size_t header_size, const uint8_t *payload, size_t payload_size) |
mblk_t * | rtp_session_create_packet_raw (const uint8_t *packet, size_t packet_size) |
mblk_t * | rtp_session_create_packet_with_data (RtpSession *session, uint8_t *payload, size_t payload_size, void(*freefn)(void *)) |
mblk_t * | rtp_session_create_packet_in_place (RtpSession *session, uint8_t *buffer, size_t size, void(*freefn)(void *)) |
int | rtp_session_sendm_with_ts (RtpSession *session, mblk_t *mp, uint32_t userts) |
int | rtp_session_sendto (RtpSession *session, bool_t is_rtp, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen) |
int | rtp_session_recvfrom (RtpSession *session, bool_t is_rtp, mblk_t *m, int flags, struct sockaddr *from, socklen_t *fromlen) |
int | rtp_session_recv_with_ts (RtpSession *session, uint8_t *buffer, int len, uint32_t ts, int *have_more) |
int | rtp_session_send_with_ts (RtpSession *session, const uint8_t *buffer, int len, uint32_t userts) |
void | rtp_session_register_event_queue (RtpSession *session, OrtpEvQueue *q) |
void | rtp_session_unregister_event_queue (RtpSession *session, OrtpEvQueue *q) |
float | rtp_session_compute_send_bandwidth (RtpSession *session) |
float | rtp_session_compute_recv_bandwidth (RtpSession *session) |
float | rtp_session_get_send_bandwidth (RtpSession *session) |
float | rtp_session_get_recv_bandwidth (RtpSession *session) |
float | rtp_session_get_rtp_send_bandwidth (RtpSession *session) |
float | rtp_session_get_rtp_recv_bandwidth (RtpSession *session) |
float | rtp_session_get_rtcp_send_bandwidth (RtpSession *session) |
float | rtp_session_get_rtcp_recv_bandwidth (RtpSession *session) |
void | rtp_session_send_rtcp_APP (RtpSession *session, uint8_t subtype, const char *name, const uint8_t *data, int datalen) |
int | rtp_session_rtcp_sendm_raw (RtpSession *session, mblk_t *m) |
uint32_t | rtp_session_get_current_send_ts (RtpSession *session) |
uint32_t | rtp_session_get_current_recv_ts (RtpSession *session) |
void | rtp_session_flush_sockets (RtpSession *session) |
void | rtp_session_release_sockets (RtpSession *session) |
void | rtp_session_resync (RtpSession *session) |
void | rtp_session_reset (RtpSession *session) |
void | rtp_session_destroy (RtpSession *session) |
const rtp_stats_t * | rtp_session_get_stats (const RtpSession *session) |
const jitter_stats_t * | rtp_session_get_jitter_stats (const RtpSession *session) |
void | rtp_session_reset_stats (RtpSession *session) |
void | rtp_session_set_data (RtpSession *session, void *data) |
void * | rtp_session_get_data (const RtpSession *session) |
void | rtp_session_set_recv_buf_size (RtpSession *session, int bufsize) |
void | rtp_session_set_rtp_socket_send_buffer_size (RtpSession *session, unsigned int size) |
void | rtp_session_set_rtp_socket_recv_buffer_size (RtpSession *session, unsigned int size) |
uint32_t | rtp_session_ts_to_time (RtpSession *session, uint32_t timestamp) |
uint32_t | rtp_session_time_to_ts (RtpSession *session, int millisecs) |
void | rtp_session_make_time_distorsion (RtpSession *session, int milisec) |
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) |
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) |
void | rtp_session_remove_contributing_source (RtpSession *session, uint32_t csrc) |
mblk_t * | rtp_session_create_rtcp_sdes_packet (RtpSession *session, bool_t full) |
void | rtp_session_get_last_recv_time (RtpSession *session, struct timeval *tv) |
int | rtp_session_bye (RtpSession *session, const char *reason) |
int | rtp_session_get_last_send_error_code (RtpSession *session) |
void | rtp_session_clear_send_error_code (RtpSession *session) |
int | rtp_session_get_last_recv_error_code (RtpSession *session) |
void | rtp_session_clear_recv_error_code (RtpSession *session) |
float | rtp_session_get_round_trip_propagation (RtpSession *session) |
void | rtp_session_enable_network_simulation (RtpSession *session, const OrtpNetworkSimulatorParams *params) |
void | rtp_session_rtcp_set_lost_packet_value (RtpSession *session, const int value) |
For test purpose only, sets a constant lost packet value within all RTCP output packets. . More... | |
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. . More... | |
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 within all returned RTCP output packets. . More... | |
mblk_t * | rtp_session_pick_with_cseq (RtpSession *session, const uint16_t sequence_number) |
void | rtp_session_send_rtcp_xr_rcvr_rtt (RtpSession *session) |
void | rtp_session_send_rtcp_xr_dlrr (RtpSession *session) |
void | rtp_session_send_rtcp_xr_stat_summary (RtpSession *session) |
void | rtp_session_send_rtcp_xr_voip_metrics (RtpSession *session) |
bool_t | rtp_session_avpf_enabled (RtpSession *session) |
bool_t | rtp_session_avpf_payload_type_feature_enabled (RtpSession *session, unsigned char feature) |
bool_t | rtp_session_avpf_feature_enabled (RtpSession *session, unsigned char feature) |
void | rtp_session_enable_avpf_feature (RtpSession *session, unsigned char feature, bool_t enable) |
uint16_t | rtp_session_get_avpf_rr_interval (RtpSession *session) |
bool_t | rtp_session_rtcp_psfb_scheduled (RtpSession *session, rtcp_psfb_type_t type) |
bool_t | rtp_session_rtcp_rtpfb_scheduled (RtpSession *session, rtcp_rtpfb_type_t type) |
void | rtp_session_send_rtcp_fb_generic_nack (RtpSession *session, uint16_t pid, uint16_t blp) |
void | rtp_session_send_rtcp_fb_pli (RtpSession *session) |
void | rtp_session_send_rtcp_fb_fir (RtpSession *session) |
void | rtp_session_send_rtcp_fb_sli (RtpSession *session, uint16_t first, uint16_t number, uint8_t picture_id) |
void | rtp_session_send_rtcp_fb_rpsi (RtpSession *session, uint8_t *bit_string, uint16_t bit_string_len) |
void | rtp_session_send_rtcp_fb_tmmbr (RtpSession *session, uint64_t mxtbr) |
void | rtp_session_send_rtcp_fb_tmmbn (RtpSession *session, uint32_t ssrc) |
void | rtp_session_init (RtpSession *session, int mode) |
void | rtp_session_uninit (RtpSession *session) |
void | rtp_session_dispatch_event (RtpSession *session, OrtpEvent *ev) |
void | rtp_session_set_reuseaddr (RtpSession *session, bool_t yes) |
int | meta_rtp_transport_modifier_inject_packet_to_send (RtpTransport *t, RtpTransportModifier *tpm, mblk_t *msg, int flags) |
int | meta_rtp_transport_modifier_inject_packet_to_send_to (RtpTransport *t, RtpTransportModifier *tpm, mblk_t *msg, int flags, const struct sockaddr *to, socklen_t tolen) |
int | meta_rtp_transport_modifier_inject_packet_to_recv (RtpTransport *t, RtpTransportModifier *tpm, mblk_t *msg, int flags) |
RtpTransport * | meta_rtp_transport_get_endpoint (const RtpTransport *transport) |
void | meta_rtp_transport_set_endpoint (RtpTransport *transport, RtpTransport *endpoint) |
void | meta_rtp_transport_destroy (RtpTransport *tp) |
void | meta_rtp_transport_append_modifier (RtpTransport *tp, RtpTransportModifier *tpm) |
int | rtp_session_splice (RtpSession *session, RtpSession *to_session) |
int | rtp_session_unsplice (RtpSession *session, RtpSession *to_session) |
The RtpSession api.
The RtpSession objects represent a RTP session: once it is configured with local and remote network addresses and a payload type is given, it let you send and recv a media stream.
typedef struct _JBParameters JBParameters |
Jitter buffer parameters
typedef struct _OrtpNetworkSimulatorParams OrtpNetworkSimulatorParams |
Structure describing the network simulator parameters
RtpTransport* meta_rtp_transport_get_endpoint | ( | const RtpTransport * | transport | ) |
int meta_rtp_transport_modifier_inject_packet_to_recv | ( | RtpTransport * | t, |
RtpTransportModifier * | tpm, | ||
mblk_t * | msg, | ||
int | flags | ||
) |
allow a modifier to inject a packet which will be treated by successive modifiers
int meta_rtp_transport_modifier_inject_packet_to_send | ( | RtpTransport * | t, |
RtpTransportModifier * | tpm, | ||
mblk_t * | msg, | ||
int | flags | ||
) |
allow a modifier to inject a packet which will be treated by successive modifiers
int meta_rtp_transport_modifier_inject_packet_to_send_to | ( | RtpTransport * | t, |
RtpTransportModifier * | tpm, | ||
mblk_t * | msg, | ||
int | flags, | ||
const struct sockaddr * | to, | ||
socklen_t | tolen | ||
) |
allow a modifier to inject a packet which will be treated by successive modifiers
void meta_rtp_transport_set_endpoint | ( | RtpTransport * | transport, |
RtpTransport * | endpoint | ||
) |
set endpoint
[in] | transport | RtpTransport object. |
[in] | endpoint | RtpEndpoint. |
int rtp_session_add_aux_remote_addr_full | ( | RtpSession * | session, |
const char * | rtp_addr, | ||
int | rtp_port, | ||
const char * | rtcp_addr, | ||
int | rtcp_port | ||
) |
rtp_session_add_remote_aux_addr_full:
session | a rtp session freshly created. |
rtp_addr | a local IP address in the xxx.xxx.xxx.xxx form. |
rtp_port | a local rtp port. |
rtcp_addr | a local IP address in the xxx.xxx.xxx.xxx form. |
rtcp_port | a local rtcp port. Add an auxiliary remote address for the rtp session, ie a destination address where rtp packet are sent. Returns: 0 on success. |
int rtp_session_bye | ( | RtpSession * | session, |
const char * | reason | ||
) |
Sends a RTCP bye packet.
session | RtpSession |
reason | the reason phrase. |
mblk_t* rtp_session_create_packet | ( | RtpSession * | session, |
size_t | header_size, | ||
const uint8_t * | payload, | ||
size_t | payload_size | ||
) |
Allocates a new rtp packet. In the header, ssrc and payload_type according to the session's context. Timestamp is not set, it will be set when the packet is going to be sent with rtp_session_sendm_with_ts(). Sequence number is initalized to previous sequence number sent + 1 If payload_size is zero, thus an empty packet (just a RTP header) is returned.
session | a rtp session. |
header_size | the rtp header size. For standart size (without extensions), it is RTP_FIXED_HEADER_SIZE |
payload | data to be copied into the rtp packet. |
payload_size | size of data carried by the rtp packet. |
mblk_t* rtp_session_create_packet_in_place | ( | RtpSession * | session, |
uint8_t * | buffer, | ||
size_t | size, | ||
void(*)(void *) | freefn | ||
) |
Creates a new rtp packet using the buffer given in arguments (no copy). In the header, ssrc and payload_type according to the session's context. Timestamp and seq number are not set, there will be set when the packet is going to be sent with rtp_session_sendm_with_ts(). freefn can be NULL, in that case payload will be kept untouched.
session | a rtp session. |
buffer | a buffer that contains first just enough place to write a RTP header, then the data to send. |
size | the size of the buffer |
freefn | a function that will be called once the buffer is no more needed (the data has been sent). |
mblk_t* rtp_session_create_packet_raw | ( | const uint8_t * | packet, |
size_t | packet_size | ||
) |
Create a packet already including headers
mblk_t* rtp_session_create_packet_with_data | ( | RtpSession * | session, |
uint8_t * | payload, | ||
size_t | payload_size, | ||
void(*)(void *) | freefn | ||
) |
Creates a new rtp packet using the given payload buffer (no copy). The header will be allocated separetely. In the header, ssrc and payload_type according to the session's context. Timestamp and seq number are not set, there will be set when the packet is going to be sent with rtp_session_sendm_with_ts(). oRTP will send this packet using libc's sendmsg() (if this function is availlable!) so that there will be no packet concatenation involving copies to be done in user-space. freefn can be NULL, in that case payload will be kept untouched.
session | a rtp session. |
payload | the data to be sent with this packet |
payload_size | size of data |
freefn | a function that will be called when the payload buffer is no more needed. |
void rtp_session_destroy | ( | RtpSession * | session | ) |
Destroys a rtp session. All memory allocated for the RtpSession is freed.
session | a rtp session. |
void rtp_session_enable_rtcp | ( | RtpSession * | session, |
bool_t | yesno | ||
) |
By default oRTP automatically sends RTCP SR or RR packets. If yesno is set to FALSE, the RTCP sending of packet is disabled. This functionnality might be needed for some equipments that do not support RTCP, leading to a traffic of ICMP errors on the network. It can also be used to save bandwidth despite the RTCP bandwidth is actually and usually very very low.
void rtp_session_flush_sockets | ( | RtpSession * | session | ) |
rtp_session_flush_sockets:
session | a rtp session |
Flushes the sockets for all pending incoming packets. This can be usefull if you did not listen to the stream for a while and wishes to start to receive again. During the time no receive is made packets get bufferised into the internal kernel socket structure.
int rtp_session_get_cum_loss | ( | RtpSession * | session | ) |
Returns the latest cumulative loss value computed
uint32_t rtp_session_get_current_recv_ts | ( | RtpSession * | session | ) |
Same thing as rtp_session_get_current_send_ts() except that it's for an incoming stream. Works only on scheduled mode.
session | a rtp session. |
uint32_t rtp_session_get_current_send_ts | ( | RtpSession * | session | ) |
When the rtp session is scheduled and has started to send packets, this function computes the timestamp that matches to the present time. Using this function can be usefull when sending discontinuous streams. Some time can be elapsed between the end of a stream burst and the begin of a new stream burst, and the application may be not not aware of this elapsed time. In order to get a valid (current) timestamp to pass to rtp_session_send_with_ts() or rtp_session_sendm_with_ts(), the application may use rtp_session_get_current_send_ts().
session | a rtp session. |
void* rtp_session_get_data | ( | const RtpSession * | session | ) |
session | a rtp session |
int rtp_session_get_dscp | ( | const RtpSession * | session | ) |
rtp_session_get_dscp:
session | a rtp session |
Returns the DSCP (Differentiated Services Code Point) for outgoing RTP packets.
const jitter_stats_t* rtp_session_get_jitter_stats | ( | const RtpSession * | session | ) |
Retrieves the session's jitter specific statistics.
void rtp_session_get_last_recv_time | ( | RtpSession * | session, |
struct timeval * | tv | ||
) |
Gets last time a valid RTP or RTCP packet was received.
session | RtpSession to get last receive time from. |
tv | Pointer to struct timeval to fill. |
int rtp_session_get_local_port | ( | const RtpSession * | session | ) |
rtp_session_get_local_port:
session | a rtp session for which rtp_session_set_local_addr() or rtp_session_set_remote_addr() has been called This function can be useful to retrieve the local port that was randomly choosen by rtp_session_set_remote_addr() when rtp_session_set_local_addr() was not called. Returns: the local port used to listen for rtp packets, -1 if not set. |
int rtp_session_get_multicast_loopback | ( | RtpSession * | session | ) |
rtp_session_get_multicast_loopback:
session | a rtp session |
Returns the multicast loopback state of rtp session (true or false).
int rtp_session_get_multicast_ttl | ( | RtpSession * | session | ) |
rtp_session_get_multicast_ttl:
session | a rtp session |
Returns the TTL (Time-To-Live) for outgoing multicast packets.
RtpProfile* rtp_session_get_profile | ( | RtpSession * | session | ) |
session | a rtp session DEPRECATED! Returns current send profile. Use rtp_session_get_send_profile() or rtp_session_get_recv_profile() |
uint32_t rtp_session_get_rcv_ext_seq_number | ( | RtpSession * | session | ) |
Returns the highest extended sequence number received.
float rtp_session_get_recv_bandwidth | ( | RtpSession * | session | ) |
Get last computed recv bandwidth. Computation must have been done with rtp_session_compute_recv_bandwidth()
int rtp_session_get_recv_payload_type | ( | const RtpSession * | session | ) |
session | a rtp session |
RtpProfile* rtp_session_get_recv_profile | ( | RtpSession * | session | ) |
session | a rtp session Returns current receive profile. |
uint32_t rtp_session_get_recv_ssrc | ( | RtpSession * | session | ) |
Get the SSRC for the incoming stream.
If no packets have been received yet, 0 is returned.
float rtp_session_get_round_trip_propagation | ( | RtpSession * | session | ) |
Returns the last known round trip propagation delay.
This value is known after successful RTCP SR or RR exchanged between a sender and a receiver. oRTP automatically takes care of sending SR or RR packets. You might want to call this function when you receive an RTCP event (see rtp_session_register_event_queue() ). This value might not be known: at the beginning when no RTCP packets have been exchanged yet, or simply because the rtcp channel is broken due to firewall problematics, or because the remote implementation does not support RTCP.
float rtp_session_get_send_bandwidth | ( | RtpSession * | session | ) |
Get last computed send bandwidth. Computation must have been done with rtp_session_compute_send_bandwidth()
int rtp_session_get_send_payload_type | ( | const RtpSession * | session | ) |
session | a rtp session |
RtpProfile* rtp_session_get_send_profile | ( | RtpSession * | session | ) |
session | a rtp session Returns current send profile. |
uint32_t rtp_session_get_send_ssrc | ( | RtpSession * | session | ) |
Get the SSRC for the outgoing stream.
session | a rtp session. |
uint16_t rtp_session_get_seq_number | ( | RtpSession * | session | ) |
Get the current sequence number for outgoing stream.
const rtp_stats_t* rtp_session_get_stats | ( | const RtpSession * | session | ) |
Retrieve the session's statistics.
RtpSession* rtp_session_new | ( | int | mode | ) |
Creates a new rtp session. If the session is able to send data (RTP_SESSION_SENDONLY or RTP_SESSION_SENDRECV), then a random SSRC number is choosed for the outgoing stream.
mode | One of the RtpSessionMode flags. |
mblk_t* rtp_session_pick_with_cseq | ( | RtpSession * | session, |
const uint16_t | sequence_number | ||
) |
Try to get an rtp packet presented as a mblk_t structure from the rtp session at a given sequence number. This function is very usefull for codec with Forward error correction capabilities
This function returns the entire packet (with header).
session | a rtp session. |
sequence_number | a sequence number. |
int rtp_session_recv_with_ts | ( | RtpSession * | session, |
uint8_t * | buffer, | ||
int | len, | ||
uint32_t | ts, | ||
int * | have_more | ||
) |
NOTE: use of this function is discouraged when sending payloads other than pcm/pcmu/pcma/adpcm types. rtp_session_recvm_with_ts() does better job.
Tries to read the bytes of the incoming rtp stream related to timestamp ts. In case where the user supplied buffer buffer is not large enough to get all the data related to timestamp ts, then *( have_more) is set to 1 to indicate that the application should recall the function with the same timestamp to get more data.
When the rtp session is scheduled (see rtp_session_set_scheduling_mode() ), and the blocking mode is on (see rtp_session_set_blocking_mode() ), then the calling thread is suspended until the timestamp given as argument expires, whatever a received packet fits the query or not.
Important note: it is clear that the application cannot know the timestamp of the first packet of the incoming stream, because it can be random. The ts timestamp given to the function is used relatively to first timestamp of the stream. In simple words, 0 is a good value to start calling this function.
This function internally calls rtp_session_recvm_with_ts() to get a rtp packet. The content of this packet is then copied into the user supplied buffer in an intelligent manner: the function takes care of the size of the supplied buffer and the timestamp given in argument. Using this function it is possible to read continous audio data (e.g. pcma,pcmu...) with for example a standart buffer of size of 160 with timestamp incrementing by 160 while the incoming stream has a different packet size.
Returns: if a packet was availlable with the corresponding timestamp supplied in argument then the number of bytes written in the user supplied buffer is returned. If no packets are availlable, either because the sender has not started to send the stream, or either because silence packet are not transmitted, or either because the packet was lost during network transport, then the function returns zero.
session | a rtp session. |
buffer | a user supplied buffer to write the data. |
len | the length in bytes of the user supplied buffer. |
ts | the timestamp wanted. |
have_more | the address of an integer to indicate if more data is availlable for the given timestamp. |
mblk_t* rtp_session_recvm_with_ts | ( | RtpSession * | session, |
uint32_t | user_ts | ||
) |
Try to get a rtp packet presented as a mblk_t structure from the rtp session. The user_ts parameter is relative to the first timestamp of the incoming stream. In other words, the application does not have to know the first timestamp of the stream, it can simply call for the first time this function with user_ts=0, and then incrementing it as it want. The RtpSession takes care of synchronisation between the stream timestamp and the user timestamp given here.
This function returns the entire packet (with header).
The behaviour of this function has changed since version 0.15.0. Previously the payload data could be accessed using mblk_t::b_cont::b_rptr field of the returned mblk_t. This is no more the case. The convenient way of accessing the payload data is to use rtp_get_payload() :
OR simply skip the header this way, the data is then comprised between mp->b_rptr and mp->b_wptr:
session | a rtp session. |
user_ts | a timestamp. |
void rtp_session_refresh_sockets | ( | RtpSession * | session | ) |
Requests the session to re-create and bind its RTP and RTCP sockets same as they are currently. This is used when a change in the routing rules of the host or process was made, in order to have this routing rules change taking effect on the RTP/RTCP packets sent by the session.
void rtp_session_register_event_queue | ( | RtpSession * | session, |
OrtpEvQueue * | q | ||
) |
Register an event queue. An application can use an event queue to get informed about various RTP events.
void rtp_session_release_sockets | ( | RtpSession * | session | ) |
Closes the rtp and rtcp sockets, and associated RtpTransport.
void rtp_session_reset | ( | RtpSession * | session | ) |
Reset the session: local and remote addresses are kept. It resets timestamp, sequence number, and calls rtp_session_resync().
session | a rtp session. |
void rtp_session_resync | ( | RtpSession * | session | ) |
Resynchronize to the incoming RTP streams. This can be useful to handle discontinuous timestamps. For example, call this function from the timestamp_jump signal handler.
session | the rtp session |
int rtp_session_rtcp_sendm_raw | ( | RtpSession * | session, |
mblk_t * | m | ||
) |
Send the rtcp datagram packet to the destination set by rtp_session_set_remote_addr() The packet (packet) is freed once it is sent.
session | a rtp session. |
m | a rtcp packet presented as a mblk_t. |
void rtp_session_rtcp_set_delay_value | ( | struct _RtpSession * | s, |
const unsigned int | value | ||
) |
For test purpose only, simulates a constant RTT (Round Trip Time) value by setting the LSR field within all returned RTCP output packets.
.
The RTT processing involves two RTCP packets exchanged between two different devices.
In a normal operation the device 1 issues a SR packets at time T0, hence this packet has a timestamp field set to T0. The LSR and DLSR fiels of that packet are not considered here. This packet is received by the Device 2 at T1. In response, the Device 2 issues another SR or RR packets at T2 with the following fields;
This packet is received by The Device 1 at T3. So the Device 1 is now able to process the RTT using the formula : RTT = T3 - LSR - DLSR = (T1 - T0) - (T3 - T2).
This way of processing is described in par. 6.4 of the RFC3550 standard.
In the test mode that is enabled by this procedure, the RTCP stack is considered as beeing part of the device 2. For setting the RTT to a constant RTT0 value, the Device 2 artificially sets the LSR field of the second packet to (T1 - RTT0), instead of T0 in normal mode. The two other fields (timestamp and DLSR) are set as in the normal mode. So the Device 1 will process : RTT = T3 - LSR - DLSR = RTT0 + (T3 - T2) that is near to RTT0 is T3 - T2 is small enough.
s | : the rtp session. |
value | : The desired RTT test vector value (RTT0). |
void rtp_session_rtcp_set_jitter_value | ( | struct _RtpSession * | s, |
const unsigned int | value | ||
) |
For test purpose only, sets a constant interarrival_jitter value within all RTCP output packets.
.
The SR or RR RTCP packet contain an interarrival jitter field. After this procedure is called, the interarrival jitter field will be set to a constant value in all output SR or RR packets. This parameter will overridden the actual interarrival jitter value that was processed by the RTCP stack.
s | : the rtp session. |
value | : the interarrival jitter test vector value. |
void rtp_session_rtcp_set_lost_packet_value | ( | struct _RtpSession * | s, |
const int | value | ||
) |
For test purpose only, sets a constant lost packet value within all RTCP output packets.
.
The SR or RR RTCP packet contain a lost packet field. After this procedure is called, the lost packet field will be set to a constant value in all output SR or RR packets. This parameter will overridden the actual number of lost packets in the input RTP stream that the RTCP stack had previously processed.
s | : the rtp session. |
value | : the lost packets test vector value. |
int rtp_session_send_with_ts | ( | RtpSession * | session, |
const uint8_t * | buffer, | ||
int | len, | ||
uint32_t | userts | ||
) |
Send a rtp datagram to the destination set by rtp_session_set_remote_addr() containing the data from buffer with timestamp userts. This is a high level function that uses rtp_session_create_packet() and rtp_session_sendm_with_ts() to send the data.
session | a rtp session. |
buffer | a buffer containing the data to be sent in a rtp packet. |
len | the length of the data buffer, in bytes. |
userts | the timestamp of the data to be sent. Refer to the rfc to know what it is. |
int rtp_session_sendm_with_ts | ( | RtpSession * | session, |
mblk_t * | packet, | ||
uint32_t | timestamp | ||
) |
Send the rtp datagram packet to the destination set by rtp_session_set_remote_addr() with timestamp timestamp. For audio data, the timestamp is the number of the first sample resulting of the data transmitted. See rfc1889 for details. The packet (packet) is freed once it is sent.
session | a rtp session. |
packet | a rtp packet presented as a mblk_t. |
timestamp | the timestamp of the data to be sent. |
void rtp_session_set_blocking_mode | ( | RtpSession * | session, |
int | yesno | ||
) |
This function implicitely enables the scheduling mode if yesno is TRUE. rtp_session_set_blocking_mode() defines the behaviour of the rtp_session_recv_with_ts() and rtp_session_send_with_ts() functions. If yesno is TRUE, rtp_session_recv_with_ts() will block until it is time for the packet to be received, according to the timestamp passed to the function. After this time, the function returns. For rtp_session_send_with_ts(), it will block until it is time for the packet to be sent. If yesno is FALSE, then the two functions will return immediately.
session | a rtp session |
yesno | a boolean |
void rtp_session_set_connected_mode | ( | RtpSession * | session, |
bool_t | yesno | ||
) |
If yesno is TRUE, thus a connect() syscall is done on the socket to the destination address set by rtp_session_set_remote_addr(), or if the session does symmetric rtp (see rtp_session_set_symmetric_rtp()) a the connect() is done to the source address of the first packet received. Connecting a socket has effect of rejecting all incoming packets that don't come from the address specified in connect(). It also makes ICMP errors (such as connection refused) available to the application.
session | a rtp session |
yesno | a boolean to enable or disable the feature |
void rtp_session_set_data | ( | RtpSession * | session, |
void * | data | ||
) |
Stores some application specific data into the session, so that it is easy to retrieve it from the signal callbacks using rtp_session_get_data().
session | a rtp session |
data | an opaque pointer to be stored in the session |
int rtp_session_set_dscp | ( | RtpSession * | session, |
int | dscp | ||
) |
rtp_session_set_dscp:
session | a rtp session |
dscp | desired DSCP PHB value |
Sets the DSCP (Differentiated Services Code Point) for outgoing RTP packets.
Returns: 0 on success.
void rtp_session_set_jitter_compensation | ( | RtpSession * | session, |
int | milisec | ||
) |
session | a RtpSession |
milisec | the time interval in milisec to be jitter compensed. |
Sets the time interval for which packet are buffered instead of being delivered to the application.
int rtp_session_set_local_addr | ( | RtpSession * | session, |
const char * | addr, | ||
int | rtp_port, | ||
int | rtcp_port | ||
) |
rtp_session_set_local_addr:
session | a rtp session freshly created. |
addr | a local IP address in the xxx.xxx.xxx.xxx form. |
rtp_port | a local port or -1 to let oRTP choose the port randomly |
rtcp_port | a local port or -1 to let oRTP choose the port randomly Specify the local addr to be use to listen for rtp packets or to send rtp packet from. In case where the rtp session is send-only, then it is not required to call this function: when calling rtp_session_set_remote_addr(), if no local address has been set, then the default INADRR_ANY (0.0.0.0) IP address with a random port will be used. Calling rtp_session_set_local_addr() is mandatory when the session is recv-only or duplex. Returns: 0 on success. |
int rtp_session_set_multicast_loopback | ( | RtpSession * | session, |
int | yesno | ||
) |
session | a rtp session |
yesno | desired Multicast Time-To-Live |
Sets the TTL (Time-To-Live) for outgoing multicast packets.
Returns: 0 on success.
int rtp_session_set_multicast_ttl | ( | RtpSession * | session, |
int | ttl | ||
) |
rtp_session_set_multicast_ttl:
session | a rtp session |
ttl | desired Multicast Time-To-Live |
Sets the TTL (Time-To-Live) for outgoing multicast packets.
Returns: 0 on success.
int rtp_session_set_payload_type | ( | RtpSession * | session, |
int | pt | ||
) |
Sets the expected payload type for incoming packets and payload type to be used for outgoing packets. If the actual payload type in incoming packets is different that this expected payload type, thus the "payload_type_changed" signal is emitted.
session | a rtp session |
pt | the payload type number |
int rtp_session_set_pktinfo | ( | RtpSession * | session, |
int | activate | ||
) |
rtp_session_set_pktinfo:
session | a rtp session |
activate | activation flag (0 to deactivate, other value to activate) |
(De)activates packet info for incoming and outgoing packets.
Returns: 0 on success.
void rtp_session_set_profile | ( | RtpSession * | session, |
RtpProfile * | profile | ||
) |
Set the RTP profile to be used for the session. By default, all session are created by rtp_session_new() are initialized with the AV profile, as defined in RFC 3551. The application can set any other profile instead using that function.
session | a rtp session |
profile | a rtp profile |
void rtp_session_set_recv_buf_size | ( | RtpSession * | session, |
int | bufsize | ||
) |
The default value is UDP_MAX_SIZE bytes, a value which is working for mostly everyone. However if your application can make assumption on the sizes of received packet, it can be interesting to set it to a lower value in order to save memory.
session | a rtp session |
bufsize | max size in bytes for receiving packets |
int rtp_session_set_recv_payload_type | ( | RtpSession * | session, |
int | paytype | ||
) |
Sets the expected payload type for incoming packets. If the actual payload type in incoming packets is different that this expected payload type, thus the "payload_type_changed" signal is emitted.
session | a rtp session |
paytype | the payload type number |
void rtp_session_set_recv_profile | ( | RtpSession * | session, |
RtpProfile * | profile | ||
) |
Set the RTP profile to be used for the receiveing by this session. By default, all session are created by rtp_session_new() are initialized with the AV profile, as defined in RFC 3551. The application can set any other profile instead using that function.
session | a rtp session |
profile | a rtp profile |
int rtp_session_set_remote_addr | ( | RtpSession * | session, |
const char * | addr, | ||
int | port | ||
) |
rtp_session_set_remote_addr:
session | a rtp session freshly created. |
addr | a local IP address in the xxx.xxx.xxx.xxx form. |
port | a local port. Sets the remote address of the rtp session, ie the destination address where rtp packet are sent. If the session is recv-only or duplex, it also sets the origin of incoming RTP packets. Rtp packets that don't come from addr:port are discarded. Returns: 0 on success. |
int rtp_session_set_remote_addr_full | ( | RtpSession * | session, |
const char * | rtp_addr, | ||
int | rtp_port, | ||
const char * | rtcp_addr, | ||
int | rtcp_port | ||
) |
rtp_session_set_remote_addr_full:
session | a rtp session freshly created. |
rtp_addr | a local IP address in the xxx.xxx.xxx.xxx form. |
rtp_port | a local rtp port. |
rtcp_addr | a local IP address in the xxx.xxx.xxx.xxx form. |
rtcp_port | a local rtcp port. Sets the remote address of the rtp session, ie the destination address where rtp packet are sent. If the session is recv-only or duplex, it also sets the origin of incoming RTP packets. Rtp packets that don't come from addr:port are discarded. Returns: 0 on success. |
void rtp_session_set_rtcp_report_interval | ( | RtpSession * | session, |
int | value_ms | ||
) |
Sets the default interval in milliseconds for RTCP reports emitted by the session
void rtp_session_set_rtp_socket_recv_buffer_size | ( | RtpSession * | session, |
unsigned int | size | ||
) |
Set kernel recv maximum buffer size for the rtp socket. A value of zero defaults to the operating system default.
void rtp_session_set_rtp_socket_send_buffer_size | ( | RtpSession * | session, |
unsigned int | size | ||
) |
Set kernel send maximum buffer size for the rtp socket. A value of zero defaults to the operating system default.
void rtp_session_set_scheduling_mode | ( | RtpSession * | session, |
int | yesno | ||
) |
Sets the scheduling mode of the rtp session. If yesno is TRUE, the rtp session is in the scheduled mode, that means that you can use session_set_select() to block until it's time to receive or send on this session according to the timestamp passed to the respective functions. You can also use blocking mode (see rtp_session_set_blocking_mode() ), to simply block within the receive and send functions. If yesno is FALSE, the ortp scheduler will not manage those sessions, meaning that blocking mode and the use of session_set_select() for this session are disabled.
session | a rtp session. |
yesno | a boolean to indicate the scheduling mode. |
int rtp_session_set_send_payload_type | ( | RtpSession * | session, |
int | paytype | ||
) |
Sets the payload type of the rtp session. It decides of the payload types written in the of the rtp header for the outgoing stream, if the session is SENDRECV or SENDONLY. For payload type in incoming packets, the application can be informed by registering for the "payload_type_changed" signal, so that it can make the necessary changes on the downstream decoder that deals with the payload of the packets.
session | a rtp session |
paytype | the payload type number |
void rtp_session_set_send_profile | ( | RtpSession * | session, |
RtpProfile * | profile | ||
) |
Set the RTP profile to be used for the sending by this session. By default, all session are created by rtp_session_new() are initialized with the AV profile, as defined in RFC 3551. The application can set any other profile instead using that function.
session | a rtp session |
profile | a rtp profile |
int rtp_session_set_send_telephone_event_payload_type | ( | RtpSession * | session, |
int | paytype | ||
) |
Assign the payload type number for sending telephone-event. It is required that a "telephone-event" PayloadType is assigned in the RtpProfile set for the RtpSession. This function is in most of cases useless, unless there is an ambiguity where several PayloadType for "telephone-event" are present in the RtpProfile. This might happen during SIP offeranswer scenarios. This function allows to remove any ambiguity by letting the application choose the one to be used.
session | the RtpSession |
paytype | the payload type number |
void rtp_session_set_seq_number | ( | RtpSession * | session, |
uint16_t | seq | ||
) |
Set the initial sequence number for outgoing stream..
session | a rtp session freshly created. |
seq | a 16 bit unsigned number. |
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 | ||
) |
Set session's SDES item for automatic sending of RTCP compound packets. If some items are not specified, use NULL.
void rtp_session_set_ssrc | ( | RtpSession * | session, |
uint32_t | ssrc | ||
) |
Sets the SSRC for the outgoing stream. If not done, a random ssrc is used.
session | a rtp session. |
ssrc | an unsigned 32bit integer representing the synchronisation source identifier (SSRC). |
void rtp_session_set_ssrc_changed_threshold | ( | RtpSession * | session, |
int | numpackets | ||
) |
Sets the number of packets containing a new SSRC that will trigger the "ssrc_changed" callback.
void rtp_session_set_symmetric_rtp | ( | RtpSession * | session, |
bool_t | yesno | ||
) |
Enable or disable the "rtp symmetric" hack which consists of the following: after the first packet is received, the source address of the packet is set to be the destination address for all next packets. This is useful to pass-through firewalls.
session | a rtp session |
yesno | a boolean to enable or disable the feature |
void rtp_session_set_time_jump_limit | ( | RtpSession * | session, |
int | milisecs | ||
) |
oRTP has the possibility to inform the application through a callback registered with rtp_session_signal_connect about crazy incoming RTP stream that jumps from a timestamp N to N+some_crazy_value. This lets the opportunity for the application to reset the session in order to resynchronize, or any other action like stopping the call and reporting an error.
session | the rtp session |
milisecs | a time interval in miliseconds |
int rtp_session_signal_connect | ( | RtpSession * | session, |
const char * | signal_name, | ||
RtpCallback | cb, | ||
void * | user_data | ||
) |
This function provides the way for an application to be informed of various events that may occur during a rtp session. signal_name is a string identifying the event, and cb is a user supplied function in charge of processing it. The application can register several callbacks for the same signal, in the limit of RTP_CALLBACK_TABLE_MAX_ENTRIES. Here are name and meaning of supported signals types:
"ssrc_changed" : the SSRC of the incoming stream has changed.
"payload_type_changed" : the payload type of the incoming stream has changed.
"telephone-event_packet" : a telephone-event rtp packet (RFC2833) is received.
"telephone-event" : a telephone event has occured. This is a high-level shortcut for "telephone-event_packet".
"network_error" : a network error happened on a socket. Arguments of the callback functions are a const char * explaining the error, an int errno error code and the user_data as usual.
"timestamp_jump" : we have received a packet with timestamp in far future compared to last timestamp received. The farness of far future is set by rtp_sesssion_set_time_jump_limit() "rtcp_bye": we have received a RTCP bye packet. Arguments of the callback functions are a const char * containing the leaving reason and the user_data.
Returns: 0 on success, -EOPNOTSUPP if the signal does not exists, -1 if no more callbacks can be assigned to the signal type.
session | a rtp session |
signal_name | the name of a signal |
cb | a RtpCallback |
user_data | a pointer to any data to be passed when invoking the callback. |
int rtp_session_signal_disconnect_by_callback | ( | RtpSession * | session, |
const char * | signal_name, | ||
RtpCallback | cb | ||
) |
Removes callback function cb to the list of callbacks for signal signal.
session | a rtp session |
signal_name | a signal name |
cb | a callback function. |