![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include <errno.h>#include <inttypes.h>#include <stdatomic.h>#include "memory.h"#include "debug.h"#include "net_udp.h"#include "crypto/crypt_des.h"#include "crypto/crypt_aes.h"#include "tv.h"#include "crypto/md5.h"#include "ntp.h"#include "rtp.h"#include "utils/misc.h"#include "utils/net.h"#include "utils/random.h"
Go to the source code of this file.
Classes | |
| struct | _rtcp_rr_wrapper |
| struct | _source |
| struct | options |
| struct | rtcp_common |
| struct | rtcp_t |
| struct | rtp |
Macros | |
| #define | IPPORT_DYNAMIC ((1U<<15U) + (1U<<14U)) |
| #define | IPPORT_MAX ((1U<<16U) - 1U) |
| #define | max(a, b) |
| #define | MAX_DROPOUT 3000 |
| #define | MAX_ENCRYPTION_PAD 16 |
| #define | MAX_MISORDER 100 |
| #define | MAXCNAMELEN 255 |
| #define | min(a, b) |
| #define | MIN_SEQUENTIAL 2 |
| #define | MOD_NAME "[rtp] " |
| #define | RTCP_APP 204 |
| #define | RTCP_BYE 203 |
| #define | RTCP_RR 201 |
| #define | RTCP_RX 205 |
| #define | RTCP_SDES 202 |
| #define | RTCP_SR 200 |
| #define | RTP_DB_SIZE 11 |
| #define | RTP_LOWER_LAYER_OVERHEAD 28 /* IPv4 + UDP */ |
| #define | RTP_MAX_SDES_LEN 256 |
| #define | RTP_SEQ_MOD 0x10000 |
Typedefs | |
| typedef struct _rtcp_rr_wrapper | rtcp_rr_wrapper |
| typedef bool(* | rtp_decrypt_func) (struct rtp *, unsigned char *data, unsigned int size, unsigned char *initvec) |
| typedef int(* | rtp_encrypt_func) (struct rtp *, unsigned char *data, unsigned int size, unsigned char *initvec) |
| typedef struct _source | source |
Functions | |
| static int | add_sdes_item (uint8_t *buf, int buflen, int type, const char *val) |
| static void | check_database (struct rtp *session) |
| static void | check_source (source *s) |
| static void | compute_loss_intervals (struct rtp *session, rtp_packet *packet) |
| static uint32_t | compute_rtt (struct rtp *session, rtcp_rx *rrx) |
| static source * | create_source (struct rtp *session, uint32_t ssrc, int probation) |
| static void | delete_source (struct rtp *session, uint32_t ssrc) |
| static bool | des_decrypt (struct rtp *session, unsigned char *data, unsigned int size, unsigned char *initVec) |
| static int | des_encrypt (struct rtp *session, unsigned char *data, unsigned int size, unsigned char *initVec) |
| static bool | des_initialize (struct rtp *session, const u_char *hash, int hash_len) |
| static int | filter_event (struct rtp *session, uint32_t ssrc) |
| static int | format_report_blocks (rtcp_rr *rrp, int remaining_length, struct rtp *session) |
| static uint8_t * | format_rtcp_app (uint8_t *buffer, int buflen, uint32_t ssrc, rtcp_app *app) |
| static uint8_t * | format_rtcp_rr (uint8_t *buffer, int buflen, struct rtp *session) |
| static uint8_t * | format_rtcp_sdes (uint8_t *buffer, int buflen, uint32_t ssrc, struct rtp *session) |
| static uint8_t * | format_rtcp_sr (uint8_t *buffer, int buflen, struct rtp *session, uint32_t rtp_ts) |
| static char * | get_cname (socket_udp *s) |
| static const rtcp_rr * | get_rr (struct rtp *session, uint32_t reporter_ssrc, uint32_t reportee_ssrc) |
| static source * | get_source (struct rtp *session, uint32_t ssrc) |
| static void | init_opt (struct rtp *session) |
| static void | init_seq (source *s, uint16_t seq) |
| static void | insert_rr (struct rtp *session, uint32_t reporter_ssrc, rtcp_rr *rr, rtcp_rx *rx) |
| static uint32_t | next_csrc (struct rtp *session) |
| static void | process_report_blocks (struct rtp *session, rtcp_t *packet, uint32_t ssrc, rtcp_rr *rrp, rtcp_rx *rrx) |
| static void | process_rtcp_app (struct rtp *session, rtcp_t *packet) |
| static void | process_rtcp_bye (struct rtp *session, rtcp_t *packet) |
| static void | process_rtcp_rr (struct rtp *session, rtcp_t *packet) |
| static void | process_rtcp_rx (struct rtp *session, rtcp_t *packet) |
| static void | process_rtcp_sdes (struct rtp *session, rtcp_t *packet) |
| static void | process_rtcp_sr (struct rtp *session, rtcp_t *packet) |
| static void | process_rtp (struct rtp *session, uint32_t curr_rtp_ts, rtp_packet *packet, source *s) |
| static source * | really_create_source (struct rtp *session, uint32_t ssrc, int probation, source *s) |
| static void | remove_rr (struct rtp *session, uint32_t ssrc) |
| static bool | rijndael_decrypt (struct rtp *session, unsigned char *data, unsigned int size, unsigned char *initVec) |
| static int | rijndael_encrypt (struct rtp *session, unsigned char *data, unsigned int size, unsigned char *initVec) |
| static bool | rijndael_initialize (struct rtp *session, const u_char *hash, int hash_len) |
| static double | rtcp_interval (struct rtp *session) |
| bool | rtcp_recv_r (struct rtp *session, struct timeval *timeout, uint32_t curr_rtp_ts) |
| static void | rtcp_udp_send (struct rtp *session, int len, char *buffer) |
| 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) |
| struct rtp * | 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) |
| struct rtp * | 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) |
| static void | rtp_process_ctrl (struct rtp *session, uint8_t *buffer, int buflen) |
| static void | rtp_process_data (struct rtp *session, uint32_t curr_rtp_ts, uint8_t *buffer, rtp_packet *packet, int buflen) |
| bool | rtp_recv (struct rtp *session, struct timeval *timeout, uint32_t curr_rtp_ts) |
| static int | rtp_recv_data (struct rtp *session, uint32_t curr_rtp_ts) |
| 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) |
| static void | rtp_send_bye_now (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) |
| static void | send_rtcp (struct rtp *session, uint32_t rtp_ts, rtcp_app_callback appcallback) |
| static int | ssrc_hash (uint32_t ssrc) |
| static void | timeout_rr (struct rtp *session, time_ns_t curr_ts) |
| static int | update_seq (source *s, uint16_t seq) |
| static int | validate_rtcp (uint8_t *packet, int len) |
| static bool | validate_rtp (struct rtp *session, rtp_packet *packet, int len, int vlen) |
| static bool | validate_rtp2 (rtp_packet *packet, int len, int vlen) |
Definition in file rtp.c.
| #define IPPORT_DYNAMIC ((1U<<15U) + (1U<<14U)) |
Definition at line 102 of file rtp.c.
Referenced by rtp_init_if().
| #define IPPORT_MAX ((1U<<16U) - 1U) |
Definition at line 103 of file rtp.c.
Referenced by rtp_init_if().
| #define max | ( | a, | |
| b ) |
Definition at line 98 of file rtp.c.
Referenced by audio_append_pcm(), audio_codec_decompress(), calculate_rms_helper(), clamp(), clamp(), display_bluefish444_get_property(), dxt_encode< 1 >(), FindMinMaxColorsBox(), max(), max(), print_help_item(), ScaleYCoCg(), set_audio_delay(), and wait_for_channel().
| #define MAX_DROPOUT 3000 |
Definition at line 125 of file rtp.c.
Referenced by update_seq().
| #define MAX_ENCRYPTION_PAD 16 |
Definition at line 109 of file rtp.c.
Referenced by rtp_send_bye_now(), and send_rtcp().
| #define MAX_MISORDER 100 |
Definition at line 126 of file rtp.c.
Referenced by update_seq().
| #define MAXCNAMELEN 255 |
Definition at line 905 of file rtp.c.
Referenced by get_cname().
| #define min | ( | a, | |
| b ) |
Definition at line 99 of file rtp.c.
Referenced by adjust_params(), audio_append_pcm(), clamp(), clamp(), dxt_encode< 1 >(), image_pattern_bars::fill(), image_pattern_ebu_smpte_bars< f, columns >::fill(), FindMinMaxColorsBox(), gl_process_frames(), min(), min(), linear_mix_algo< source_t, intermediate_t >::normalize(), print_bmd_attribute(), ultragrid::aja::display::process_frames(), process_new_audio_packets(), and respawn_parallel().
| #define MIN_SEQUENTIAL 2 |
Definition at line 127 of file rtp.c.
Referenced by rtp_process_data(), and update_seq().
| #define RTCP_APP 204 |
Definition at line 142 of file rtp.c.
Referenced by format_rtcp_app(), rtp_process_ctrl(), and validate_rtcp().
| #define RTCP_BYE 203 |
Definition at line 141 of file rtp.c.
Referenced by rtp_process_ctrl(), rtp_send_bye_now(), and validate_rtcp().
| #define RTCP_RR 201 |
Definition at line 139 of file rtp.c.
Referenced by format_rtcp_rr(), rtp_process_ctrl(), and validate_rtcp().
| #define RTCP_RX 205 |
Definition at line 143 of file rtp.c.
Referenced by rtp_process_ctrl().
| #define RTCP_SDES 202 |
Definition at line 140 of file rtp.c.
Referenced by format_rtcp_sdes(), rtp_process_ctrl(), and validate_rtcp().
| #define RTCP_SR 200 |
Definition at line 138 of file rtp.c.
Referenced by format_rtcp_sr(), rtp_process_ctrl(), and validate_rtcp().
| #define RTP_DB_SIZE 11 |
Definition at line 247 of file rtp.c.
Referenced by check_database(), format_report_blocks(), next_csrc(), remove_rr(), rtp_compute_fract_lost(), rtp_done(), rtp_init_if(), rtp_init_with_udp_socket(), rtp_send_ctrl(), rtp_update(), ssrc_hash(), and timeout_rr().
| #define RTP_LOWER_LAYER_OVERHEAD 28 /* IPv4 + UDP */ |
Definition at line 136 of file rtp.c.
Referenced by rtp_process_ctrl(), and rtp_send_bye().
| #define RTP_SEQ_MOD 0x10000 |
Definition at line 133 of file rtp.c.
Referenced by init_seq(), and update_seq().
| typedef struct _rtcp_rr_wrapper rtcp_rr_wrapper |
| typedef bool(* rtp_decrypt_func) (struct rtp *, unsigned char *data, unsigned int size, unsigned char *initvec) |
| typedef int(* rtp_encrypt_func) (struct rtp *, unsigned char *data, unsigned int size, unsigned char *initvec) |
|
static |
Definition at line 3075 of file rtp.c.
References rtcp_sdes_item::data, debug_msg, rtcp_sdes_item::length, rtcp_sdes_item::type, type, and val.
Referenced by format_rtcp_sdes().
|
inlinestatic |
Definition at line 540 of file rtp.c.
References check_source(), rtp::db, rtp::magic, rtp::my_ssrc, _source::next, _source::prev, RTP_DB_SIZE, _source::sr, _source::ssrc, rtcp_sr::ssrc, rtp::ssrc_count, ssrc_hash(), and UNUSED.
Referenced by delete_source(), des_initialize(), get_source(), really_create_source(), rtcp_recv_r(), rtp_add_csrc(), rtp_del_csrc(), rtp_done(), rtp_get_rr(), rtp_get_sdes(), rtp_get_sr(), rtp_get_userdata(), rtp_my_ssrc(), rtp_recv(), rtp_recv_poll_r(), rtp_recv_r(), rtp_send_bye(), rtp_send_bye_now(), rtp_send_ctrl(), rtp_send_data_hdr(), rtp_set_encryption_key(), rtp_set_sdes(), rtp_update(), and send_rtcp().

