mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[feat] implementation for nack generator module
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "receive_side_congestion_controller.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "rtcp_receiver_report.h"
|
||||
#include "rtcp_sender.h"
|
||||
#include "rtp_packet_av1.h"
|
||||
#include "rtp_packet_h264.h"
|
||||
#include "rtp_rtcp_defines.h"
|
||||
@@ -63,6 +64,15 @@ class RtpVideoReceiver : public ThreadBase,
|
||||
bool Process() override;
|
||||
void RtcpThread();
|
||||
|
||||
private:
|
||||
void SendNack(const std::vector<uint16_t>& nack_list, bool buffering_allowed);
|
||||
|
||||
void RequestKeyFrame();
|
||||
|
||||
void SendLossNotification(uint16_t last_decoded_seq_num,
|
||||
uint16_t last_received_seq_num,
|
||||
bool decodability_flag, bool buffering_allowed);
|
||||
|
||||
private:
|
||||
std::map<uint16_t, RtpPacketH264> incomplete_h264_frame_list_;
|
||||
std::map<uint16_t, RtpPacketAv1> incomplete_av1_frame_list_;
|
||||
@@ -107,66 +117,11 @@ class RtpVideoReceiver : public ThreadBase,
|
||||
ReceiveSideCongestionController receive_side_congestion_controller_;
|
||||
RtcpFeedbackSenderInterface* active_remb_module_;
|
||||
uint32_t feedback_ssrc_ = 0;
|
||||
uint32_t remote_ssrc_ = 0;
|
||||
|
||||
std::unique_ptr<RtcpSender> rtcp_sender_;
|
||||
std::unique_ptr<NackRequester> nack_;
|
||||
|
||||
private:
|
||||
class RtcpFeedbackBuffer : public KeyFrameRequestSender,
|
||||
public NackSender,
|
||||
public LossNotificationSender {
|
||||
public:
|
||||
RtcpFeedbackBuffer(KeyFrameRequestSender* key_frame_request_sender,
|
||||
NackSender* nack_sender,
|
||||
LossNotificationSender* loss_notification_sender);
|
||||
|
||||
~RtcpFeedbackBuffer() override = default;
|
||||
|
||||
// KeyFrameRequestSender implementation.
|
||||
void RequestKeyFrame() override;
|
||||
|
||||
// NackSender implementation.
|
||||
void SendNack(const std::vector<uint16_t>& sequence_numbers,
|
||||
bool buffering_allowed) override;
|
||||
|
||||
// LossNotificationSender implementation.
|
||||
void SendLossNotification(uint16_t last_decoded_seq_num,
|
||||
uint16_t last_received_seq_num,
|
||||
bool decodability_flag,
|
||||
bool buffering_allowed) override;
|
||||
|
||||
// Send all RTCP feedback messages buffered thus far.
|
||||
void SendBufferedRtcpFeedback();
|
||||
|
||||
void ClearLossNotificationState();
|
||||
|
||||
private:
|
||||
// LNTF-related state.
|
||||
struct LossNotificationState {
|
||||
LossNotificationState(uint16_t last_decoded_seq_num,
|
||||
uint16_t last_received_seq_num,
|
||||
bool decodability_flag)
|
||||
: last_decoded_seq_num(last_decoded_seq_num),
|
||||
last_received_seq_num(last_received_seq_num),
|
||||
decodability_flag(decodability_flag) {}
|
||||
|
||||
uint16_t last_decoded_seq_num;
|
||||
uint16_t last_received_seq_num;
|
||||
bool decodability_flag;
|
||||
};
|
||||
|
||||
KeyFrameRequestSender* const key_frame_request_sender_;
|
||||
NackSender* const nack_sender_;
|
||||
LossNotificationSender* const loss_notification_sender_;
|
||||
|
||||
// Key-frame-request-related state.
|
||||
bool request_key_frame_;
|
||||
|
||||
// NACK-related state.
|
||||
std::vector<uint16_t> nack_sequence_numbers_;
|
||||
std::optional<LossNotificationState> lntf_state_;
|
||||
};
|
||||
RtcpFeedbackBuffer rtcp_feedback_buffer_;
|
||||
|
||||
private:
|
||||
FILE* file_rtp_recv_ = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user