mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] update sr and rr module
This commit is contained in:
@@ -33,35 +33,35 @@ void RtpAudioReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
|
||||
io_statistics_->UpdateAudioPacketLossCount(rtp_packet.SequenceNumber());
|
||||
}
|
||||
|
||||
if (CheckIsTimeSendRR()) {
|
||||
RtcpReceiverReport rtcp_rr;
|
||||
RtcpReportBlock report;
|
||||
// if (CheckIsTimeSendRR()) {
|
||||
// ReceiverReport rtcp_rr;
|
||||
// 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());
|
||||
|
||||
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_rr.SetReportBlock(report);
|
||||
// rtcp_rr.SetReportBlock(report);
|
||||
|
||||
rtcp_rr.Encode();
|
||||
// rtcp_rr.Encode();
|
||||
|
||||
// SendRtcpRR(rtcp_rr);
|
||||
}
|
||||
// // SendRtcpRR(rtcp_rr);
|
||||
// }
|
||||
|
||||
if (on_receive_data_) {
|
||||
on_receive_data_((const char*)rtp_packet.Payload(),
|
||||
@@ -74,7 +74,7 @@ void RtpAudioReceiver::SetSendDataFunc(
|
||||
data_send_func_ = data_send_func;
|
||||
}
|
||||
|
||||
int RtpAudioReceiver::SendRtcpRR(RtcpReceiverReport& rtcp_rr) {
|
||||
int RtpAudioReceiver::SendRtcpRR(ReceiverReport& rtcp_rr) {
|
||||
if (!data_send_func_) {
|
||||
LOG_ERROR("data_send_func_ is nullptr");
|
||||
return -1;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <functional>
|
||||
|
||||
#include "io_statistics.h"
|
||||
#include "rtcp_receiver_report.h"
|
||||
#include "receiver_report.h"
|
||||
#include "rtp_packet.h"
|
||||
#include "rtp_statistics.h"
|
||||
|
||||
@@ -32,7 +32,7 @@ class RtpAudioReceiver {
|
||||
|
||||
private:
|
||||
bool CheckIsTimeSendRR();
|
||||
int SendRtcpRR(RtcpReceiverReport& rtcp_rr);
|
||||
int SendRtcpRR(ReceiverReport& rtcp_rr);
|
||||
|
||||
private:
|
||||
std::function<void(const char*, size_t)> on_receive_data_ = nullptr;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
#include "io_statistics.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "rtcp_sender_report.h"
|
||||
#include "rtp_packet.h"
|
||||
#include "rtp_statistics.h"
|
||||
#include "sender_report.h"
|
||||
#include "thread_base.h"
|
||||
|
||||
class RtpAudioSender : public ThreadBase {
|
||||
@@ -29,7 +29,7 @@ class RtpAudioSender : public ThreadBase {
|
||||
|
||||
private:
|
||||
int SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet);
|
||||
int SendRtcpSR(RtcpSenderReport &rtcp_sr);
|
||||
int SendRtcpSR(SenderReport &rtcp_sr);
|
||||
|
||||
bool CheckIsTimeSendSR();
|
||||
|
||||
|
||||
@@ -33,40 +33,40 @@ void RtpDataReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
|
||||
io_statistics_->UpdateDataPacketLossCount(rtp_packet.SequenceNumber());
|
||||
}
|
||||
|
||||
if (CheckIsTimeSendRR()) {
|
||||
RtcpReceiverReport rtcp_rr;
|
||||
RtcpReportBlock report;
|
||||
// if (CheckIsTimeSendRR()) {
|
||||
// ReceiverReport rtcp_rr;
|
||||
// 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());
|
||||
|
||||
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_rr.SetReportBlock(report);
|
||||
// rtcp_rr.SetReportBlock(report);
|
||||
|
||||
rtcp_rr.Encode();
|
||||
// rtcp_rr.Encode();
|
||||
|
||||
// SendRtcpRR(rtcp_rr);
|
||||
}
|
||||
// // SendRtcpRR(rtcp_rr);
|
||||
// }
|
||||
|
||||
if (on_receive_data_) {
|
||||
on_receive_data_((const char*)rtp_packet.Payload(),
|
||||
rtp_packet.PayloadSize());
|
||||
}
|
||||
// if (on_receive_data_) {
|
||||
// on_receive_data_((const char*)rtp_packet.Payload(),
|
||||
// rtp_packet.PayloadSize());
|
||||
// }
|
||||
}
|
||||
|
||||
void RtpDataReceiver::SetSendDataFunc(
|
||||
@@ -74,7 +74,7 @@ void RtpDataReceiver::SetSendDataFunc(
|
||||
data_send_func_ = data_send_func;
|
||||
}
|
||||
|
||||
int RtpDataReceiver::SendRtcpRR(RtcpReceiverReport& rtcp_rr) {
|
||||
int RtpDataReceiver::SendRtcpRR(ReceiverReport& rtcp_rr) {
|
||||
if (!data_send_func_) {
|
||||
LOG_ERROR("data_send_func_ is nullptr");
|
||||
return -1;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <functional>
|
||||
|
||||
#include "io_statistics.h"
|
||||
#include "rtcp_receiver_report.h"
|
||||
#include "receiver_report.h"
|
||||
#include "rtp_packet.h"
|
||||
#include "rtp_statistics.h"
|
||||
|
||||
@@ -26,7 +26,7 @@ class RtpDataReceiver {
|
||||
|
||||
private:
|
||||
bool CheckIsTimeSendRR();
|
||||
int SendRtcpRR(RtcpReceiverReport& rtcp_rr);
|
||||
int SendRtcpRR(ReceiverReport& rtcp_rr);
|
||||
|
||||
private:
|
||||
std::function<void(const char*, size_t)> on_receive_data_ = nullptr;
|
||||
|
||||
@@ -60,49 +60,52 @@ int RtpDataSender::SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet) {
|
||||
io_statistics_->IncrementDataOutboundRtpPacketCount();
|
||||
}
|
||||
|
||||
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 RtpDataSender::SendRtcpSR(RtcpSenderReport& rtcp_sr) {
|
||||
int RtpDataSender::SendRtcpSR(SenderReport& rtcp_sr) {
|
||||
if (!data_send_func_) {
|
||||
LOG_ERROR("data_send_func_ is nullptr");
|
||||
return -1;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
#include "io_statistics.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "rtcp_sender_report.h"
|
||||
#include "rtp_packet.h"
|
||||
#include "rtp_statistics.h"
|
||||
#include "sender_report.h"
|
||||
#include "thread_base.h"
|
||||
|
||||
class RtpDataSender : public ThreadBase {
|
||||
@@ -30,7 +30,7 @@ class RtpDataSender : public ThreadBase {
|
||||
private:
|
||||
private:
|
||||
int SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet);
|
||||
int SendRtcpSR(RtcpSenderReport &rtcp_sr);
|
||||
int SendRtcpSR(SenderReport &rtcp_sr);
|
||||
|
||||
bool CheckIsTimeSendSR();
|
||||
|
||||
|
||||
@@ -122,35 +122,36 @@ void RtpVideoReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
|
||||
io_statistics_->UpdateVideoPacketLossCount(rtp_packet.SequenceNumber());
|
||||
}
|
||||
|
||||
if (CheckIsTimeSendRR()) {
|
||||
RtcpReceiverReport rtcp_rr;
|
||||
RtcpReportBlock report;
|
||||
// if (CheckIsTimeSendRR()) {
|
||||
// ReceiverReport rtcp_rr;
|
||||
// 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());
|
||||
|
||||
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_rr.SetReportBlock(report);
|
||||
// rtcp_rr.SetReportBlock(report);
|
||||
|
||||
rtcp_rr.Encode();
|
||||
// rtcp_rr.Encode();
|
||||
|
||||
// // SendRtcpRR(rtcp_rr);
|
||||
// }
|
||||
|
||||
// SendRtcpRR(rtcp_rr);
|
||||
}
|
||||
if (rtp_packet.PayloadType() == rtp::PAYLOAD_TYPE::AV1) {
|
||||
RtpPacketAv1 rtp_packet_av1;
|
||||
rtp_packet_av1.Build(rtp_packet.Buffer().data(), rtp_packet.Size());
|
||||
@@ -407,7 +408,7 @@ void RtpVideoReceiver::SetSendDataFunc(
|
||||
data_send_func_ = data_send_func;
|
||||
}
|
||||
|
||||
int RtpVideoReceiver::SendRtcpRR(RtcpReceiverReport& rtcp_rr) {
|
||||
int RtpVideoReceiver::SendRtcpRR(ReceiverReport& rtcp_rr) {
|
||||
if (!data_send_func_) {
|
||||
LOG_ERROR("data_send_func_ is nullptr");
|
||||
return -1;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "io_statistics.h"
|
||||
#include "nack_requester.h"
|
||||
#include "receive_side_congestion_controller.h"
|
||||
#include "receiver_report.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "rtcp_receiver_report.h"
|
||||
#include "rtcp_sender.h"
|
||||
#include "rtp_packet_av1.h"
|
||||
#include "rtp_packet_h264.h"
|
||||
@@ -53,7 +53,7 @@ class RtpVideoReceiver : public ThreadBase,
|
||||
|
||||
private:
|
||||
bool CheckIsTimeSendRR();
|
||||
int SendRtcpRR(RtcpReceiverReport& rtcp_rr);
|
||||
int SendRtcpRR(ReceiverReport& rtcp_rr);
|
||||
|
||||
void SendCombinedRtcpPacket(
|
||||
std::vector<std::unique_ptr<RtcpPacket>> rtcp_packets);
|
||||
|
||||
@@ -100,40 +100,25 @@ int RtpVideoSender::SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet) {
|
||||
}
|
||||
|
||||
if (CheckIsTimeSendSR()) {
|
||||
RtcpSenderReport rtcp_sr;
|
||||
SenderInfo sender_info;
|
||||
SenderReport rtcp_sr;
|
||||
rtcp_sr.SetSenderSsrc(ssrc_);
|
||||
rtcp_sr.SetTimestamp(0);
|
||||
rtcp_sr.SetNtpTimestamp(0);
|
||||
rtcp_sr.SetSenderPacketCount(total_rtp_packets_sent_);
|
||||
rtcp_sr.SetSenderOctetCount(total_rtp_payload_sent_);
|
||||
|
||||
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());
|
||||
report.SetMediaSsrc(ssrc_);
|
||||
report.SetFractionLost(0);
|
||||
report.SetCumulativeLost(0);
|
||||
report.SetJitter(0);
|
||||
report.SetLastSr(0);
|
||||
report.SetExtHighestSeqNum(0);
|
||||
report.SetDelayLastSr(0);
|
||||
|
||||
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_;
|
||||
|
||||
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;
|
||||
|
||||
// rtcp_sr.SetReportBlock(report);
|
||||
|
||||
rtcp_sr.Encode();
|
||||
rtcp_sr.SetReportBlock(report);
|
||||
rtcp_sr.Create();
|
||||
|
||||
SendRtcpSR(rtcp_sr);
|
||||
}
|
||||
@@ -141,7 +126,7 @@ int RtpVideoSender::SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RtpVideoSender::SendRtcpSR(RtcpSenderReport& rtcp_sr) {
|
||||
int RtpVideoSender::SendRtcpSR(SenderReport& rtcp_sr) {
|
||||
if (!data_send_func_) {
|
||||
LOG_ERROR("data_send_func_ is nullptr");
|
||||
return -1;
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
#include "io_statistics.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "rtcp_sender_report.h"
|
||||
#include "rtp_packet.h"
|
||||
#include "rtp_packet_history.h"
|
||||
#include "rtp_packet_to_send.h"
|
||||
#include "rtp_statistics.h"
|
||||
#include "sender_report.h"
|
||||
#include "thread_base.h"
|
||||
|
||||
class RtpVideoSender : public ThreadBase {
|
||||
@@ -28,7 +28,7 @@ class RtpVideoSender : public ThreadBase {
|
||||
|
||||
private:
|
||||
int SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet);
|
||||
int SendRtcpSR(RtcpSenderReport &rtcp_sr);
|
||||
int SendRtcpSR(SenderReport &rtcp_sr);
|
||||
|
||||
bool CheckIsTimeSendSR();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user