|
inlinestatic |
Definition at line 530 of file rtp.c.
References _source::magic, and UNUSED.
Referenced by check_database(), delete_source(), format_report_blocks(), get_source(), init_seq(), process_rtcp_app(), process_rtcp_bye(), rtp_add_csrc(), rtp_compute_fract_lost(), rtp_del_csrc(), rtp_get_sdes(), rtp_get_sr(), rtp_send_ctrl(), rtp_set_sdes(), rtp_update(), and update_seq().
|
static |
Definition at line 660 of file rtp.c.
References get_source(), get_time_in_ns(), _source::last_active, and really_create_source().
Referenced by process_report_blocks(), process_rtcp_app(), process_rtcp_bye(), process_rtcp_rr(), process_rtcp_rx(), process_rtcp_sdes(), process_rtcp_sr(), process_rtp(), rtp_add_csrc(), rtp_init_if(), rtp_init_with_udp_socket(), and rtp_process_data().

|
static |
Definition at line 673 of file rtp.c.
References rtp::callback, check_database(), check_source(), rtp::csrc_count, rtp::db, filter_event(), get_source(), get_time_in_ns(), rtp::last_advertised_csrc, rtp::last_rtcp_send_time, _source::next, rtp::next_rtcp_send_time, NS_IN_SEC, _source::prev, remove_rr(), _source::sdes_cname, _source::sdes_email, _source::sdes_loc, _source::sdes_name, _source::sdes_note, _source::sdes_phone, _source::sdes_priv, _source::sdes_tool, _source::should_advertise_sdes, SOURCE_DELETED, _source::sr, rtp::ssrc_count, rtp::ssrc_count_prev, ssrc_hash(), and TRUE.
Referenced by rtp_done(), and rtp_update().

