![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include "config_win32.h"#include "config_unix.h"#include <cstddef>#include <cstdint>#include "tv.h"#include "video_codec.h"

Go to the source code of this file.
Classes | |
| struct | rtcp_app |
| struct | rtcp_rr |
| struct | rtcp_rx |
| struct | rtcp_sdes_item |
| struct | rtcp_sr |
| struct | rtp_event |
Macros | |
| #define | RTP_MAX_MTU 9000 |
| #define | RTP_MAX_PACKET_LEN (RTP_MAX_MTU+RTP_PACKET_HEADER_SIZE+MAX_PADDING) |
| #define | RTP_PACKET_HEADER_SIZE ((int) (offsetof(rtp_packet, extn_type) - offsetof(rtp_packet, csrc) + sizeof ((rtp_packet *) 0)->extn_type)) |
| #define | RTP_VERSION 2 |
Typedefs | |
| typedef rtcp_app *(* | rtcp_app_callback) (struct rtp *session, uint32_t rtp_ts, int max_size) |
| typedef void(* | rtp_callback) (struct rtp *session, rtp_event *e) |
| typedef struct rtp * | rtp_t |
Enumerations | |
| enum | { IPV4_HDR_LEN = 20 , IPV6_HDR_LEN = 40 , UDP_HDR_LEN = 8 , RTP_HDR_LEN = 12 } |
| enum | rtcp_sdes_type { RTCP_SDES_END = 0 , RTCP_SDES_CNAME = 1 , RTCP_SDES_NAME = 2 , RTCP_SDES_EMAIL = 3 , RTCP_SDES_PHONE = 4 , RTCP_SDES_LOC = 5 , RTCP_SDES_TOOL = 6 , RTCP_SDES_NOTE = 7 , RTCP_SDES_PRIV = 8 } |
| enum | rtp_event_type { RX_RTP , RX_RTP_IOV , RX_SR , RX_RR , RX_TFRC_RX , RX_SDES , RX_BYE , SOURCE_CREATED , SOURCE_DELETED , RX_RR_EMPTY , RX_RTCP_START , RX_RTCP_FINISH , RR_TIMEOUT , RX_APP , PEEK_RTP } |
| enum | rtp_option { RTP_OPT_PROMISC = 1 , RTP_OPT_WEAK_VALIDATION = 2 , RTP_OPT_FILTER_MY_PACKETS = 3 , RTP_OPT_REUSE_PACKET_BUFS = 4 , RTP_OPT_PEEK = 5 , RTP_OPT_RECORD_SOURCE = 6 , RTP_OPT_SEND_BACK = 7 } |
Functions | |
| struct | __attribute__ ((packed)) |
| bool | rtcp_recv_r (struct rtp *session, struct timeval *timeout, uint32_t curr_rtp_ts) |
| bool | rtp_add_csrc (struct rtp *session, uint32_t csrc) |
| void | rtp_async_start (struct rtp *session, int nr_packets) |
| void | rtp_async_wait (struct rtp *session) |
| int | rtp_compute_fract_lost (struct rtp *session, uint32_t ssrc) |
| bool | rtp_del_csrc (struct rtp *session, uint32_t csrc) |
| void | rtp_done (struct rtp *session) |
| void | rtp_flush_recv_buf (struct rtp *session) |
| uint64_t | rtp_get_bytes_sent (struct rtp *session) |
| bool | rtp_get_option (struct rtp *session, rtp_option optname, int *optval) |
| int | rtp_get_recv_buf (struct rtp *session) |
| const rtcp_rr * | rtp_get_rr (struct rtp *session, uint32_t reporter, uint32_t reportee) |
| const char * | rtp_get_sdes (struct rtp *session, uint32_t ssrc, rtcp_sdes_type type) |
| const rtcp_sr * | rtp_get_sr (struct rtp *session, uint32_t ssrc) |
| struct socket_udp_local * | rtp_get_udp_local_socket (struct rtp *session) |
| int | rtp_get_udp_rx_port (struct rtp *session) |
| uint8_t * | rtp_get_userdata (struct rtp *session) |
| bool | rtp_has_receiver (struct rtp *session) |
| rtp_t | rtp_init (const char *addr, uint16_t rx_port, uint16_t tx_port, int ttl, double rtcp_bw, int tfrc_on, rtp_callback callback, uint8_t *userdata, int force_ip_version, bool multithreaded) |
| rtp_t | rtp_init_if (const char *addr, const char *iface, uint16_t rx_port, uint16_t tx_port, int ttl, double rtcp_bw, int tfrc_on, rtp_callback callback, uint8_t *userdata, int force_ip_version, bool multithreaded) |
| rtp_t | rtp_init_with_udp_socket (struct socket_udp_local *l, struct sockaddr *sa, socklen_t len, rtp_callback callback) |
| bool | rtp_is_ipv6 (struct rtp *session) |
| uint32_t | rtp_my_ssrc (struct rtp *session) |
| bool | rtp_recv (struct rtp *session, struct timeval *timeout, uint32_t curr_rtp_ts) __attribute__((deprecated)) |
| int | rtp_recv_poll_r (struct rtp **sessions, struct timeval *timeout, uint32_t curr_rtp_ts) |
| bool | rtp_recv_r (struct rtp *session, struct timeval *timeout, uint32_t curr_rtp_ts) |
| Receive RTP packets and dispatch them. | |
| void | rtp_send_bye (struct rtp *session) |
| void | rtp_send_ctrl (struct rtp *session, uint32_t rtp_ts, rtcp_app_callback appcallback, time_ns_t curr_time) |
| int | rtp_send_data (struct rtp *session, uint32_t rtp_ts, char pt, int m, int cc, const uint32_t *csrc, char *data, int data_len, char *extn, uint16_t extn_len, uint16_t extn_type) |
| int | rtp_send_data_hdr (struct rtp *session, uint32_t rtp_ts, char pt, int m, int cc, const uint32_t *csrc, char *phdr, int phdr_len, char *data, int data_len, char *extn, uint16_t extn_len, uint16_t extn_type) |
| int | rtp_send_raw_rtp_data (struct rtp *session, char *buffer, int buffer_len) |
| bool | rtp_set_encryption_key (struct rtp *session, const char *passphrase) |
| bool | rtp_set_my_ssrc (struct rtp *session, uint32_t ssrc) |
| bool | rtp_set_option (struct rtp *session, rtp_option optname, int optval) |
| bool | rtp_set_recv_buf (struct rtp *session, int bufsize) |
| void | rtp_set_recv_iov (struct rtp *session, struct msghdr *m) |
| bool | rtp_set_sdes (struct rtp *session, uint32_t ssrc, rtcp_sdes_type type, const char *value, int length) |
| bool | rtp_set_send_buf (struct rtp *session, int bufsize) |
| void | rtp_update (struct rtp *session, time_ns_t curr_time) |
Variables | |
| rtp_packet | |
| #define RTP_MAX_MTU 9000 |
Definition at line 60 of file rtp.h.
Referenced by adjust_params(), and tx_init().
| #define RTP_MAX_PACKET_LEN (RTP_MAX_MTU+RTP_PACKET_HEADER_SIZE+MAX_PADDING) |
Definition at line 61 of file rtp.h.
Referenced by audio_tx_send_chan(), decode_audio_frame(), decode_video_frame(), process_rtcp_app(), rtcp_recv_r(), rtp_process_data(), rtp_recv(), rtp_recv_data(), rtp_recv_poll_r(), rtp_recv_r(), rtp_send_bye(), rtp_send_bye_now(), rtp_send_data_hdr(), send_rtcp(), tx_send_base(), and udp_reader().
| #define RTP_PACKET_HEADER_SIZE ((int) (offsetof(rtp_packet, extn_type) - offsetof(rtp_packet, csrc) + sizeof ((rtp_packet *) 0)->extn_type)) |
Definition at line 128 of file rtp.h.
Referenced by rtp_recv_data(), rtp_send_data_hdr(), and udp_reader().
| #define RTP_VERSION 2 |
Definition at line 59 of file rtp.h.
Referenced by format_rtcp_app().
| anonymous enum |
| Enumerator | |
|---|---|
| IPV4_HDR_LEN | |
| IPV6_HDR_LEN | |
| UDP_HDR_LEN | |
| RTP_HDR_LEN | |
| enum rtcp_sdes_type |
| Enumerator | |
|---|---|
| RTCP_SDES_END | |
| RTCP_SDES_CNAME | |
| RTCP_SDES_NAME | |
| RTCP_SDES_EMAIL | |
| RTCP_SDES_PHONE | |
| RTCP_SDES_LOC | |
| RTCP_SDES_TOOL | |
| RTCP_SDES_NOTE | |
| RTCP_SDES_PRIV | |
Definition at line 208 of file rtp.h.
| enum rtp_event_type |
| Enumerator | |
|---|---|
| RX_RTP | |
| RX_RTP_IOV | |
| RX_SR | |
| RX_RR | |
| RX_TFRC_RX | |
| RX_SDES | |
| RX_BYE | |
| SOURCE_CREATED | |
| SOURCE_DELETED | |
| RX_RR_EMPTY | |
| RX_RTCP_START | |
| RX_RTCP_FINISH | |
| RR_TIMEOUT | |
| RX_APP | |
| PEEK_RTP | |
Definition at line 179 of file rtp.h.
| enum rtp_option |
| Enumerator | |
|---|---|
| RTP_OPT_PROMISC | |
| RTP_OPT_WEAK_VALIDATION | |
| RTP_OPT_FILTER_MY_PACKETS | |
| RTP_OPT_REUSE_PACKET_BUFS | |
| RTP_OPT_PEEK | |
| RTP_OPT_RECORD_SOURCE | |
| RTP_OPT_SEND_BACK | |
Definition at line 227 of file rtp.h.
| struct __attribute__ | ( | (packed) | ) |
Definition at line 81 of file rtp.h.
References __attribute__::data, seq, and ts.
Referenced by avg_lines(), compute_loss_event(), qfDES(), read_adobe_app14(), read_sos(), and rtp_send_data_hdr().
| bool rtcp_recv_r | ( | struct rtp * | session, |
| struct timeval * | timeout, | ||
| uint32_t | curr_rtp_ts ) |
Similar to rtp_recv_r(), expect that it only receives data from RTCP socket. This should be used when the socket acts as a sender only, therefore rtp_recv_r() is not called. Running rtp_recv_r() instead would cause leaks in this context (because RTP packets are usually pushed into PBUF which is not processed by sender and thus it will grow indefinitely).
Definition at line 2398 of file rtp.c.
References check_database(), rtp::rtcp_dest, rtp::rtcp_dest_len, rtp::rtcp_socket, RTP_MAX_PACKET_LEN, rtp_process_ctrl(), udp_fd_isset_r(), udp_fd_set_r(), udp_fd_zero_r(), udp_recvfrom(), udp_select_r(), and UNUSED.
Referenced by audio_sender_thread(), and ultragrid_rtp_video_rxtx::send_frame_async().

| bool rtp_add_csrc | ( | struct rtp * | session, |
| uint32_t | csrc ) |
rtp_add_csrc: @session: the session pointer (returned by rtp_init()) @csrc: Constributing SSRC identifier
Adds @csrc to list of contributing sources used in SDES items. Used by mixers and transcoders.
Return value: true.
Definition at line 2478 of file rtp.c.
References check_database(), check_source(), create_source(), rtp::csrc_count, debug_msg, FALSE, get_source(), _source::should_advertise_sdes, and TRUE.

| void rtp_async_start | ( | struct rtp * | session, |
| int | nr_packets ) |
Definition at line 4027 of file rtp.c.
References rtp::rtp_socket, and udp_async_start().
Referenced by tx_send_base().

| void rtp_async_wait | ( | struct rtp * | session | ) |
Definition at line 4032 of file rtp.c.
References rtp::rtp_socket, and udp_async_wait().
Referenced by tx_send_base().

| int rtp_compute_fract_lost | ( | struct rtp * | session, |
| uint32_t | ssrc ) |
Definition at line 3974 of file rtp.c.
References _source::base_seq, check_source(), _source::cycles, rtp::db, _source::expected_prior, _source::max_seq, _source::next, _source::received, _source::received_prior, RTP_DB_SIZE, and _source::ssrc.

| bool rtp_del_csrc | ( | struct rtp * | session, |
| uint32_t | csrc ) |
rtp_del_csrc: @session: the session pointer (returned by rtp_init()) @csrc: Constributing SSRC identifier
Removes @csrc from list of contributing sources used in SDES items. Used by mixers and transcoders.
| true | on success, false if @csrc is not a valid source. |
Definition at line 2510 of file rtp.c.
References check_database(), check_source(), rtp::csrc_count, debug_msg, FALSE, get_source(), rtp::last_advertised_csrc, and _source::should_advertise_sdes.

| void rtp_done | ( | struct rtp * | session | ) |
rtp_done: @session: the RTP session to finish
Free the state associated with the given RTP session. This function does not send any packets (e.g. an RTCP BYE) - an application which wishes to exit in a clean manner should call rtp_send_bye() first.
Definition at line 3676 of file rtp.c.
References check_database(), rtp::db, delete_source(), rtp::my_ssrc, _source::next, rtp::opt, rtp::rtcp_socket, RTP_DB_SIZE, rtp::rtp_socket, _source::ssrc, and udp_exit().
Referenced by am_participant::~am_participant(), audio_done(), audio_receiver_process_message(), audio_sender_process_message(), rtp_video_rxtx::destroy_rtp_device(), and vidcap_rtsp_done().

| void rtp_flush_recv_buf | ( | struct rtp * | session | ) |
rtp_flush_recv_buf: Flushes receiver buffer contents. @session: The RTP Session.
Definition at line 3964 of file rtp.c.
References rtp::rtp_socket, and udp_flush_recv_buf().
Referenced by audio_receiver_thread().

| uint64_t rtp_get_bytes_sent | ( | struct rtp * | session | ) |
| bool rtp_get_option | ( | struct rtp * | session, |
| rtp_option | optname, | ||
| int * | optval ) |
rtp_get_option: @session: The RTP session. @optname: The option name, see rtp_option. @optval: The return value.
Retrieves the value of a session option. See rtp_option for documentation on the options and their legal values.
Definition at line 1352 of file rtp.c.
References debug_msg, options::filter_my_packets, rtp::opt, options::promiscuous_mode, options::reuse_bufs, RTP_OPT_FILTER_MY_PACKETS, RTP_OPT_PROMISC, RTP_OPT_REUSE_PACKET_BUFS, RTP_OPT_WEAK_VALIDATION, and options::wait_for_rtcp.
| int rtp_get_recv_buf | ( | struct rtp * | session | ) |
Definition at line 3944 of file rtp.c.
References rtp::rtp_socket, and udp_get_recv_buf().
Referenced by ultragrid_rtp_video_rxtx::receiver_loop().

rtp_get_rr: @session: the session pointer (returned by rtp_init()) @reporter: participant originating receiver report @reportee: participant included in receiver report
Retrieve the latest receiver report on @reportee made by @reporter. Provides an indication of other receivers reception service.
Return value: A pointer to a rtcp_rr structure on success, NULL otherwise. The pointer must not be freed.
Definition at line 2707 of file rtp.c.
References check_database(), and get_rr().
Referenced by process_rr().

| const char * rtp_get_sdes | ( | struct rtp * | session, |
| uint32_t | ssrc, | ||
| rtcp_sdes_type | type ) |
rtp_get_sdes: @session: the session pointer (returned by rtp_init()) @ssrc: the SSRC identifier of a participant @type: the SDES information to retrieve
Recovers session description (SDES) information on participant identified with @ssrc. The SDES information associated with a source is updated when receiver reports are received. There are several different types of SDES information, e.g. username, location, phone, email. These are enumerated by rtcp_sdes_type.
Return value: pointer to string containing SDES description if received, NULL otherwise.
Definition at line 2631 of file rtp.c.
References check_database(), check_source(), debug_msg, get_source(), RTCP_SDES_CNAME, RTCP_SDES_EMAIL, RTCP_SDES_LOC, RTCP_SDES_NAME, RTCP_SDES_NOTE, RTCP_SDES_PHONE, RTCP_SDES_PRIV, RTCP_SDES_TOOL, _source::sdes_cname, _source::sdes_email, _source::sdes_loc, _source::sdes_name, _source::sdes_note, _source::sdes_phone, _source::sdes_priv, _source::sdes_tool, and type.
Referenced by format_rtcp_sdes().

rtp_get_sr: @session: the session pointer (returned by rtp_init()) @ssrc: identifier of source
Retrieve the latest sender report made by sender with @ssrc identifier.
Return value: A pointer to an rtcp_sr structure on success, NULL otherwise. The pointer must not be freed.
Definition at line 2679 of file rtp.c.
References check_database(), check_source(), get_source(), and _source::sr.

| struct socket_udp_local * rtp_get_udp_local_socket | ( | struct rtp * | session | ) |
Definition at line 4037 of file rtp.c.
References rtp::rtp_socket, and udp_get_local().
Referenced by audio_play_mixer_ctl().

| int rtp_get_udp_rx_port | ( | struct rtp * | session | ) |
Definition at line 4042 of file rtp.c.
References rtp::rtp_socket, and udp_get_udp_rx_port().
Referenced by set_audio_spec_to_vrxtx(), and vidcap_rtsp_init().

| uint8_t * rtp_get_userdata | ( | struct rtp * | session | ) |
rtp_get_userdata: @session: The RTP session.
This function returns the userdata pointer that was passed to the rtp_init() or rtp_init_if() function when creating this session.
Returns: pointer to userdata.
Definition at line 1386 of file rtp.c.
References check_database(), and rtp::userdata.
Referenced by rtp_recv_callback().

| bool rtp_has_receiver | ( | struct rtp * | session | ) |
Definition at line 4016 of file rtp.c.
References rtp::opt, rtp::rtp_socket, options::send_back, and udp_is_server_mode_blackhole().
Referenced by audio_tx_send(), rtp_process_data(), and tx_send_base().

| rtp_t rtp_init | ( | const char * | addr, |
| uint16_t | rx_port, | ||
| uint16_t | tx_port, | ||
| int | ttl, | ||
| double | rtcp_bw, | ||
| int | tfrc_on, | ||
| rtp_callback | callback, | ||
| uint8_t * | userdata, | ||
| int | force_ip_version, | ||
| bool | multithreaded ) |
rtp_init: @addr: IP destination of this session (unicast or multicast), as an ASCII string. May be a host name, which will be looked up, or may be an IPv4 dotted quad or IPv6 literal adddress. @rx_port: The port to which to bind the UDP socket @tx_port: The port to which to send UDP packets @ttl: The TTL for both multicast and unicast (-1 for default) @rtcp_bw: The total bandwidth (in units of bytes per second) that is allocated to RTCP. @callback: See section on rtp_callback. @userdata: Opaque data associated with the session. See rtp_get_userdata().
Returns: An opaque session identifier to be used in future calls to the RTP library functions, or NULL on failure.
Definition at line 999 of file rtp.c.
References callback, rtp::rtcp_bw, rtp_init_if(), rtp::tfrc_on, and rtp::userdata.

| rtp_t rtp_init_if | ( | const char * | addr, |
| const char * | iface, | ||
| uint16_t | rx_port, | ||
| uint16_t | tx_port, | ||
| int | ttl, | ||
| double | rtcp_bw, | ||
| int | tfrc_on, | ||
| rtp_callback | callback, | ||
| uint8_t * | userdata, | ||
| int | force_ip_version, | ||
| bool | multithreaded ) |
rtp_init_if: @addr: IP destination of this session (unicast or multicast), as an ASCII string. May be a host name, which will be looked up, or may be an IPv4 dotted quad or IPv6 literal adddress. @iface: If the destination of the session is multicast, the optional interface to bind to. May be NULL, in which case the default multicast interface as determined by the system will be used. @rx_port: The port to which to bind the UDP socket @tx_port: The port to which to send UDP packets @ttl: The TTL for both multicast and unicast (-1 for default) @rtcp_bw: The total bandwidth (in units of ___) that is allocated to RTCP. @callback: See section on rtp_callback. @userdata: Opaque data associated with the session. See rtp_get_userdata(). @force_ip_version if IPv4 or IPv4 is requested, pass 4 or 6 respectively, otherwise 0 @multithreaded if set to true uses separate thread to receive data (performance optimization)
Creates and initializes an RTP session.
Returns: An opaque session identifier to be used in future calls to the RTP library functions, or NULL on failure.
Definition at line 1034 of file rtp.c.
References rtp::avg_rtcp_size, rtp::bye_count, callback, rtp::callback, create_source(), rtp::csrc_count, rtp::db, rtp::encryption_algorithm, rtp::encryption_enabled, FALSE, get_cname(), get_time_in_ns(), IN6_BLACKHOLE_SERVER_MODE_STR, init_opt(), rtp::initial_rtcp, rtp::invalid_rtcp_count, rtp::invalid_rtp_count, IPPORT_DYNAMIC, IPPORT_MAX, is_host_loopback(), rtp::last_advertised_csrc, rtp::last_rtcp_send_time, rtp::last_update, LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, log_msg(), rtp::magic, rtp::mhdr, MSG, rtp::mt_recv, rtp::my_ssrc, _rtcp_rr_wrapper::next, rtp::next_rtcp_send_time, NS_IN_SEC, rtp::opt, _rtcp_rr_wrapper::prev, rtp::rr, rtp::rtcp_bw, rtcp_interval(), RTCP_SDES_CNAME, rtp::rtcp_socket, rtp::rtp_bcount, rtp::rtp_bytes_sent, RTP_DB_SIZE, rtp::rtp_pcount, rtp::rtp_seq, rtp_set_sdes(), rtp::rtp_socket, rtp::sdes_count_pri, rtp::sdes_count_sec, rtp::sdes_count_ter, rtp::send_rtcp_to_origin, rtp::sender_count, rtp::sending_bye, rtp::ssrc_count, rtp::ssrc_count_prev, rtp::tfrc_on, TRUE, udp_host_addr(), udp_init_if(), udp_port_pair_is_free(), ug_rand(), rtp::userdata, verbose_msg, and rtp::we_sent.
Referenced by initialize_audio_network(), rtp_video_rxtx::initialize_network(), rtp_init(), and vidcap_rtsp_init().

| rtp_t rtp_init_with_udp_socket | ( | struct socket_udp_local * | l, |
| struct sockaddr * | sa, | ||
| socklen_t | len, | ||
| rtp_callback | callback ) |
Definition at line 1175 of file rtp.c.
References rtp::avg_rtcp_size, rtp::bye_count, callback, rtp::callback, create_source(), rtp::csrc_count, rtp::db, rtp::encryption_algorithm, rtp::encryption_enabled, FALSE, get_cname(), get_time_in_ns(), init_opt(), rtp::initial_rtcp, rtp::invalid_rtcp_count, rtp::invalid_rtp_count, rtp::last_advertised_csrc, rtp::last_rtcp_send_time, rtp::last_update, len, LOG_LEVEL_DEBUG, log_msg(), rtp::magic, rtp::mhdr, rtp::mt_recv, rtp::my_ssrc, _rtcp_rr_wrapper::next, rtp::next_rtcp_send_time, NS_IN_SEC, rtp::opt, _rtcp_rr_wrapper::prev, rtp::rr, rtp::rtcp_bw, rtcp_interval(), RTCP_SDES_CNAME, rtp::rtcp_socket, rtp::rtp_bcount, rtp::rtp_bytes_sent, RTP_DB_SIZE, rtp::rtp_pcount, rtp::rtp_seq, rtp_set_sdes(), rtp::rtp_socket, rtp::sdes_count_pri, rtp::sdes_count_sec, rtp::sdes_count_ter, rtp::send_rtcp_to_origin, rtp::sender_count, rtp::sending_bye, rtp::ssrc_count, rtp::ssrc_count_prev, rtp::tfrc_on, TRUE, udp_host_addr(), udp_init_if(), udp_init_with_local(), ug_rand(), rtp::userdata, and rtp::we_sent.
Referenced by am_participant::am_participant().

| bool rtp_is_ipv6 | ( | struct rtp * | session | ) |
Definition at line 4022 of file rtp.c.
References rtp::rtp_socket, and udp_is_ipv6().
Referenced by audio_tx_send_chan(), h264_sdp_video_rxtx::sdp_add_video(), set_audio_spec_to_vrxtx(), tx_send_base(), and tx_send_jpeg().

| uint32_t rtp_my_ssrc | ( | struct rtp * | session | ) |
rtp_my_ssrc: @session: The RTP Session.
Returns: The SSRC we are currently using in this session. Note that our SSRC can change at any time (due to collisions) so applications must not store the value returned, but rather should call this function each time they need it.
Definition at line 1401 of file rtp.c.
References check_database(), and rtp::my_ssrc.
Referenced by audio_sender_process_message(), filter_event(), format_rtcp_sr(), ultragrid_rtp_video_rxtx::get_ssrc(), initialize_audio_network(), rtp_video_rxtx::initialize_network(), process_rr(), rtp_video_rxtx::process_sender_message(), report_stats(), rtp_process_ctrl(), rtp_update(), send_rtcp(), and vidcap_rtsp_init().

| bool rtp_recv | ( | struct rtp * | session, |
| struct timeval * | timeout, | ||
| uint32_t | curr_rtp_ts ) |
rtp_recv: @session: the session pointer (returned by rtp_init()) @timeout: the amount of time that rtcp_recv() is allowed to block @curr_rtp_ts: the current time expressed in units of the media timestamp.
Receive RTP packets and dispatch them.
| true | if data received, false if the timeout occurred. |
Definition at line 2297 of file rtp.c.
References check_database(), rtp::rtcp_socket, RTP_MAX_PACKET_LEN, rtp_process_ctrl(), rtp_recv_data(), rtp::rtp_socket, udp_fd_isset(), udp_fd_set(), udp_fd_zero(), udp_recv(), and udp_select().

| int rtp_recv_poll_r | ( | struct rtp ** | sessions, |
| struct timeval * | timeout, | ||
| uint32_t | curr_rtp_ts ) |
rtp_recv_poll_r: The meaning is as above with except that this function polls for first nonempty stream and returns data.
| sessions | null-terminated list of rtp sessions. |
| timeout | timeout |
| cur_rtp_ts | list null-terminated of timestamps for each session |
Definition at line 2434 of file rtp.c.
References check_database(), RTP_MAX_PACKET_LEN, rtp_process_ctrl(), rtp_recv_data(), udp_fd_isset_r(), udp_fd_set_r(), udp_fd_zero_r(), udp_recv(), and udp_select_r().

| bool rtp_recv_r | ( | struct rtp * | session, |
| struct timeval * | timeout, | ||
| uint32_t | curr_rtp_ts ) |
Receive RTP packets and dispatch them.
Reentrant variant of rtp_recv()
Currently, this function is the only one of rtp_recv family eligible for multithreaded receiving.
| session | the session pointer (returned by rtp_init()) |
| timeout | the amount of time that rtcp_recv() is allowed to block |
| curr_rtp_ts | the current time expressed in units of the media timestamp. |
| true | if data received |
| false | if the timeout occurred |
Definition at line 2338 of file rtp.c.
References check_database(), rtp::mt_recv, rtp::rtcp_dest, rtp::rtcp_dest_len, rtp::rtcp_socket, RTP_MAX_PACKET_LEN, rtp_process_ctrl(), rtp_recv_data(), rtp::rtp_socket, udp_fd_isset_r(), udp_fd_set_r(), udp_fd_zero_r(), udp_not_empty(), udp_recvfrom(), and udp_select_r().
Referenced by audio_receiver_thread(), ultragrid_rtp_video_rxtx::receiver_loop(), h264_rtp_video_rxtx::send_frame(), h264_sdp_video_rxtx::send_frame(), and vidcap_rtsp_thread().

| void rtp_send_bye | ( | struct rtp * | session | ) |
rtp_send_bye: @session: The RTP session
Sends a BYE message on the RTP session, indicating that this participant is leaving the session. The process of sending a BYE may take some time, and this function will block until it is complete. During this time, RTCP events are reported to the application via the callback function (data packets are silently discarded).
Definition at line 3598 of file rtp.c.
References rtp::avg_rtcp_size, rtp::bye_count, check_database(), rtp::csrc_count, debug_msg, FALSE, get_time_in_ns(), rtp::initial_rtcp, rtp::last_rtcp_send_time, rtp::next_rtcp_send_time, NS_IN_SEC, NS_IN_US, rtcp_interval(), rtp::rtcp_socket, RTP_LOWER_LAYER_OVERHEAD, RTP_MAX_PACKET_LEN, rtp_process_ctrl(), rtp_send_bye_now(), rtp_update(), rtp::sender_count, rtp::sending_bye, rtp::ssrc_count, TRUE, udp_fd_isset(), udp_fd_set(), udp_fd_zero(), udp_recv(), udp_select(), US_IN_SEC, and rtp::we_sent.

| void rtp_send_ctrl | ( | struct rtp * | session, |
| uint32_t | rtp_ts, | ||
| rtcp_app_callback | appcallback, | ||
| time_ns_t | curr_time ) |
rtp_send_ctrl: @session: the session pointer (returned by rtp_init()) @rtp_ts: the current time expressed in units of the media timestamp. @appcallback: a callback to create an APP RTCP packet, if needed.
Checks RTCP timer and sends RTCP data when nececessary. The interval between RTCP packets is randomized over an interval that depends on the session bandwidth, the number of participants, and whether the local participant is a sender. This function should be called at least once per second, and can be safely called more frequently.
Definition at line 3409 of file rtp.c.
References check_database(), check_source(), rtp::csrc_count, rtp::db, FALSE, rtp::initial_rtcp, rtp::last_rtcp_send_time, _source::next, rtp::next_rtcp_send_time, NS_IN_SEC, rtcp_interval(), RTP_DB_SIZE, send_rtcp(), _source::sender, rtp::sender_count, rtp::ssrc_count, and rtp::ssrc_count_prev.
Referenced by audio_receiver_thread(), audio_sender_thread(), audio_tx_send_standard(), ultragrid_rtp_video_rxtx::receiver_loop(), h264_rtp_video_rxtx::send_frame(), h264_sdp_video_rxtx::send_frame(), and ultragrid_rtp_video_rxtx::send_frame_async().

| int rtp_send_data | ( | struct rtp * | session, |
| uint32_t | rtp_ts, | ||
| char | pt, | ||
| int | m, | ||
| int | cc, | ||
| const uint32_t * | csrc, | ||
| char * | data, | ||
| int | data_len, | ||
| char * | extn, | ||
| uint16_t | extn_len, | ||
| uint16_t | extn_type ) |
rtp_send_data: @session: the session pointer (returned by rtp_init()) @rtp_ts: The timestamp reflects the sampling instant of the first octet of the RTP data to be sent. The timestamp is expressed in media units. @pt: The payload type identifying the format of the data. @m: Marker bit, interpretation defined by media profile of payload. @cc: Number of contributing sources (excluding local participant) @csrc: Array of SSRC identifiers for contributing sources. @data: The RTP data to be sent. @data_len: The size @data in bytes. @extn: Extension data (if present). @extn_len: size of @extn in bytes. @extn_type: extension type indicator.
Send an RTP packet. Most media applications will only set the @session, @rtp_ts, @pt, @m, @data, @data_len arguments.
Mixers and translators typically set additional contributing sources arguments (@cc, @csrc).
Extensions fields (@extn, @extn_len, @extn_type) are for including application specific information. When the widest amount of inter-operability is required these fields should be avoided as some applications discard packets with extensions they do not recognize.
Return value: Number of bytes transmitted.
Definition at line 2742 of file rtp.c.
References rtp_send_data_hdr().
Referenced by audio_tx_send_standard(), and tx_send_h264().

| int rtp_send_data_hdr | ( | struct rtp * | session, |
| uint32_t | rtp_ts, | ||
| char | pt, | ||
| int | m, | ||
| int | cc, | ||
| const uint32_t * | csrc, | ||
| char * | phdr, | ||
| int | phdr_len, | ||
| char * | data, | ||
| int | data_len, | ||
| char * | extn, | ||
| uint16_t | extn_len, | ||
| uint16_t | extn_type ) |
Definition at line 2752 of file rtp.c.
References __attribute__(), check_database(), rtp::cmp_rtt, rtp::encrypt_func, rtp::encryption_enabled, rtp::encryption_pad_length, FALSE, get_local_mediatime(), get_time_in_ns(), rtp::last_rtp_send_time, LOG_LEVEL_WARNING, log_msg(), rtp::my_ssrc, rtp::new_rtt, rtp::rtp_bcount, rtp::rtp_bytes_sent, RTP_MAX_PACKET_LEN, rtp_packet, RTP_PACKET_HEADER_SIZE, rtp::rtp_pcount, rtp::rtp_seq, rtp::rtp_socket, rtp::tfrc_on, TRUE, udp_sendv(), ug_strerror(), and rtp::we_sent.
Referenced by audio_tx_send_chan(), rtp_send_data(), tx_send_base(), tx_send_h264(), and tx_send_jpeg().

| int rtp_send_raw_rtp_data | ( | struct rtp * | session, |
| char * | buffer, | ||
| int | buffer_len ) |
Definition at line 1518 of file rtp.c.
References rtp::rtp_socket, and udp_send().

| bool rtp_set_encryption_key | ( | struct rtp * | session, |
| const char * | passphrase ) |
rtp_set_encryption_key: @session: The RTP session. @passphrase: The user-provided "pass phrase" to map to an encryption key.
Converts the user supplied key into a form suitable for use with RTP and install it as the active key. Passing in NULL as the passphrase disables encryption. The passphrase is converted into a DES key as specified in RFC1890, that is:
Note that versions of rat prior to 4.1.2 do not convert the passphrase to canonical form before taking the MD5 hash, and so will not be compatible for keys which are non-invarient under this step.
Determine from the user's encryption key which encryption mechanism we're using. Per the RTP RFC, if the key is of the form
string/key
then "string" is the name of the encryption algorithm, and "key" is the key to be used. If no / is present, then the algorithm is assumed to be (the appropriate variant of) DES.
Definition at line 3742 of file rtp.c.
References check_database(), debug_msg, des_initialize(), rtp::encryption_algorithm, rtp::encryption_enabled, MD5Final(), MD5Init(), MD5Update(), and rijndael_initialize().

| bool rtp_set_my_ssrc | ( | struct rtp * | session, |
| uint32_t | ssrc ) |
rtp_set_my_ssrc: @session: the RTP session @ssrc: the SSRC to be used by the RTP session
This function coerces the local SSRC identifer to be ssrc. For this function to succeed it must be called immediately after rtp_init or rtp_init_if. The intended purpose of this function is to co-ordinate SSRC's between layered sessions, it should not be used otherwise.
Definition at line 1278 of file rtp.c.
References rtp::db, rtp::my_ssrc, rtp::sender_count, _source::ssrc, rtp::ssrc_count, and ssrc_hash().

| bool rtp_set_option | ( | struct rtp * | session, |
| rtp_option | optname, | ||
| int | optval ) |
rtp_set_option: @session: The RTP session. @optname: The option name, see rtp_option. @optval: The value to set.
Sets the value of a session option. See rtp_option for documentation on the options and their legal values.
Definition at line 1308 of file rtp.c.
References debug_msg, options::filter_my_packets, rtp::opt, options::promiscuous_mode, options::record_source, options::reuse_bufs, RTP_OPT_FILTER_MY_PACKETS, RTP_OPT_PROMISC, RTP_OPT_RECORD_SOURCE, RTP_OPT_REUSE_PACKET_BUFS, RTP_OPT_SEND_BACK, RTP_OPT_WEAK_VALIDATION, options::send_back, TRUE, and options::wait_for_rtcp.
Referenced by init_opt(), initialize_audio_network(), rtp_video_rxtx::initialize_network(), and vidcap_rtsp_init().
| bool rtp_set_recv_buf | ( | struct rtp * | session, |
| int | bufsize ) |
Sets receiver buffer size
| session | the RTP Session |
| bufsize | requested recv network buffer size |
Definition at line 3938 of file rtp.c.
References rtp::rtp_socket, and udp_set_recv_buf().
Referenced by audio_update_recv_buf(), initialize_audio_network(), rtp_video_rxtx::initialize_network(), ultragrid_rtp_video_rxtx::receiver_loop(), and vidcap_rtsp_init().

| void rtp_set_recv_iov | ( | struct rtp * | session, |
| struct msghdr * | m ) |
| bool rtp_set_sdes | ( | struct rtp * | session, |
| uint32_t | ssrc, | ||
| rtcp_sdes_type | type, | ||
| const char * | value, | ||
| int | length ) |
rtp_set_sdes: @session: the session pointer (returned by rtp_init()) @ssrc: the SSRC identifier of a participant @type: the SDES type represented by @value @value: the SDES description @length: the length of the description
Sets session description information associated with participant @ssrc. Under normal circumstances applications always use the @ssrc of the local participant, this SDES information is transmitted in receiver reports. Setting SDES information for other participants affects the local SDES entries, but are not transmitted onto the network.
| returns | true if participant exists, false otherwise. |
Definition at line 2546 of file rtp.c.
References check_database(), check_source(), debug_msg, get_source(), RTCP_SDES_CNAME, RTCP_SDES_EMAIL, RTCP_SDES_LOC, RTCP_SDES_NAME, RTCP_SDES_NOTE, RTCP_SDES_PHONE, RTCP_SDES_PRIV, RTCP_SDES_TOOL, _source::sdes_cname, _source::sdes_email, _source::sdes_loc, _source::sdes_name, _source::sdes_note, _source::sdes_phone, _source::sdes_priv, _source::sdes_tool, and type.
Referenced by initialize_audio_network(), rtp_video_rxtx::initialize_network(), process_rtcp_sdes(), rtp_init_if(), rtp_init_with_udp_socket(), and vidcap_rtsp_init().

| bool rtp_set_send_buf | ( | struct rtp * | session, |
| int | bufsize ) |
Sets sender buffer size
| session | the RTP Session |
| bufsize | requested send network buffer size |
Definition at line 3954 of file rtp.c.
References rtp::rtp_socket, and udp_set_send_buf().
Referenced by rtp_video_rxtx::initialize_network(), and vidcap_rtsp_init().

rtp_update: @session: the session pointer (returned by rtp_init())
Trawls through the internal data structures and performs housekeeping. This function should be called at least once per second. It uses an internal timer to limit the number of passes through the data structures to once per second, it can be safely called more frequently.
Definition at line 3456 of file rtp.c.
References check_database(), check_source(), rtp::db, debug_msg, delete_source(), FALSE, _source::got_bye, _source::last_active, rtp::last_rtp_send_time, rtp::last_update, _source::next, NS_IN_SEC, rtcp_interval(), rtp::rtcp_interval, RTP_DB_SIZE, rtp_my_ssrc(), _source::sender, rtp::sender_count, _source::ssrc, timeout_rr(), and rtp::we_sent.
Referenced by audio_receiver_thread(), audio_sender_thread(), ultragrid_rtp_video_rxtx::receiver_loop(), rtp_send_bye(), h264_rtp_video_rxtx::send_frame(), h264_sdp_video_rxtx::send_frame(), ultragrid_rtp_video_rxtx::send_frame_async(), and vidcap_rtsp_thread().

| rtp_packet |
Definition at line 126 of file rtp.h.
Referenced by decode_frame_by_pt(), decode_frame_h264(), decode_frame_jpeg(), decode_video_frame(), decode_yuri_audio_frame(), decode_yuri_video_frame(), rtp_recv_callback(), rtp_recv_data(), and rtp_send_data_hdr().