3#include "uvgrtp/export.hh"
4#include "uvgrtp/definitions.hh"
13#include <sys/socket.h>
14#include <netinet/in.h>
55 friend class media_stream_internal;
79 void set_ts_info(uint64_t clock_start, uint32_t clock_rate, uint32_t rtp_ts_start);
104 rtp_error_t
send_app_packet(
const char* name, uint8_t subtype, uint32_t payload_len,
const uint8_t* payload);
122 const char* app_name,
123 uint8_t* (*send_hook)(uint8_t* subtype, uint32_t* payload_len,
void* user_arg),
205#if UVGRTP_EXTENDED_API
238 rtp_error_t
install_sender_hook(std::function<
void(std::unique_ptr<uvgrtp::frame::rtcp_sender_report>)> sr_handler);
247 rtp_error_t
install_receiver_hook(std::function<
void(std::unique_ptr<uvgrtp::frame::rtcp_receiver_report>)> rr_handler);
256 rtp_error_t
install_sdes_hook(std::function<
void(std::unique_ptr<uvgrtp::frame::rtcp_sdes_packet>)> sdes_handler);
265 rtp_error_t
install_app_hook(std::function<
void(std::unique_ptr<uvgrtp::frame::rtcp_app_packet>)> app_handler);
289 std::function<std::unique_ptr<uint8_t[]>(uint8_t& subtype, uint32_t& payload_len)> app_sending_func);
291 rtp_error_t remove_send_app_hook(
const std::string& app_name);
297 [[deprecated(
"Replaced with unique_ptr or C-style hook functions")]]
298 rtp_error_t install_sender_hook(std::function<
void(std::shared_ptr<uvgrtp::frame::rtcp_sender_report>)> sr_handler);
300 [[deprecated(
"Replaced with unique_ptr or C-style hook functions")]]
301 rtp_error_t install_receiver_hook(std::function<
void(std::shared_ptr<uvgrtp::frame::rtcp_receiver_report>)> rr_handler);
303 [[deprecated(
"Replaced with unique_ptr or C-style hook functions")]]
304 rtp_error_t install_sdes_hook(std::function<
void(std::shared_ptr<uvgrtp::frame::rtcp_sdes_packet>)> sdes_handler);
306 [[deprecated(
"Replaced with unique_ptr or C-style hook functions")]]
307 rtp_error_t install_app_hook(std::function<
void(std::shared_ptr<uvgrtp::frame::rtcp_app_packet>)> app_handler);
310 [[deprecated(
"Use install_sender_hook(rtcp_sr*) from Core API instead")]]
313 [[deprecated(
"Use install_receiver_hook(rtcp_rr*) from Core API instead")]]
316 [[deprecated(
"Use install_sdes_hook(rtcp_sdes*) from Core API instead")]]
319 [[deprecated(
"Use get_sr from Core API")]]
322 [[deprecated(
"Use get_rr from Core API")]]
325 [[deprecated(
"Use get_sdes from Core API")]]
333 rtcp(std::shared_ptr<uvgrtp::rtp> rtp, std::shared_ptr<std::atomic<std::uint32_t>> ssrc, std::shared_ptr<std::atomic<uint32_t>> remote_ssrc,
334 std::string cname, std::shared_ptr<uvgrtp::socketfactory> sfp,
int rce_flags);
335 rtcp(std::shared_ptr<uvgrtp::rtp> rtp, std::shared_ptr<std::atomic<std::uint32_t>> ssrc, std::shared_ptr<std::atomic<uint32_t>> remote_ssrc,
336 std::string cname, std::shared_ptr<uvgrtp::socketfactory> sfp, std::shared_ptr<uvgrtp::srtcp> srtcp,
int rce_flags);
339 rtcp_internal* pimpl_;
343namespace uvg_rtp = uvgrtp;
RTCP instance handles all incoming and outgoing RTCP traffic, including report generation.
rtp_error_t clear_sdes_items()
Remove all SDES items previously added with add_sdes_item()
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 remove_send_app_hook(const char *app_name)
Remove a previously installed APP sending hook.
uvgrtp::frame::rtcp_sr * get_sr(uint32_t ssrc)
Get sender report for given SSRC.
uvgrtp::frame::rtcp_app_packet * get_app_packet(uint32_t ssrc)
Get APP packet for given SSRC.
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 remove_all_hooks()
Remove all installed reception RTCP packet hook, but not app send hook.
rtp_error_t install_send_app_hook(const char *app_name, uint8_t *(*send_hook)(uint8_t *subtype, uint32_t *payload_len, void *user_arg), void *user_arg)
Install a hook for generating RTCP APP packets during RTCP reporting.
rtp_error_t send_bye_packet(const uint32_t *ssrcs, size_t count)
Send an RTCP BYE packet to indicate stream end.
uvgrtp::frame::rtcp_rr * get_rr(uint32_t ssrc)
Get receiver report for given SSRC.
rtp_error_t add_sdes_item(const uvgrtp::frame::rtcp_sdes_item &item)
Add an SDES item that will be included in all future RTCP SDES packets.
rtp_error_t install_app_hook(void(*handler)(uvgrtp::frame::rtcp_app_packet *))
Install a callback for incoming RTCP APP packets.
rtp_error_t install_sdes_hook(void(*handler)(uvgrtp::frame::rtcp_sdes *))
Install a callback for incoming RTCP SDES packets.
uvgrtp::frame::rtcp_sdes * get_sdes(uint32_t ssrc)
Get SDES packet for given SSRC.
rtp_error_t install_receiver_hook(void(*handler)(uvgrtp::frame::rtcp_rr *))
Install a callback for incoming RTCP Receiver Reports.
rtp_error_t install_sender_hook(void(*handler)(uvgrtp::frame::rtcp_sr *))
Install a callback for incoming RTCP Sender Reports.
rtp_error_t install_receiver_hook(std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_receiver_report >)> rr_handler)
Install a C++ callback for incoming RTCP Receiver Reports.
rtp_error_t install_sdes_hook(std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sdes_packet >)> sdes_handler)
Install a C++ callback for incoming RTCP SDES packets.
rtp_error_t send_sdes_packet(const std::vector< uvgrtp::frame::rtcp_sdes_item > &items)
Send an RTCP SDES packet with full SDES items.
rtp_error_t install_app_hook(std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_app_packet >)> app_handler)
Install a C++ callback for incoming RTCP APP packets.
rtp_error_t install_sender_hook(std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sender_report >)> sr_handler)
Install a C++ callback for incoming RTCP Sender Reports.
rtp_error_t install_roundtrip_time_hook(std::function< void(uint32_t, uint32_t, double)> rtt_handler)
Install an Round Trip Time hook.
rtp_error_t send_bye_packet(const std::vector< uint32_t > &ssrcs)
Send an RTCP BYE packet.
rtp_error_t install_send_app_hook(const std::string &app_name, std::function< std::unique_ptr< uint8_t[]>(uint8_t &subtype, uint32_t &payload_len)> app_sending_func)
Install a C++ hook for sending RTCP APP packets during compound report generation.
See RFC 3550 section 6.7 for details on RTCP Application Packet.
See RFC 3550 section 6.4.2
See RFC 3550 section 6.4.2 for details on the RTCP RR (Receiver Report).
See RFC 3550 section 6.5 for details on RTCP SDES Item.
See RFC 3550 section 6.5 for details on RTCP SDES (Source Description).
See RFC 3550 section 6.4.1
See RFC 3550 section 6.4.1