|
static |
Definition at line 3863 of file rtp.c.
References rtp::crypto_state, rtp::des, rtp::encryption_key, and qfDES_CBC_d.
Referenced by des_initialize().
|
static |
Definition at line 3855 of file rtp.c.
References rtp::crypto_state, rtp::des, rtp::encryption_key, qfDES_CBC_e, and TRUE.
Referenced by des_initialize().
|
static |
Definition at line 3816 of file rtp.c.
References check_database(), rtp::crypto_state, rtp::decrypt_func, rtp::des, des_decrypt(), des_encrypt(), rtp::encrypt_func, rtp::encryption_key, rtp::encryption_pad_length, key, and UNUSED.
Referenced by rtp_set_encryption_key().

|
inlinestatic |
Definition at line 338 of file rtp.c.
References options::filter_my_packets, rtp::opt, and rtp_my_ssrc().
Referenced by delete_source(), process_report_blocks(), process_rtcp_app(), process_rtcp_bye(), process_rtcp_sdes(), process_rtcp_sr(), process_rtp(), really_create_source(), rtp_process_ctrl(), and timeout_rr().

|
static |
Definition at line 2935 of file rtp.c.
References _source::base_seq, check_source(), _source::cycles, rtp::db, rtcp_rr::dlsr, _source::expected_prior, FALSE, rtcp_rr::fract_lost, _source::jitter, rtcp_rr::jitter, rtcp_rr::last_seq, _source::last_sr_frac, _source::last_sr_sec, rtcp_rr::lsr, _source::max_seq, _source::next, ntp64_time(), ntp64_to_ntp32, rtcp_sr::ntp_frac, rtcp_sr::ntp_sec, _source::received, _source::received_prior, RTP_DB_SIZE, _source::sender, rtp::sender_count, _source::sr, _source::ssrc, rtcp_rr::ssrc, and rtcp_rr::total_lost.
Referenced by format_rtcp_rr(), and format_rtcp_sr().

