Fix rtcp header parse

This commit is contained in:
dijunkun
2023-09-13 10:49:18 +08:00
parent c1d31790d4
commit ea74495b5a
7 changed files with 107 additions and 31 deletions

View File

@@ -9,10 +9,6 @@ RtpVideoReceiver::RtpVideoReceiver() {}
RtpVideoReceiver::~RtpVideoReceiver() {}
void RtpVideoReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
if (rtp_packet.PayloadType() == 200) {
LOG_ERROR("!!!!!!!!!!!!!!!!!!");
}
if (!rtp_video_receive_statistics_) {
rtp_video_receive_statistics_ =
std::make_unique<RtpVideoReceiveStatistics>();

View File

@@ -43,7 +43,7 @@ int RtpVideoSender::SendRtpPacket(RtpPacket& rtp_packet) {
total_rtp_packets_sent_++;
total_rtp_payload_sent_ += rtp_packet.PayloadSize();
if (CheckIsTimeSendRtcpPacket()) {
if (CheckIsTimeSendSR()) {
RtcpSenderReport rtcp_sr;
RtcpSenderReport::SENDER_INFO sender_info;
@@ -90,10 +90,11 @@ int RtpVideoSender::SendRtcpSR(RtcpSenderReport& rtcp_sr) {
return 0;
}
bool RtpVideoSender::CheckIsTimeSendRtcpPacket() {
auto now_ts =
std::chrono::high_resolution_clock::now().time_since_epoch().count() *
1000000;
bool RtpVideoSender::CheckIsTimeSendSR() {
uint32_t now_ts = static_cast<uint32_t>(
std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::high_resolution_clock::now().time_since_epoch())
.count());
if (now_ts - last_send_rtcp_packet_ts_ >= RTCP_INTERVAL) {
last_send_rtcp_packet_ts_ = now_ts;

View File

@@ -26,7 +26,7 @@ class RtpVideoSender : public ThreadBase {
int SendRtpPacket(RtpPacket &rtp_packet);
int SendRtcpSR(RtcpSenderReport &rtcp_sr);
bool CheckIsTimeSendRtcpPacket();
bool CheckIsTimeSendSR();
private:
bool Process() override;