mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[feat] introduce fraction lost into congestion control module
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
#include "rtcp_receiver.h"
|
||||
|
||||
RtcpReceiver::RtcpReceiver() {}
|
||||
|
||||
RtcpReceiver::~RtcpReceiver() {}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* @Author: DI JUNKUN
|
||||
* @Date: 2025-02-17
|
||||
* Copyright (c) 2025 by DI JUNKUN, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _RTCP_RECEIVER_H_
|
||||
#define _RTCP_RECEIVER_H_
|
||||
|
||||
class RtcpReceiver {
|
||||
public:
|
||||
RtcpReceiver();
|
||||
~RtcpReceiver();
|
||||
|
||||
public:
|
||||
private:
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,43 +0,0 @@
|
||||
#include "rtcp_sender.h"
|
||||
|
||||
RtcpSender::RtcpSender(std::shared_ptr<webrtc::Clock> clock, uint32_t ssrc)
|
||||
: clock_(clock), ssrc_(ssrc) {}
|
||||
|
||||
RtcpSender::~RtcpSender() {}
|
||||
|
||||
void RtcpSender::BuildSR(const RtcpContext& ctx, PacketSender& sender) {
|
||||
// The timestamp of this RTCP packet should be estimated as the timestamp of
|
||||
// the frame being captured at this moment. We are calculating that
|
||||
// timestamp as the last frame's timestamp + the time since the last frame
|
||||
// was captured.
|
||||
int rtp_rate = rtp_clock_rates_khz_[last_payload_type_];
|
||||
if (rtp_rate <= 0) {
|
||||
rtp_rate =
|
||||
(audio_ ? kBogusRtpRateForAudioRtcp : kVideoPayloadTypeFrequency) /
|
||||
1000;
|
||||
}
|
||||
// Round now_us_ to the closest millisecond, because Ntp time is rounded
|
||||
// when converted to milliseconds,
|
||||
uint32_t rtp_timestamp =
|
||||
timestamp_offset_ + last_rtp_timestamp_ +
|
||||
((ctx.now_.us() + 500) / 1000 - last_frame_capture_time_->ms()) *
|
||||
rtp_rate;
|
||||
|
||||
rtcp::SenderReport report;
|
||||
report.SetSenderSsrc(ssrc_);
|
||||
report.SetNtp(env_.clock().ConvertTimestampToNtpTime(ctx.now_));
|
||||
report.SetRtpTimestamp(rtp_timestamp);
|
||||
report.SetPacketCount(ctx.feedback_state_.packets_sent);
|
||||
report.SetOctetCount(ctx.feedback_state_.media_bytes_sent);
|
||||
report.SetReportBlocks(CreateReportBlocks(ctx.feedback_state_));
|
||||
sender.AppendPacket(report);
|
||||
}
|
||||
|
||||
void RtcpSender::BuildRR(const RtcpContext& ctx, PacketSender& sender) {
|
||||
rtcp::ReceiverReport report;
|
||||
report.SetSenderSsrc(ssrc_);
|
||||
report.SetReportBlocks(CreateReportBlocks(ctx.feedback_state_));
|
||||
if (method_ == RtcpMode::kCompound || !report.report_blocks().empty()) {
|
||||
sender.AppendPacket(report);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* @Author: DI JUNKUN
|
||||
* @Date: 2025-02-17
|
||||
* Copyright (c) 2025 by DI JUNKUN, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _RTCP_SENDER_H_
|
||||
#define _RTCP_SENDER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "api/clock/clock.h"
|
||||
#include "rtcp/rtcp_packet/rtcp_packet.h"
|
||||
|
||||
class RtcpSender {
|
||||
public:
|
||||
RtcpSender(std::shared_ptr<webrtc::Clock> clock, uint32_t ssrc);
|
||||
~RtcpSender();
|
||||
|
||||
public:
|
||||
private:
|
||||
std::shared_ptr<webrtc::Clock> clock_;
|
||||
uint32_t ssrc_;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user