|
static |
Definition at line 3234 of file rtp.c.
References app, rtcp_app::data, rtcp_app::length, rtcp_app::name, rtcp_app::p, rtcp_app::pt, RTCP_APP, RTP_VERSION, rtcp_app::ssrc, rtcp_app::subtype, and rtcp_app::version.
Referenced by send_rtcp().
|
static |
Definition at line 3048 of file rtp.c.
References rtcp_t::common, rtcp_common::count, format_report_blocks(), rtcp_common::length, rtp::my_ssrc, rtcp_common::p, rtcp_common::pt, rtcp_t::r, rtcp_t::rr, RTCP_RR, rtcp_rr::ssrc, and rtcp_common::version.
Referenced by rtp_send_bye_now(), and send_rtcp().

|
static |
Definition at line 3094 of file rtp.c.
References add_sdes_item(), rtcp_common::count, rtcp_common::length, rtcp_common::p, rtcp_common::pt, RTCP_SDES, RTCP_SDES_CNAME, RTCP_SDES_EMAIL, RTCP_SDES_END, RTCP_SDES_LOC, RTCP_SDES_NAME, RTCP_SDES_NOTE, RTCP_SDES_PHONE, RTCP_SDES_PRIV, RTCP_SDES_TOOL, rtp_get_sdes(), rtp::sdes_count_pri, rtp::sdes_count_sec, rtp::sdes_count_ter, and rtcp_common::version.
Referenced by send_rtcp().

