Implementation for user data sending

This commit is contained in:
dijunkun
2023-09-13 17:31:02 +08:00
parent e2533d18e4
commit a0abb7455c
27 changed files with 513 additions and 233 deletions

View File

@@ -6,7 +6,7 @@
#include "ringbuffer.h"
#include "rtcp_sender_report.h"
#include "rtp_packet.h"
#include "rtp_video_send_statistics.h"
#include "rtp_statistics.h"
#include "thread_base.h"
class RtpVideoSender : public ThreadBase {
@@ -16,10 +16,7 @@ class RtpVideoSender : public ThreadBase {
public:
void Enqueue(std::vector<RtpPacket> &rtp_packets);
public:
void SetUdpSender(
std::function<int(const char *, size_t)> rtp_packet_send_func);
void SetSendDataFunc(std::function<int(const char *, size_t)> data_send_func);
private:
int SendRtpPacket(RtpPacket &rtp_packet);
@@ -31,11 +28,11 @@ class RtpVideoSender : public ThreadBase {
bool Process() override;
private:
std::function<int(const char *, size_t)> udp_sender_ = nullptr;
std::function<int(const char *, size_t)> data_send_func_ = nullptr;
RingBuffer<RtpPacket> rtp_packe_queue_;
private:
std::unique_ptr<RtpVideoSendStatistics> rtp_video_send_statistics_ = nullptr;
std::unique_ptr<RtpStatistics> rtp_statistics_ = nullptr;
uint32_t last_send_bytes_ = 0;
uint32_t last_send_rtcp_sr_packet_ts_ = 0;
uint32_t total_rtp_packets_sent_ = 0;