Implementation for rtcp sender report

This commit is contained in:
dijunkun
2023-09-12 17:30:08 +08:00
parent 8c545f7544
commit c1d31790d4
15 changed files with 470 additions and 204 deletions

View File

@@ -4,6 +4,8 @@
#include <functional>
#include "ringbuffer.h"
#include "rtcp_packet.h"
#include "rtcp_sender_report.h"
#include "rtp_packet.h"
#include "rtp_video_send_statistics.h"
#include "thread_base.h"
@@ -17,21 +19,28 @@ class RtpVideoSender : public ThreadBase {
void Enqueue(std::vector<RtpPacket> &rtp_packets);
public:
void SetRtpPacketSendFunc(
std::function<void(RtpPacket &)> rtp_packet_send_func) {
rtp_packet_send_func_ = rtp_packet_send_func;
}
void SetUdpSender(
std::function<int(const char *, size_t)> rtp_packet_send_func);
private:
int SendRtpPacket(RtpPacket &rtp_packet);
int SendRtcpSR(RtcpSenderReport &rtcp_sr);
bool CheckIsTimeSendRtcpPacket();
private:
bool Process() override;
private:
std::function<void(RtpPacket &)> rtp_packet_send_func_ = nullptr;
std::function<int(const char *, size_t)> udp_sender_ = nullptr;
RingBuffer<RtpPacket> rtp_packe_queue_;
private:
std::unique_ptr<RtpVideoSendStatistics> rtp_video_send_statistics_ = nullptr;
uint32_t last_send_bytes_ = 0;
uint32_t last_send_rtcp_packet_ts_ = 0;
uint32_t total_rtp_packets_sent_ = 0;
uint32_t total_rtp_payload_sent_ = 0;
};
#endif