|
static |
Definition at line 3012 of file rtp.c.
References rtcp_t::common, rtcp_common::count, format_report_blocks(), rtcp_common::length, ntp64_time(), rtcp_sr::ntp_frac, rtcp_sr::ntp_sec, rtcp_common::p, rtcp_common::pt, rtcp_t::r, RTCP_SR, rtp::rtp_bcount, rtp_my_ssrc(), rtp::rtp_pcount, rtcp_sr::rtp_ts, rtcp_sr::sender_bcount, rtcp_sr::sender_pcount, rtcp_t::sr, rtcp_sr::ssrc, and rtcp_common::version.
Referenced by send_rtcp().

|
static |
Definition at line 907 of file rtp.c.
References MAXCNAMELEN, name, and udp_host_addr().
Referenced by rtp_init_if(), and rtp_init_with_udp_socket().

|
static |
Definition at line 512 of file rtp.c.
References _rtcp_rr_wrapper::next, _rtcp_rr_wrapper::reporter_ssrc, _rtcp_rr_wrapper::rr, rtp::rr, rtcp_rr::ssrc, ssrc_hash(), and start().
Referenced by rtp_get_rr().

Definition at line 596 of file rtp.c.
References check_database(), check_source(), rtp::db, _source::next, _source::ssrc, and ssrc_hash().
Referenced by create_source(), delete_source(), process_rtcp_app(), process_rtcp_bye(), rtp_add_csrc(), rtp_del_csrc(), rtp_get_sdes(), rtp_get_sr(), rtp_process_data(), and rtp_set_sdes().

|
static |
Definition at line 966 of file rtp.c.
References FALSE, 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, and rtp_set_option().
Referenced by rtp_init_if(), and rtp_init_with_udp_socket().

|
inlinestatic |
Definition at line 765 of file rtp.c.
References _source::bad_seq, _source::base_seq, check_source(), _source::cycles, _source::expected_prior, _source::max_seq, _source::received, _source::received_prior, RTP_SEQ_MOD, and seq.
Referenced by update_seq().

|
static |
Definition at line 386 of file rtp.c.
References debug_msg, get_time_in_ns(), _rtcp_rr_wrapper::next, _rtcp_rr_wrapper::prev, _rtcp_rr_wrapper::reporter_ssrc, _rtcp_rr_wrapper::rr, rtp::rr, _rtcp_rr_wrapper::rx, rtcp_rr::ssrc, ssrc_hash(), start(), and _rtcp_rr_wrapper::ts.
Referenced by process_report_blocks().

