mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] fix rtcp common header
This commit is contained in:
@@ -29,6 +29,10 @@ class RtpAudioReceiver {
|
||||
std::function<void(const char*, size_t)> on_receive_data) {
|
||||
on_receive_data_ = on_receive_data;
|
||||
}
|
||||
uint32_t GetSsrc() { return ssrc_; }
|
||||
uint32_t GetRemoteSsrc() { return remote_ssrc_; }
|
||||
|
||||
void OnSenderReport(int64_t now_time, uint64_t ntp_time) {}
|
||||
|
||||
private:
|
||||
bool CheckIsTimeSendRR();
|
||||
@@ -46,6 +50,12 @@ class RtpAudioReceiver {
|
||||
uint32_t total_rtp_packets_recv_ = 0;
|
||||
uint32_t last_send_rtcp_rr_packet_ts_ = 0;
|
||||
std::function<int(const char*, size_t)> data_send_func_ = nullptr;
|
||||
|
||||
uint32_t ssrc_ = 0;
|
||||
uint32_t remote_ssrc_ = 0;
|
||||
|
||||
uint32_t last_sr_ = 0;
|
||||
uint32_t last_delay_ = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,10 @@ class RtpDataReceiver {
|
||||
on_receive_data_ = on_receive_data;
|
||||
}
|
||||
|
||||
uint32_t GetSsrc() { return ssrc_; }
|
||||
uint32_t GetRemoteSsrc() { return remote_ssrc_; }
|
||||
void OnSenderReport(int64_t now_time, uint64_t ntp_time) {}
|
||||
|
||||
private:
|
||||
bool CheckIsTimeSendRR();
|
||||
int SendRtcpRR(ReceiverReport& rtcp_rr);
|
||||
@@ -39,8 +43,13 @@ class RtpDataReceiver {
|
||||
uint32_t total_rtp_payload_recv_ = 0;
|
||||
uint32_t total_rtp_packets_recv_ = 0;
|
||||
|
||||
uint32_t ssrc_ = 0;
|
||||
uint32_t remote_ssrc_ = 0;
|
||||
uint32_t last_send_rtcp_rr_packet_ts_ = 0;
|
||||
std::function<int(const char*, size_t)> data_send_func_ = nullptr;
|
||||
|
||||
uint32_t last_sr_ = 0;
|
||||
uint32_t last_delay_ = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -545,3 +545,32 @@ void RtpVideoReceiver::SendLossNotification(uint16_t last_decoded_seq_num,
|
||||
uint16_t last_received_seq_num,
|
||||
bool decodability_flag,
|
||||
bool buffering_allowed) {}
|
||||
|
||||
inline uint32_t DivideRoundToNearest(int64_t dividend, int64_t divisor) {
|
||||
if (dividend < 0) {
|
||||
int64_t half_of_divisor = divisor / 2;
|
||||
int64_t quotient = dividend / divisor;
|
||||
int64_t remainder = dividend % divisor;
|
||||
if (-remainder > half_of_divisor) {
|
||||
--quotient;
|
||||
}
|
||||
return quotient;
|
||||
}
|
||||
|
||||
int64_t half_of_divisor = (divisor - 1) / 2;
|
||||
int64_t quotient = dividend / divisor;
|
||||
int64_t remainder = dividend % divisor;
|
||||
if (remainder > half_of_divisor) {
|
||||
++quotient;
|
||||
}
|
||||
return quotient;
|
||||
}
|
||||
|
||||
void RtpVideoReceiver::OnSenderReport(int64_t now_time, uint64_t ntp_time) {
|
||||
last_sr_ = ((uint32_t)(ntp_time / 0x100000000) << 16) |
|
||||
((uint32_t)(ntp_time % 0x100000000) >> 16);
|
||||
last_delay_ = DivideRoundToNearest(
|
||||
(clock_->CurrentTime().us() - now_time) * 0x10000, 1000000);
|
||||
|
||||
LOG_WARN("OnSenderReport [{}][{}]", last_sr_, last_delay_);
|
||||
}
|
||||
@@ -43,6 +43,9 @@ class RtpVideoReceiver : public ThreadBase,
|
||||
std::function<void(VideoFrame&)> on_receive_complete_frame) {
|
||||
on_receive_complete_frame_ = on_receive_complete_frame;
|
||||
}
|
||||
uint32_t GetSsrc() { return ssrc_; }
|
||||
uint32_t GetRemoteSsrc() { return remote_ssrc_; }
|
||||
void OnSenderReport(int64_t now_time, uint64_t ntp_time);
|
||||
|
||||
private:
|
||||
void ProcessAv1RtpPacket(RtpPacketAv1& rtp_packet_av1);
|
||||
@@ -114,15 +117,19 @@ class RtpVideoReceiver : public ThreadBase,
|
||||
int rtcp_tcc_interval_ms_ = 200;
|
||||
|
||||
private:
|
||||
uint32_t ssrc_ = 0;
|
||||
uint32_t remote_ssrc_ = 0;
|
||||
std::shared_ptr<webrtc::Clock> clock_;
|
||||
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_;
|
||||
|
||||
uint32_t last_sr_ = 0;
|
||||
uint32_t last_delay_ = 0;
|
||||
|
||||
private:
|
||||
FILE* file_rtp_recv_ = nullptr;
|
||||
};
|
||||
|
||||
@@ -118,18 +118,7 @@ int RtpVideoSender::SendRtpPacket(
|
||||
rtcp_sr.SetSenderPacketCount(total_rtp_packets_sent_);
|
||||
rtcp_sr.SetSenderOctetCount(total_rtp_payload_sent_);
|
||||
|
||||
RtcpReportBlock report;
|
||||
report.SetMediaSsrc(ssrc_);
|
||||
report.SetFractionLost(0);
|
||||
report.SetCumulativeLost(0);
|
||||
report.SetJitter(0);
|
||||
report.SetLastSr(0);
|
||||
report.SetExtHighestSeqNum(0);
|
||||
report.SetDelayLastSr(0);
|
||||
|
||||
rtcp_sr.SetReportBlock(report);
|
||||
rtcp_sr.Create();
|
||||
|
||||
rtcp_sr.Build();
|
||||
SendRtcpSR(rtcp_sr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user