[feat] update qos module

This commit is contained in:
dijunkun
2025-01-07 17:31:14 +08:00
parent 601fedfd76
commit 7a84b25b5c
14 changed files with 224 additions and 83 deletions

View File

@@ -7,8 +7,32 @@
#ifndef _CONGESTION_CONTROL_FEEDBACK_GENERATOR_H_
#define _CONGESTION_CONTROL_FEEDBACK_GENERATOR_H_
#include <optional>
#include <vector>
#include "rtcp_packet.h"
#include "rtp_packet_received.h"
class RtpTransportFeedbackGenerator {
public:
// Function intented to be used for sending RTCP messages generated by an
// implementation of this class.
using RtcpSender =
std::function<void(std::vector<std::unique_ptr<RtcpPacket>> packets)>;
virtual ~RtpTransportFeedbackGenerator() = default;
virtual void OnReceivedPacket(const RtpPacketReceived& packet) = 0;
// Sends periodic feedback if it is time to send it.
// Returns time until next call to Process should be made.
virtual int64_t Process(int64_t now) = 0;
virtual void OnSendBandwidthEstimateChanged(int64_t estimate) = 0;
// Overhead from transport layers below RTP. Ie, IP, SRTP.
virtual void SetTransportOverhead(DataSize overhead_per_packet) = 0;
};
class CongestionControlFeedbackGenerator
: public RtpTransportFeedbackGenerator {
public:
@@ -18,7 +42,7 @@ class CongestionControlFeedbackGenerator
void OnReceivedPacket(const RtpPacketReceived& packet) override;
void OnSendBandwidthEstimateChanged(DataRate estimate) override;
void OnSendBandwidthEstimateChanged(int64_t estimate) override;
int64_t Process(int64_t now_ms) override;