|
static |
Definition at line 344 of file rtp.c.
References rtp::csrc_count, rtp::db, rtp::last_advertised_csrc, _source::next, and RTP_DB_SIZE.
Referenced by send_rtcp().
|
static |
Definition at line 1846 of file rtp.c.
References rtp::callback, rtcp_t::common, rtcp_common::count, create_source(), rtcp_rr::dlsr, FALSE, filter_event(), rtcp_rr::fract_lost, insert_rr(), rtcp_rr::jitter, rtcp_rr::last_seq, rtcp_rr::lsr, rtcp_rx::p, RX_RR, RX_RR_EMPTY, rtcp_rr::ssrc, rtcp_rx::tdelay, rtcp_rr::total_lost, rtcp_rx::ts, and rtcp_rx::x_recv.
Referenced by process_rtcp_rr(), process_rtcp_rx(), and process_rtcp_sr().

Definition at line 2074 of file rtp.c.
References app, rtcp_t::app, rtp::callback, check_source(), rtcp_t::common, rtcp_common::count, create_source(), rtcp_t::data, debug_msg, FALSE, filter_event(), get_source(), rtcp_common::length, rtcp_t::name, rtcp_common::p, rtcp_common::pt, rtcp_t::r, RTP_MAX_PACKET_LEN, RX_APP, rtcp_t::ssrc, and rtcp_common::version.
Referenced by rtp_process_ctrl().

Definition at line 2045 of file rtp.c.
References rtcp_t::bye, rtp::bye_count, rtp::callback, check_source(), rtcp_t::common, rtcp_common::count, create_source(), FALSE, filter_event(), get_source(), _source::got_bye, rtcp_t::r, RX_BYE, rtcp_t::ssrc, and TRUE.
Referenced by rtp_process_ctrl().

Definition at line 1948 of file rtp.c.
References rtcp_t::common, rtcp_common::count, create_source(), debug_msg, FALSE, rtcp_common::length, process_report_blocks(), rtcp_t::r, rtcp_t::rr, and rtcp_rr::ssrc.
Referenced by rtp_process_ctrl().

Definition at line 1967 of file rtp.c.
References rtcp_t::common, rtcp_common::count, create_source(), debug_msg, FALSE, rtcp_common::length, process_report_blocks(), rtcp_t::r, and rtcp_t::rx.
Referenced by rtp_process_ctrl().

Definition at line 1987 of file rtp.c.
References rtp::callback, rtcp_t::common, count, rtcp_common::count, create_source(), rtcp_sdes_item::data, debug_msg, FALSE, filter_event(), rtcp_common::length, rtcp_sdes_item::length, rtcp_t::r, rtp_set_sdes(), RX_SDES, rtcp_t::sdes, and rtcp_sdes_item::type.
Referenced by rtp_process_ctrl().

Definition at line 1898 of file rtp.c.
References rtp::callback, rtcp_t::common, rtcp_common::count, create_source(), debug_msg, FALSE, filter_event(), _source::last_sr_frac, _source::last_sr_sec, rtcp_common::length, ntp64_time(), rtcp_sr::ntp_frac, rtcp_sr::ntp_sec, process_report_blocks(), rtcp_t::r, rtcp_sr::rtp_ts, RX_SR, _source::sender, rtcp_sr::sender_bcount, rtp::sender_count, rtcp_sr::sender_pcount, _source::sr, rtcp_t::sr, rtcp_sr::ssrc, and TRUE.
Referenced by rtp_process_ctrl().

|
static |
Definition at line 1474 of file rtp.c.
References rtp::callback, compute_loss_intervals(), create_source(), FALSE, filter_event(), _source::jitter, RX_RTP, _source::sender, rtp::sender_count, rtp::tfrc_on, _source::transit, and TRUE.
Referenced by rtp_process_data().

|
static |
Definition at line 610 of file rtp.c.
References rtp::callback, check_database(), rtp::db, debug_msg, filter_event(), get_time_in_ns(), _source::last_active, _source::magic, rtp::my_ssrc, _source::next, _source::prev, _source::probation, SOURCE_CREATED, _source::ssrc, rtp::ssrc_count, and ssrc_hash().
Referenced by create_source().

