uvgRTP 3.1.3
An open-source library for RTP/SRTP media delivery
Loading...
Searching...
No Matches
uvgrtp::rtcp Class Reference

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

Detailed Description

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.

Definition at line 120 of file rtcp.hh.

Member Function Documentation

◆ install_app_hook() [1/2]

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

Parameters
app_handlerC++ function pointer to the hook
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ install_app_hook() [2/2]

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

Parameters
hookFunction pointer to the hook
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ install_receiver_hook() [1/2]

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

Parameters
rr_handlerC++ function pointer to the hook
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ install_receiver_hook() [2/2]

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

Parameters
hookFunction pointer to the hook
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ install_sdes_hook() [1/2]

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

Parameters
sdes_handlerC++ function pointer to the hook
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ install_sdes_hook() [2/2]

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

Parameters
hookFunction pointer to the hook
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ install_send_app_hook()

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

Parameters
app_namename of the APP packet. Max 4 chars
app_sendingthe function to be called when hook fires
Return values
RTP_OKon success
RTP_INVALID_VALUEIf app_name is empty or longer that 4 characters or function pointer is empty

◆ install_sender_hook() [1/2]

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

Parameters
sr_handlerC++ function pointer to the hook
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ install_sender_hook() [2/2]

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

Parameters
hookFunction pointer to the hook
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ remove_all_hooks()

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

Return values
RTP_OKon success

◆ remove_send_app_hook()

rtp_error_t uvgrtp::rtcp::remove_send_app_hook ( std::string app_name)

Remove a hook for sending APP packets *.

Parameters
app_namename of the APP packet hook. Max 4 chars
Return values
RTP_OKon success
RTP_INVALID_VALUEif hook with given app_name was not found

◆ send_app_packet()

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.

Parameters
nameName of the APP item, e.g., STAT, must have a length of four ASCII characters
subtypeSubtype of the APP item
payload_lenLength of the payload
payloadPayload
Return values
RTP_OKOn success
RTP_MEMORY_ERRORIf allocation fails
RTP_GENERIC_ERRORIf sending fails

◆ send_bye_packet()

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.

Parameters
ssrcsVector of SSRCs of those participants who are quitting
Return values
RTP_OKOn success
RTP_MEMORY_ERRORIf allocation fails
RTP_GENERIC_ERRORIf sending fails

◆ send_sdes_packet()

rtp_error_t uvgrtp::rtcp::send_sdes_packet ( const std::vector< uvgrtp::frame::rtcp_sdes_item > & items)

Send an RTCP SDES packet.

Parameters
itemsVector of SDES items
Return values
RTP_OKOn success
RTP_MEMORY_ERRORIf allocation fails
RTP_GENERIC_ERRORIf sending fails

◆ set_ts_info()

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

Parameters
clock_startNTP timestamp for t = 0
clock_rateClock rate of the stream
rtp_ts_startRTP timestamp for t = 0

The documentation for this class was generated from the following file: