uvgRTP 3.1.3
An open-source library for RTP/SRTP media delivery
Loading...
Searching...
No Matches
rtcp.hh
1#pragma once
2
3#include "clock.hh"
4#include "util.hh"
5#include "frame.hh"
6
7#ifdef _WIN32
8#include <ws2ipdef.h>
9#else
10#include <sys/socket.h>
11#include <netinet/in.h>
12#endif
13
14#include <bitset>
15#include <map>
16#include <thread>
17#include <vector>
18#include <functional>
19#include <memory>
20#include <mutex>
21#include <deque>
22#include <atomic>
23
24namespace uvgrtp {
25
26 class rtp;
27 class srtcp;
28 class socket;
29 class socketfactory;
30 class rtcp_reader;
31
32 typedef std::vector<std::pair<size_t, uint8_t*>> buf_vec; // also defined in socket.hh
33
35 enum RTCP_ROLE {
36 RECEIVER,
37 SENDER
38 };
39
40 struct sender_statistics {
41 /* sender stats */
42 uint32_t sent_pkts = 0; /* Number of sent RTP packets */
43 uint32_t sent_bytes = 0; /* Number of sent bytes excluding RTP Header */
44 bool sent_rtp_packet = false; // since last report
45 };
46
47 struct receiver_statistics {
48 /* receiver stats */
49 uint32_t received_pkts = 0; /* Number of packets received */
50 uint32_t lost_pkts = 0; /* Number of dropped RTP packets */
51 uint32_t received_bytes = 0; /* Number of bytes received excluding RTP Header */
52 bool received_rtp_packet = false; // since last report
53
54 uint32_t expected_pkts = 0; /* Number of expected packets */
55 uint32_t received_prior = 0; /* Number of received packets in last report */
56 uint32_t expected_prior = 0; /* Number of expected packets in last report */
57
58 double jitter = 0; /* The estimation of jitter (see RFC 3550 A.8) */
59 uint32_t transit = 0; /* TODO: */
60
61
62 /* Receiver clock related stuff */
63 uint64_t initial_ntp = 0; /* Wallclock reading when the first RTP packet was received */
64 uint32_t initial_rtp = 0; /* RTP timestamp of the first RTP packet received */
65 uint32_t clock_rate = 0; /* Rate of the clock (used for jitter calculations) */
66
67 uint32_t lsr = 0; /* Middle 32 bits of the 64-bit NTP timestamp of previous SR */
68 uvgrtp::clock::hrc::hrc_t sr_ts; /* When the last SR was received (used to calculate delay) */
69
70 uint16_t max_seq = 0; /* Highest sequence number received */
71 uint32_t base_seq = 0; /* First sequence number received */
72 uint32_t bad_seq = 0; /* TODO: */
73 uint16_t cycles = 0; /* Number of sequence cycles */
74 };
75
76 struct rtcp_participant {
77 struct receiver_statistics stats; /* RTCP session statistics of the participant */
78
79 uint32_t probation = 0; /* has the participant been fully accepted to the session */
80 int role = 0; /* is the participant a sender or a receiver */
81
82 /* Save the latest RTCP packets received from this participant
83 * Users can query these packets using the SSRC of participant */
84 uvgrtp::frame::rtcp_sender_report *sr_frame = nullptr;
85 uvgrtp::frame::rtcp_receiver_report *rr_frame = nullptr;
86 uvgrtp::frame::rtcp_sdes_packet *sdes_frame = nullptr;
87 uvgrtp::frame::rtcp_app_packet *app_frame = nullptr;
88 };
89
90 struct rtcp_app_packet {
91 rtcp_app_packet(const rtcp_app_packet& orig_packet) = delete;
92 rtcp_app_packet(const char* name, uint8_t subtype, uint32_t payload_len, std::unique_ptr<uint8_t[]> payload);
93 ~rtcp_app_packet();
94
95 const char* name;
96 uint8_t subtype;
97
98 uint32_t payload_len;
99 std::unique_ptr<uint8_t[]> payload;
100 };
102
120 class rtcp {
121 public:
123 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,
124 std::string cname, std::shared_ptr<uvgrtp::socketfactory> sfp, int rce_flags);
125 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,
126 std::string cname, std::shared_ptr<uvgrtp::socketfactory> sfp, std::shared_ptr<uvgrtp::srtcp> srtcp, int rce_flags);
127 ~rtcp();
128
129 /* start the RTCP runner thread
130 *
131 * return RTP_OK on success and RTP_MEMORY_ERROR if the allocation fails */
132 rtp_error_t start();
133
134 /* End the RTCP session and send RTCP BYE to all participants
135 *
136 * return RTP_OK on success */
137 rtp_error_t stop();
138
139 /* Generate either RTCP Sender or Receiver report and sent it to all participants
140 * Return RTP_OK on success and RTP_ERROR on error */
141 rtp_error_t generate_report();
142
143 /* Handle incoming RTCP packet (first make sure it's a valid RTCP packet)
144 * This function will call one of the above functions internally
145 *
146 * Return RTP_OK on success and RTP_ERROR on error */
147 rtp_error_t handle_incoming_packet(void* args, int rce_flags, uint8_t* buffer, size_t size, frame::rtp_frame** out);
149
150 /* Send "frame" to all participants
151 *
152 * These routines will convert all necessary fields to network byte order
153 *
154 * Return RTP_OK on success
155 * Return RTP_INVALID_VALUE if "frame" is in some way invalid
156 * Return RTP_SEND_ERROR if sending "frame" did not succeed (see socket.hh for details) */
157
167 rtp_error_t send_sdes_packet(const std::vector<uvgrtp::frame::rtcp_sdes_item>& items);
168
181 rtp_error_t send_app_packet(const char *name, uint8_t subtype, uint32_t payload_len, const uint8_t *payload);
182
197 rtp_error_t send_bye_packet(std::vector<uint32_t> ssrcs);
198
200 /* Return the latest RTCP packet received from participant of "ssrc"
201 * Return nullptr if we haven't received this kind of packet or if "ssrc" doesn't exist
202 *
203 * NOTE: Caller is responsible for deallocating the memory */
204 uvgrtp::frame::rtcp_sender_report *get_sender_packet(uint32_t ssrc);
205 uvgrtp::frame::rtcp_receiver_report *get_receiver_packet(uint32_t ssrc);
206 uvgrtp::frame::rtcp_sdes_packet *get_sdes_packet(uint32_t ssrc);
207 uvgrtp::frame::rtcp_app_packet *get_app_packet(uint32_t ssrc);
208
209 /* Somebody joined the multicast group the owner of this RTCP instance is part of
210 * Add it to RTCP participant list so we can start listening for reports
211 *
212 * "clock_rate" tells how much the RTP timestamp advances, this information is needed
213 * to calculate the interarrival jitter correctly. It has nothing do with our clock rate,
214 * (or whether we're even sending anything)
215 *
216 * Return RTP_OK on success and RTP_ERROR on error */
217 rtp_error_t add_initial_participant(uint32_t clock_rate);
218
219 /* Functions for updating various RTP sender statistics */
220 void sender_update_stats(const uvgrtp::frame::rtp_frame *frame);
221
222 /* If we've detected that our SSRC has collided with someone else's SSRC, we need to
223 * generate new random SSRC and reinitialize our own RTCP state.
224 * RTCP object still has the participants of "last session", we can use their SSRCs
225 * to detected new collision
226 *
227 * Return RTP_OK if reinitialization succeeded
228 * Return RTP_SSRC_COLLISION if our new SSRC has collided and we need to generate new SSRC */
229 rtp_error_t reset_rtcp_state(uint32_t ssrc);
230
231 /* Update various session statistics */
232 void update_session_statistics(const uvgrtp::frame::rtp_frame *frame);
233
234 /* Getter for interval_ms_, which is calculated by set_session_bandwidth
235 * Be aware that this interval is frequently re-calculated in rtcp_runner() */
236 uint32_t get_rtcp_interval_ms() const;
237
238 /* Set total bandwidth for this session, called at the start
239 * This affects the RTCP packet transmission interval */
240 void set_session_bandwidth(uint32_t kbps);
241
242 std::shared_ptr<uvgrtp::socket> get_socket() const;
243
244 /* Store the following info in RTCP
245 * Local IP address
246 * Remote IP address
247 * Local port number for RTCP
248 * Destination port number for RTCP
249 * These are used when adding new participants and creating sockets for them */
250
251 rtp_error_t set_network_addresses(std::string local_addr, std::string remote_addr,
252 uint16_t local_port, uint16_t dst_port, bool ipv6);
253
254 /* Return SSRCs of all participants */
255 std::vector<uint32_t> get_participants() const;
257
272 void set_ts_info(uint64_t clock_start, uint32_t clock_rate, uint32_t rtp_ts_start);
273
274 /* Alternate way to get RTCP packets is to install a hook for them. So instead of
275 * polling an RTCP packet, user can install a function that is called when
276 * a specific RTCP packet is received. */
277
289
300 rtp_error_t install_sender_hook(std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_sender_report>)> sr_handler);
301
313
324 rtp_error_t install_receiver_hook(std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_receiver_report>)> rr_handler);
325
337
348 rtp_error_t install_sdes_hook(std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_sdes_packet>)> sdes_handler);
349
361
372 rtp_error_t install_app_hook(std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_app_packet>)> app_handler);
373
375 // These have been replaced by functions with unique_ptr in them
376 rtp_error_t install_sender_hook(std::function<void(std::shared_ptr<uvgrtp::frame::rtcp_sender_report>)> sr_handler);
377 rtp_error_t install_receiver_hook(std::function<void(std::shared_ptr<uvgrtp::frame::rtcp_receiver_report>)> rr_handler);
378 rtp_error_t install_sdes_hook(std::function<void(std::shared_ptr<uvgrtp::frame::rtcp_sdes_packet>)> sdes_handler);
379 rtp_error_t install_app_hook(std::function<void(std::shared_ptr<uvgrtp::frame::rtcp_app_packet>)> app_handler);
381
392 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);
393
401 rtp_error_t remove_all_hooks();
402
410 rtp_error_t remove_send_app_hook(std::string app_name);
411
413 /* Update RTCP-related sender statistics */
414 rtp_error_t update_sender_stats(size_t pkt_size);
415
416 void set_socket(std::shared_ptr<uvgrtp::socket> socket);
417
418 /* Update RTCP-related receiver statistics from RTP packets */
419 rtp_error_t recv_packet_handler_common(void *arg, int rce_flags, uint8_t* read_ptr, size_t size, frame::rtp_frame **out);
420
421 /* Update RTCP-related sender statistics */
422 static rtp_error_t send_packet_handler_vec(void *arg, uvgrtp::buf_vec& buffers);
423
424 // the length field is the rtcp packet size measured in 32-bit words - 1
425 size_t rtcp_length_in_bytes(uint16_t length);
426
427 void set_payload_size(size_t mtu_size);
429
430 private:
431
432 rtp_error_t set_sdes_items(const std::vector<uvgrtp::frame::rtcp_sdes_item>& items);
433
434 uint32_t size_of_ready_app_packets() const;
435 uint32_t size_of_apps_from_hook(std::vector< std::shared_ptr<rtcp_app_packet>> packets) const;
436
437 uint32_t size_of_compound_packet(uint16_t reports,
438 bool sr_packet, bool rr_packet, bool sdes_packet, uint32_t app_size, bool bye_packet) const;
439
440 /* read the header values from rtcp packet */
441 void read_rtcp_header(const uint8_t* buffer, size_t& read_ptr,
443 void read_reports(const uint8_t* buffer, size_t& read_ptr, size_t packet_end, uint8_t count,
444 std::vector<uvgrtp::frame::rtcp_report_block>& reports);
445
446 void read_ssrc(const uint8_t* buffer, size_t& read_ptr, uint32_t& out_ssrc);
447
448 /* Handle different kinds of incoming rtcp packets. The read header is passed to functions
449 which read rest of the frame type specific data.
450 * Return RTP_OK on success and RTP_ERROR on error */
451 rtp_error_t handle_sender_report_packet(uint8_t* buffer, size_t& read_ptr, size_t packet_end,
453 rtp_error_t handle_receiver_report_packet(uint8_t* buffer, size_t& read_ptr, size_t packet_end,
455 rtp_error_t handle_sdes_packet(uint8_t* buffer, size_t& read_ptr, size_t packet_end,
456 uvgrtp::frame::rtcp_header& header, uint32_t sender_ssrc);
457 rtp_error_t handle_bye_packet(uint8_t* buffer, size_t& read_ptr,
459 rtp_error_t handle_app_packet(uint8_t* buffer, size_t& read_ptr, size_t packet_end,
461 rtp_error_t handle_fb_packet(uint8_t* buffer, size_t& read_ptr, size_t packet_end,
463
464 static void rtcp_runner(rtcp *rtcp);
465
466 /* when we start the RTCP instance, we don't know what the SSRC of the remote is
467 * when an RTP packet is received, we must check if we've already received a packet
468 * from this sender and if not, create new entry to receiver_stats_ map */
469 bool is_participant(uint32_t ssrc) const;
470
471 //TODO: Resolve collision??
472 /* When we receive an RTP or RTCP packet, we need to check the source address and see if it's
473 * the same address where we've received packets before.
474 *
475 * If the address is new, it means we have detected an SSRC collision and the paket should
476 * be dropped We also need to check whether this SSRC matches with our own SSRC and if it does
477 * we need to send RTCP BYE and rejoin to the session */
478 bool collision_detected(uint32_t ssrc) const;
479
480 /* Move participant from initial_peers_ to participants_ */
481 rtp_error_t add_participant(uint32_t ssrc);
482
483 /* We've got a message from new source (the SSRC of the frame is not known to us)
484 * Initialize statistics for the peer and move it to participants_ */
485 rtp_error_t init_new_participant(const uvgrtp::frame::rtp_frame *frame);
486
487 /* Initialize the RTP Sequence related stuff of peer
488 * This function assumes that the peer already exists in the participants_ map */
489 rtp_error_t init_participant_seq(uint32_t ssrc, uint16_t base_seq);
490
491 /* Update the SSRC's sequence related data in participants_ map
492 *
493 * Return RTP_OK if the received packet was OK
494 * Return RTP_GENERIC_ERROR if it wasn't and
495 * packet-related statistics should not be updated */
496 rtp_error_t update_participant_seq(uint32_t ssrc, uint16_t seq);
497
498 /* Update the RTCP bandwidth variables
499 *
500 * "pkt_size" tells how much rtcp_byte_count_
501 * should be increased before calculating the new average */
502 void update_rtcp_bandwidth(size_t pkt_size);
503
504 /* Update average RTCP packet size variable
505 * packet_size is the size of received RTCP packet in octets */
506 void update_avg_rtcp_size(uint64_t packet_size);
507
508 /* Calculate the RTCP report interval in seconds
509 * rtcp_bw is given in kbps
510 * Defined in RFC3550 Appendix A.7 */
511 double rtcp_interval(int members, int senders,
512 double rtcp_bw, bool we_sent, double avg_rtcp_size, bool red_min, bool randomisation);
513
514 /* RTCP runner keeps track of ssrcs and how long they have been silent.
515 * By default a source get timed out if it has been silent for 25 seconds
516 * If an ssrc is timed out, this function removes it from participants_ map and
517 * updates any other infos */
518 rtp_error_t remove_timeout_ssrc(uint32_t ssrc);
519
520 /* Because struct statistics contains uvgRTP clock object we cannot
521 * zero it out without compiler complaining about it so all the fields
522 * must be set to zero manually */
523 void zero_stats(uvgrtp::sender_statistics *stats);
524
525 void zero_stats(uvgrtp::receiver_statistics *stats);
526
527 /* Takes ownership of the frame */
528 rtp_error_t send_rtcp_packet_to_participants(uint8_t* frame, uint32_t frame_size, bool encrypt);
529
530 void free_participant(std::unique_ptr<rtcp_participant> participant);
531
532 void cleanup_participants();
533
534 /* Secure RTCP context */
535 std::shared_ptr<uvgrtp::srtcp> srtcp_;
536
537 /* RTP context flags */
538 int rce_flags_;
539
540 /* are we a sender (and possible a receiver) or just a receiver */
541 int our_role_;
542
543 /* TODO: time_t?? */
544 // TODO: Check these, they don't seem to be used
545 size_t tp_; /* the last time an RTCP packet was transmitted */
546 size_t tc_; /* the current time */
547 size_t tn_; /* the next scheduled transmission time of an RTCP packet */
548 size_t pmembers_; /* the estimated number of session members at the time tn was last recomputed */
549 size_t members_; /* the most current estimate for the number of session members */
550 size_t senders_; /* the most current estimate for the number of senders in the session */
551
552 /* Total session bandwidth. RTCP bandwidth will be set to 5 % of this */
553 uint32_t total_bandwidth_;
554
555 /* The target RTCP bandwidth, i.e., the total bandwidth
556 * that will be used for RTCP packets by all members of this session,
557 * in octets per second. This will be a specified fraction of the
558 * "session bandwidth" parameter supplied to the application at startup. */
559 double rtcp_bandwidth_;
560
561 /* "Minimum" value for RTCP transmission interval, depends on the session bandwidth
562 * Actual interval can be 50 % smaller due to randomisation */
563 uint32_t reduced_minimum_;
564
565 /* Flag that is true if the application has sent data since
566 * the 2nd previous RTCP report was transmitted. */
567 // TODO: Only set, never read
568 bool we_sent_;
569
570 /* Store sender and receiver info, this is needed when calling
571 * add_participant dynamically (i.e. after initializing the stream) */
572 std::string local_addr_;
573 std::string remote_addr_;
574 uint16_t local_port_;
575 uint16_t dst_port_;
576
577 /* The average compound RTCP packet size, in octets,
578 * over all RTCP packets sent and received by this participant. The
579 * size includes lower-layer transport and network protocol headers
580 * (e.g., UDP and IP) as explained in Section 6.2 */
581 // TODO: Only set, never read
582 size_t avg_rtcp_pkt_pize_;
583
584 /* Average RTCP packet size in octets.
585 * Initialized to 64 */
586 uint64_t avg_rtcp_size_;
587
588 /* Number of RTCP packets and bytes sent and received by this participant */
589 // TODO: Only set, never read
590 size_t rtcp_pkt_count_;
591 size_t rtcp_byte_count_;
592
593 /* Number of RTCP packets sent */
594 uint32_t rtcp_pkt_sent_count_;
595
596 /* Flag that is true if the application has not yet sent an RTCP packet. */
597 // TODO: Only set, never read
598 bool initial_;
599
600 /* Copy of our own current SSRC */
601 std::shared_ptr<std::atomic_uint> ssrc_;
602
603 /* Copy of the remote streams SSRC */
604 std::shared_ptr<std::atomic<uint32_t>> remote_ssrc_;
605
606 /* NTP timestamp associated with initial RTP timestamp (aka t = 0) */
607 uint64_t clock_start_;
608
609 /* Clock rate of the media ie. how fast does the time increase */
610 uint32_t clock_rate_;
611
612 /* The first value of RTP timestamp (aka t = 0) */
613 uint32_t rtp_ts_start_;
614
615 std::map<uint32_t, std::unique_ptr<rtcp_participant>> participants_;
616 uint8_t num_receivers_; // maximum is 32 at the moment (5 bits)
617 bool ipv6_;
618
619 /* Address of the socket that we are sending data to */
620 sockaddr_in socket_address_;
621 sockaddr_in6 socket_address_ipv6_;
622
623
624 /* Map for keeping track of sources for timeouts
625 * First number is the sources ssrc
626 * Second number is how many milliseconds it has been silent*/
627 std::map<uint32_t, uint32_t> ms_since_last_rep_;
628
629 /* statistics for RTCP Sender and Receiver Reports */
630 struct sender_statistics our_stats;
631
632 /* If we expect frames from remote but haven't received anything from remote yet,
633 * the participant resides in this vector until he's moved to participants_ */
634 std::vector<std::unique_ptr<rtcp_participant>> initial_participants_;
635
636
637
638 void (*sender_hook_)(uvgrtp::frame::rtcp_sender_report *);
639 void (*receiver_hook_)(uvgrtp::frame::rtcp_receiver_report *);
640 void (*sdes_hook_)(uvgrtp::frame::rtcp_sdes_packet *);
641 void (*app_hook_)(uvgrtp::frame::rtcp_app_packet *);
642
643 std::function<void(std::shared_ptr<uvgrtp::frame::rtcp_sender_report>)> sr_hook_f_;
644 std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_sender_report>)> sr_hook_u_;
645 std::function<void(std::shared_ptr<uvgrtp::frame::rtcp_receiver_report>)> rr_hook_f_;
646 std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_receiver_report>)> rr_hook_u_;
647 std::function<void(std::shared_ptr<uvgrtp::frame::rtcp_sdes_packet>)> sdes_hook_f_;
648 std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_sdes_packet>)> sdes_hook_u_;
649 std::function<void(std::shared_ptr<uvgrtp::frame::rtcp_app_packet>)> app_hook_f_;
650 std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_app_packet>)> app_hook_u_;
651 std::function<void(std::unique_ptr<uvgrtp::frame::rtcp_fb_packet>)> fb_hook_u_;
652
653 std::mutex sr_mutex_;
654 std::mutex rr_mutex_;
655 std::mutex sdes_mutex_;
656 std::mutex app_mutex_;
657 std::mutex fb_mutex_;
658 mutable std::mutex participants_mutex_;
659 std::mutex send_app_mutex_;
660
661 std::unique_ptr<std::thread> report_generator_;
662 std::shared_ptr<uvgrtp::socket> rtcp_socket_;
663 std::shared_ptr<uvgrtp::socketfactory> sfp_;
664 std::shared_ptr<uvgrtp::rtcp_reader> rtcp_reader_;
665
666 bool is_active() const
667 {
668 return active_;
669 }
670
671 bool active_;
672
673 std::atomic<uint32_t> interval_ms_;
674
675 std::shared_ptr<uvgrtp::rtp> rtp_ptr_;
676
677 std::mutex packet_mutex_;
678
679 // messages waiting to be sent
680 std::vector<uvgrtp::frame::rtcp_sdes_item> ourItems_; // always sent
681 std::vector<uint32_t> bye_ssrcs_; // sent once
682
683 std::map<std::string, std::deque<rtcp_app_packet>> app_packets_; // sent one at a time per name
684 // APPs for hook
685 std::multimap<std::string, std::function <std::unique_ptr<uint8_t[]>(uint8_t& subtype, uint32_t& payload_len)>> outgoing_app_hooks_;
686 bool hooked_app_;
687
689 char cname_[255];
690
691 size_t mtu_size_;
692 };
693}
694
695namespace uvg_rtp = uvgrtp;
RTCP instance handles all incoming and outgoing RTCP traffic, including report generation.
Definition rtcp.hh:120
rtp_error_t install_receiver_hook(void(*hook)(uvgrtp::frame::rtcp_receiver_report *))
Install an RTCP Receiver Report hook.
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 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 remove_send_app_hook(std::string app_name)
Remove a hook for sending APP packets *.
rtp_error_t send_bye_packet(std::vector< uint32_t > ssrcs)
Send an RTCP BYE packet.
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_sender_hook(void(*hook)(uvgrtp::frame::rtcp_sender_report *))
Install an RTCP Sender Report hook.
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 send_sdes_packet(const std::vector< uvgrtp::frame::rtcp_sdes_item > &items)
Send an RTCP SDES packet.
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_sender_hook(std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sender_report >)> sr_handler)
Install an RTCP Sender Report hook.
rtp_error_t remove_all_hooks()
Remove all installed hooks for RTCP.
rtp_error_t install_app_hook(void(*hook)(uvgrtp::frame::rtcp_app_packet *))
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 install_sdes_hook(void(*hook)(uvgrtp::frame::rtcp_sdes_packet *))
Install an RTCP SDES packet hook.
See RFC 3550 section 6.7
Definition frame.hh:168
Header of for all RTCP packets defined in RFC 3550 section 6
Definition frame.hh:89
See RFC 3550 section 6.4.2
Definition frame.hh:134
See RFC 3550 section 6.5
Definition frame.hh:149
See RFC 3550 section 6.5
Definition frame.hh:162
See RFC 3550 section 6.4.1
Definition frame.hh:141
See RFC 3550 section 5
Definition frame.hh:68