|
static |
Definition at line 432 of file rtp.c.
References _rtcp_rr_wrapper::next, _rtcp_rr_wrapper::prev, _rtcp_rr_wrapper::reporter_ssrc, _rtcp_rr_wrapper::rr, rtp::rr, RTP_DB_SIZE, rtcp_rr::ssrc, ssrc_hash(), and start().
Referenced by delete_source().

|
static |
Definition at line 3917 of file rtp.c.
References blockDecrypt(), rtp::cipherInst, rtp::crypto_state, rtp::keyInstDecrypt, rtp::rijndael, and UNUSED.
Referenced by rijndael_initialize().

|
static |
Definition at line 3900 of file rtp.c.
References blockEncrypt(), rtp::cipherInst, rtp::crypto_state, rtp::keyInstEncrypt, rtp::rijndael, and UNUSED.
Referenced by rijndael_initialize().

|
static |
Definition at line 3871 of file rtp.c.
References cipherInit(), rtp::cipherInst, rtp::crypto_state, debug_msg, rtp::decrypt_func, DIR_DECRYPT, DIR_ENCRYPT, rtp::encrypt_func, rtp::encryption_pad_length, rtp::keyInstDecrypt, rtp::keyInstEncrypt, makeKey(), MODE_ECB, rtp::rijndael, rijndael_decrypt(), and rijndael_encrypt().
Referenced by rtp_set_encryption_key().

|
static |
Definition at line 832 of file rtp.c.
References rtp::avg_rtcp_size, rtp::bye_count, rtp::initial_rtcp, rtp::rtcp_bw, rtp::rtcp_interval, rtp::sender_count, rtp::sending_bye, rtp::ssrc_count, ug_drand(), and rtp::we_sent.
Referenced by rtp_init_if(), rtp_init_with_udp_socket(), rtp_send_bye(), rtp_send_ctrl(), and rtp_update().

| 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().

|
static |
Sends the RTCP packet over UDP to either a configured host (if specified on the command-line) or to the destination from which we are receiving RTCP.
Definition at line 3263 of file rtp.c.
References len, LOG_LEVEL_WARNING, log_msg(), rtp::rtcp_dest, rtp::rtcp_dest_len, rtp::rtcp_socket, rtp::send_rtcp_to_origin, udp_send(), udp_sendto(), and ug_strerror().
Referenced by rtp_send_bye_now(), and send_rtcp().

| 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().

| struct rtp * 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.

| struct rtp * 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().

|
static |
Definition at line 2127 of file rtp.c.
References app, rtcp_t::app, rtp::avg_rtcp_size, rtcp_t::bye, rtp::callback, rtcp_t::common, compute_rtt(), debug_msg, rtp::decrypt_func, rtp::encryption_enabled, FALSE, filter_event(), first, rtp::invalid_rtcp_count, rtcp_common::length, process_rtcp_app(), process_rtcp_bye(), process_rtcp_rr(), process_rtcp_rx(), process_rtcp_sdes(), process_rtcp_sr(), rtcp_common::pt, rtcp_t::r, rtcp_t::rr, RTCP_APP, RTCP_BYE, RTCP_RR, RTCP_RX, RTCP_SDES, RTCP_SR, RTP_LOWER_LAYER_OVERHEAD, rtp_my_ssrc(), rtcp_t::rx, RX_RTCP_FINISH, RX_RTCP_START, RX_TFRC_RX, rtcp_t::sdes, rtcp_t::sr, rtcp_rr::ssrc, rtcp_sr::ssrc, rtcp_t::ssrc, rtp::tfrc_on, TRUE, and validate_rtcp().
Referenced by rtcp_recv_r(), rtp_recv(), rtp_recv_poll_r(), rtp_recv_r(), rtp_send_bye(), rtp_send_bye_now(), and send_rtcp().

