uvgRTP 3.1.3
An open-source library for RTP/SRTP media delivery
|
RTCP instance handles all incoming and outgoing RTCP traffic, including report generation. More...
#include <rtcp.hh>
Public Member Functions | |
rtp_error_t | send_sdes_packet (const std::vector< uvgrtp::frame::rtcp_sdes_item > &items) |
Send an RTCP SDES packet. | |
rtp_error_t | send_app_packet (const char *name, uint8_t subtype, uint32_t payload_len, const uint8_t *payload) |
Send an RTCP APP packet. | |
rtp_error_t | send_bye_packet (std::vector< uint32_t > ssrcs) |
Send an RTCP BYE packet. | |
void | set_ts_info (uint64_t clock_start, uint32_t clock_rate, uint32_t rtp_ts_start) |
Provide timestamping information for RTCP. | |
rtp_error_t | install_sender_hook (void(*hook)(uvgrtp::frame::rtcp_sender_report *)) |
Install an RTCP Sender Report hook. | |
rtp_error_t | install_sender_hook (std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sender_report >)> sr_handler) |
Install an RTCP Sender Report hook. | |
rtp_error_t | install_receiver_hook (void(*hook)(uvgrtp::frame::rtcp_receiver_report *)) |
Install an RTCP Receiver Report hook. | |
rtp_error_t | install_receiver_hook (std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_receiver_report >)> rr_handler) |
Install an RTCP Receiver Report hook. | |
rtp_error_t | install_sdes_hook (void(*hook)(uvgrtp::frame::rtcp_sdes_packet *)) |
Install an RTCP SDES packet hook. | |
rtp_error_t | install_sdes_hook (std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sdes_packet >)> sdes_handler) |
Install an RTCP SDES packet hook. | |
rtp_error_t | install_app_hook (void(*hook)(uvgrtp::frame::rtcp_app_packet *)) |
Install an RTCP APP packet hook. | |
rtp_error_t | install_app_hook (std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_app_packet >)> app_handler) |
Install an RTCP APP packet hook. | |
rtp_error_t | install_send_app_hook (std::string app_name, std::function< std::unique_ptr< uint8_t[]>(uint8_t &subtype, uint32_t &payload_len)> app_sending_func) |
Install hook for one type of APP packets. | |
rtp_error_t | remove_all_hooks () |
Remove all installed hooks for RTCP. | |
rtp_error_t | remove_send_app_hook (std::string app_name) |
Remove a hook for sending APP packets *. | |
RTCP instance handles all incoming and outgoing RTCP traffic, including report generation.
If media_stream was created with RCE_RTCP flag, RTCP is enabled. RTCP periodically sends compound RTCP packets. The bit rate of RTP session influences the reporting interval, but changing this has not yet been implemented.
The compound RTCP packet begins with either Sender Reports if we sent RTP packets recently or Receiver Report if we didn't send RTP packets recently. Both of these report types include report blocks for all the RTP sources we have received packets from during reporting period. The compound packets also always have an SDES packet and calling send_sdes_packet()-function will modify the contents of this SDES packet.
You can use the APP packet to test new RTCP packet types using the send_app_packet()-function. The APP packets are added to these periodically sent compound packets.
See RFC 3550 section 6 for more details.
rtp_error_t uvgrtp::rtcp::install_app_hook | ( | std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_app_packet >)> | app_handler | ) |
Install an RTCP APP packet hook.
This function is called when an RTCP APP packet is received
app_handler | C++ function pointer to the hook |
RTP_OK | on success |
RTP_INVALID_VALUE | If hook is nullptr |
rtp_error_t uvgrtp::rtcp::install_app_hook | ( | void(* | hook )(uvgrtp::frame::rtcp_app_packet *) | ) |
Install an RTCP APP packet hook.
This function is called when an RTCP APP packet is received
hook | Function pointer to the hook |
RTP_OK | on success |
RTP_INVALID_VALUE | If hook is nullptr |
rtp_error_t uvgrtp::rtcp::install_receiver_hook | ( | std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_receiver_report >)> | rr_handler | ) |
Install an RTCP Receiver Report hook.
This function is called when an RTCP Receiver Report is received
rr_handler | C++ function pointer to the hook |
RTP_OK | on success |
RTP_INVALID_VALUE | If hook is nullptr |
rtp_error_t uvgrtp::rtcp::install_receiver_hook | ( | void(* | hook )(uvgrtp::frame::rtcp_receiver_report *) | ) |
Install an RTCP Receiver Report hook.
This function is called when an RTCP Receiver Report is received
hook | Function pointer to the hook |
RTP_OK | on success |
RTP_INVALID_VALUE | If hook is nullptr |
rtp_error_t uvgrtp::rtcp::install_sdes_hook | ( | std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sdes_packet >)> | sdes_handler | ) |
Install an RTCP SDES packet hook.
This function is called when an RTCP SDES packet is received
sdes_handler | C++ function pointer to the hook |
RTP_OK | on success |
RTP_INVALID_VALUE | If hook is nullptr |
rtp_error_t uvgrtp::rtcp::install_sdes_hook | ( | void(* | hook )(uvgrtp::frame::rtcp_sdes_packet *) | ) |
Install an RTCP SDES packet hook.
This function is called when an RTCP SDES packet is received
hook | Function pointer to the hook |
RTP_OK | on success |
RTP_INVALID_VALUE | If hook is nullptr |
rtp_error_t uvgrtp::rtcp::install_send_app_hook | ( | std::string | app_name, |
std::function< std::unique_ptr< uint8_t[]>(uint8_t &subtype, uint32_t &payload_len)> | app_sending_func ) |
Install hook for one type of APP packets.
Each time the RR/SR is sent, all APP sending hooks call their respective functions to get the data
app_name | name of the APP packet. Max 4 chars |
app_sending | the function to be called when hook fires |
RTP_OK | on success |
RTP_INVALID_VALUE | If app_name is empty or longer that 4 characters or function pointer is empty |
rtp_error_t uvgrtp::rtcp::install_sender_hook | ( | std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sender_report >)> | sr_handler | ) |
Install an RTCP Sender Report hook.
This function is called when an RTCP Sender Report is received
sr_handler | C++ function pointer to the hook |
RTP_OK | on success |
RTP_INVALID_VALUE | If hook is nullptr |
rtp_error_t uvgrtp::rtcp::install_sender_hook | ( | void(* | hook )(uvgrtp::frame::rtcp_sender_report *) | ) |
Install an RTCP Sender Report hook.
This function is called when an RTCP Sender Report is received
hook | Function pointer to the hook |
RTP_OK | on success |
RTP_INVALID_VALUE | If hook is nullptr |
rtp_error_t uvgrtp::rtcp::remove_all_hooks | ( | ) |
Remove all installed hooks for RTCP.
Removes all installed hooks so they can be readded in case of changes
RTP_OK | on success |
rtp_error_t uvgrtp::rtcp::remove_send_app_hook | ( | std::string | app_name | ) |
Remove a hook for sending APP packets *.
app_name | name of the APP packet hook. Max 4 chars |
RTP_OK | on success |
RTP_INVALID_VALUE | if hook with given app_name was not found |
rtp_error_t uvgrtp::rtcp::send_app_packet | ( | const char * | name, |
uint8_t | subtype, | ||
uint32_t | payload_len, | ||
const uint8_t * | payload ) |
Send an RTCP APP packet.
name | Name of the APP item, e.g., STAT, must have a length of four ASCII characters |
subtype | Subtype of the APP item |
payload_len | Length of the payload |
payload | Payload |
RTP_OK | On success |
RTP_MEMORY_ERROR | If allocation fails |
RTP_GENERIC_ERROR | If sending fails |
rtp_error_t uvgrtp::rtcp::send_bye_packet | ( | std::vector< uint32_t > | ssrcs | ) |
Send an RTCP BYE packet.
In case the quitting participant is a mixer and is serving multiple paricipants, the input vector contains the SSRCs of all those participants. If the participant is a regular member of the session, the vector only contains the SSRC of the participant.
ssrcs | Vector of SSRCs of those participants who are quitting |
RTP_OK | On success |
RTP_MEMORY_ERROR | If allocation fails |
RTP_GENERIC_ERROR | If sending fails |
rtp_error_t uvgrtp::rtcp::send_sdes_packet | ( | const std::vector< uvgrtp::frame::rtcp_sdes_item > & | items | ) |
Send an RTCP SDES packet.
items | Vector of SDES items |
RTP_OK | On success |
RTP_MEMORY_ERROR | If allocation fails |
RTP_GENERIC_ERROR | If sending fails |
void uvgrtp::rtcp::set_ts_info | ( | uint64_t | clock_start, |
uint32_t | clock_rate, | ||
uint32_t | rtp_ts_start ) |
Provide timestamping information for RTCP.
If the application wishes to timestamp the stream itself AND it has enabled RTCP by using RCE_RTCP, it must provide timestamping information for RTCP so sensible synchronization values can be calculated for Sender Reports
The application can call uvgrtp::clock::ntp::now() to get the current wall clock reading as an NTP timestamp value
clock_start | NTP timestamp for t = 0 |
clock_rate | Clock rate of the stream |
rtp_ts_start | RTP timestamp for t = 0 |