mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[fix] update sr and rr module
This commit is contained in:
@@ -60,49 +60,52 @@ int RtpAudioSender::SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet) {
|
||||
io_statistics_->IncrementAudioOutboundRtpPacketCount();
|
||||
}
|
||||
|
||||
if (CheckIsTimeSendSR()) {
|
||||
RtcpSenderReport rtcp_sr;
|
||||
SenderInfo sender_info;
|
||||
RtcpReportBlock report;
|
||||
// if (CheckIsTimeSendSR()) {
|
||||
// SenderReport rtcp_sr;
|
||||
// SenderInfo sender_info;
|
||||
// RtcpReportBlock report;
|
||||
|
||||
auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(duration);
|
||||
uint32_t seconds_u32 = static_cast<uint32_t>(
|
||||
std::chrono::duration_cast<std::chrono::seconds>(duration).count());
|
||||
// auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
// auto seconds =
|
||||
// std::chrono::duration_cast<std::chrono::seconds>(duration); uint32_t
|
||||
// seconds_u32 = static_cast<uint32_t>(
|
||||
// std::chrono::duration_cast<std::chrono::seconds>(duration).count());
|
||||
|
||||
uint32_t fraction_u32 = static_cast<uint32_t>(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(duration - seconds)
|
||||
.count());
|
||||
// uint32_t fraction_u32 = static_cast<uint32_t>(
|
||||
// std::chrono::duration_cast<std::chrono::nanoseconds>(duration -
|
||||
// seconds)
|
||||
// .count());
|
||||
|
||||
sender_info.sender_ssrc = 0x00;
|
||||
sender_info.ntp_ts_msw = (uint32_t)seconds_u32;
|
||||
sender_info.ntp_ts_lsw = (uint32_t)fraction_u32;
|
||||
sender_info.rtp_ts =
|
||||
std::chrono::system_clock::now().time_since_epoch().count() * 1000000;
|
||||
sender_info.sender_packet_count = total_rtp_packets_sent_;
|
||||
sender_info.sender_octet_count = total_rtp_payload_sent_;
|
||||
// sender_info.sender_ssrc = 0x00;
|
||||
// sender_info.ntp_ts_msw = (uint32_t)seconds_u32;
|
||||
// sender_info.ntp_ts_lsw = (uint32_t)fraction_u32;
|
||||
// sender_info.rtp_ts =
|
||||
// std::chrono::system_clock::now().time_since_epoch().count() *
|
||||
// 1000000;
|
||||
// sender_info.sender_packet_count = total_rtp_packets_sent_;
|
||||
// sender_info.sender_octet_count = total_rtp_payload_sent_;
|
||||
|
||||
rtcp_sr.SetSenderInfo(sender_info);
|
||||
// rtcp_sr.SetSenderInfo(sender_info);
|
||||
|
||||
report.source_ssrc = 0x00;
|
||||
report.fraction_lost = 0;
|
||||
report.cumulative_lost = 0;
|
||||
report.extended_high_seq_num = 0;
|
||||
report.jitter = 0;
|
||||
report.lsr = 0;
|
||||
report.dlsr = 0;
|
||||
// report.source_ssrc = 0x00;
|
||||
// report.fraction_lost = 0;
|
||||
// report.cumulative_lost = 0;
|
||||
// report.extended_high_seq_num = 0;
|
||||
// report.jitter = 0;
|
||||
// report.lsr = 0;
|
||||
// report.dlsr = 0;
|
||||
|
||||
rtcp_sr.SetReportBlock(report);
|
||||
// rtcp_sr.SetReportBlock(report);
|
||||
|
||||
rtcp_sr.Encode();
|
||||
// rtcp_sr.Encode();
|
||||
|
||||
// SendRtcpSR(rtcp_sr);
|
||||
}
|
||||
// // SendRtcpSR(rtcp_sr);
|
||||
// }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RtpAudioSender::SendRtcpSR(RtcpSenderReport& rtcp_sr) {
|
||||
int RtpAudioSender::SendRtcpSR(SenderReport& rtcp_sr) {
|
||||
if (!data_send_func_) {
|
||||
LOG_ERROR("data_send_func_ is nullptr");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user