|
static |
Definition at line 1559 of file rtp.c.
References create_source(), debug_msg, rtp::decrypt_func, rtp::encryption_enabled, FALSE, get_sockaddr_str(), get_source(), rtp::invalid_rtp_count, LOG_LEVEL_NOTICE, log_msg(), _source::max_seq, MIN_SEQUENTIAL, rtp::opt, _source::probation, process_rtp(), options::promiscuous_mode, options::reuse_bufs, rtp_has_receiver(), RTP_MAX_PACKET_LEN, rtp::rtp_socket, options::send_back, rtp::tfrc_on, TRUE, udp_set_receiver(), update_seq(), validate_rtp(), and options::wait_for_rtcp.
Referenced by rtp_recv_data().

| 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().

|
static |
Definition at line 1523 of file rtp.c.
References rtp::mt_recv, rtp::opt, options::record_source, options::reuse_bufs, RTP_MAX_PACKET_LEN, rtp_packet, RTP_PACKET_HEADER_SIZE, rtp_process_data(), rtp::rtp_socket, udp_recv_data(), and udp_recvfrom().
Referenced by rtp_recv(), rtp_recv_poll_r(), and rtp_recv_r().

| 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.

|
static |
Definition at line 3525 of file rtp.c.
References check_database(), rtcp_common::count, rtp::encrypt_func, rtp::encryption_enabled, rtp::encryption_pad_length, format_rtcp_rr(), rtcp_common::length, MAX_ENCRYPTION_PAD, rtp::my_ssrc, rtcp_common::p, rtcp_common::pt, RTCP_BYE, rtcp_udp_send(), RTP_MAX_PACKET_LEN, rtp_process_ctrl(), TRUE, ug_rand(), and rtcp_common::version.
Referenced by rtp_send_bye().

| 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().

|
static |
Definition at line 3284 of file rtp.c.
References app, check_database(), rtp::csrc_count, rtp::encrypt_func, rtp::encryption_enabled, rtp::encryption_pad_length, format_rtcp_app(), format_rtcp_rr(), format_rtcp_sdes(), format_rtcp_sr(), MAX_ENCRYPTION_PAD, next_csrc(), rtcp_udp_send(), RTP_MAX_PACKET_LEN, rtp_my_ssrc(), rtp_process_ctrl(), rtp::sender_count, TRUE, ug_rand(), and rtp::we_sent.
Referenced by rtp_send_ctrl().

|
inlinestatic |
Definition at line 371 of file rtp.c.
References RTP_DB_SIZE.
Referenced by check_database(), delete_source(), get_rr(), get_source(), insert_rr(), really_create_source(), remove_rr(), and rtp_set_my_ssrc().
Definition at line 474 of file rtp.c.
References rtp::callback, filter_event(), _rtcp_rr_wrapper::next, NS_IN_SEC, _rtcp_rr_wrapper::prev, _rtcp_rr_wrapper::reporter_ssrc, _rtcp_rr_wrapper::rr, rtp::rr, RR_TIMEOUT, rtp::rtcp_interval, RTP_DB_SIZE, start(), and _rtcp_rr_wrapper::ts.
Referenced by rtp_update().

|
static |
Definition at line 778 of file rtp.c.
References _source::bad_seq, check_source(), _source::cycles, init_seq(), MAX_DROPOUT, MAX_MISORDER, _source::max_seq, MIN_SEQUENTIAL, _source::probation, _source::received, RTP_SEQ_MOD, and seq.
Referenced by rtp_process_data().

|
static |
Definition at line 1670 of file rtp.c.
References rtcp_t::common, count, rtcp_common::count, debug_dump(), debug_msg, FALSE, len, rtcp_common::length, rtcp_sdes_item::length, rtcp_common::p, rtcp_common::pt, rtcp_t::r, RTCP_APP, RTCP_BYE, RTCP_RR, RTCP_SDES, RTCP_SR, rtcp_t::sdes, TRUE, rtcp_sdes_item::type, and rtcp_common::version.
Referenced by rtp_process_ctrl().

|
inlinestatic |
Definition at line 1447 of file rtp.c.
References debug_msg, FALSE, len, rtp::opt, validate_rtp2(), and options::wait_for_rtcp.
Referenced by rtp_process_data().

|
static |
Definition at line 1407 of file rtp.c.
References debug_msg, and len.
Referenced by validate_rtp().