提交 74d95d39 authored 作者: yangjinecho's avatar yangjinecho 提交者: José Luis Millán

update extended reports

上级 50a744b6
...@@ -35,12 +35,6 @@ namespace RTC ...@@ -35,12 +35,6 @@ namespace RTC
void Dump() const; void Dump() const;
size_t Serialize(uint8_t* buffer); size_t Serialize(uint8_t* buffer);
size_t GetSize() const; size_t GetSize() const;
uint8_t GetBlockType() const;
void SetBlockType(uint8_t blockType);
uint8_t GetReserved() const;
void SetReserved(uint8_t reserved);
uint16_t GetBlockLength() const;
void SetBlockLength(uint16_t blockLength);
uint32_t GetNtpSec() const; uint32_t GetNtpSec() const;
void SetNtpSec(uint32_t ntpSec); void SetNtpSec(uint32_t ntpSec);
uint32_t GetNtpFrac() const; uint32_t GetNtpFrac() const;
...@@ -83,6 +77,9 @@ namespace RTC ...@@ -83,6 +77,9 @@ namespace RTC
inline ReceiverExtendedReport::ReceiverExtendedReport() inline ReceiverExtendedReport::ReceiverExtendedReport()
{ {
this->header = reinterpret_cast<Header*>(this->raw); this->header = reinterpret_cast<Header*>(this->raw);
this->header->blockType = 4;
this->header->reserved = 0;
this->header->blockLength = uint16_t{ ntohs(2) };
} }
inline ReceiverExtendedReport::ReceiverExtendedReport(Header* header) : header(header) inline ReceiverExtendedReport::ReceiverExtendedReport(Header* header) : header(header)
...@@ -99,36 +96,6 @@ namespace RTC ...@@ -99,36 +96,6 @@ namespace RTC
return sizeof(Header); return sizeof(Header);
} }
inline uint8_t ReceiverExtendedReport::GetBlockType() const
{
return this->header->blockType;
}
inline void ReceiverExtendedReport::SetBlockType(uint8_t blockType)
{
this->header->blockType = blockType;
}
inline uint8_t ReceiverExtendedReport::GetReserved() const
{
return this->header->reserved;
}
inline void ReceiverExtendedReport::SetReserved(uint8_t reserved)
{
this->header->reserved = reserved;
}
inline uint16_t ReceiverExtendedReport::GetBlockLength() const
{
return uint16_t{ ntohs(this->header->blockLength) };
}
inline void ReceiverExtendedReport::SetBlockLength(uint16_t blockLength)
{
this->header->blockLength = uint16_t{ ntohs(blockLength) };
}
inline uint32_t ReceiverExtendedReport::GetNtpSec() const inline uint32_t ReceiverExtendedReport::GetNtpSec() const
{ {
return uint32_t{ ntohl(this->header->ntpSec) }; return uint32_t{ ntohl(this->header->ntpSec) };
......
...@@ -36,12 +36,6 @@ namespace RTC ...@@ -36,12 +36,6 @@ namespace RTC
void Dump() const; void Dump() const;
size_t Serialize(uint8_t* buffer); size_t Serialize(uint8_t* buffer);
size_t GetSize() const; size_t GetSize() const;
uint8_t GetBlockType() const;
void SetBlockType(uint8_t blockType);
uint8_t GetReserved() const;
void SetReserved(uint8_t reserved);
uint16_t GetBlockLength() const;
void SetBlockLength(uint16_t blockLength);
uint32_t GetSsrc() const; uint32_t GetSsrc() const;
void SetSsrc(uint32_t ssrc); void SetSsrc(uint32_t ssrc);
uint32_t GetLastReceiverReport() const; uint32_t GetLastReceiverReport() const;
...@@ -86,6 +80,9 @@ namespace RTC ...@@ -86,6 +80,9 @@ namespace RTC
inline SenderExtendedReport::SenderExtendedReport() inline SenderExtendedReport::SenderExtendedReport()
{ {
this->header = reinterpret_cast<Header*>(this->raw); this->header = reinterpret_cast<Header*>(this->raw);
this->header->blockType = 5;
this->header->reserved = 0;
this->header->blockLength = uint16_t{ ntohs(3) };
} }
inline SenderExtendedReport::SenderExtendedReport(Header* header) : header(header) inline SenderExtendedReport::SenderExtendedReport(Header* header) : header(header)
...@@ -102,36 +99,6 @@ namespace RTC ...@@ -102,36 +99,6 @@ namespace RTC
return sizeof(Header); return sizeof(Header);
} }
inline uint8_t SenderExtendedReport::GetBlockType() const
{
return this->header->blockType;
}
inline void SenderExtendedReport::SetBlockType(uint8_t blockType)
{
this->header->blockType = blockType;
}
inline uint8_t SenderExtendedReport::GetReserved() const
{
return this->header->reserved;
}
inline void SenderExtendedReport::SetReserved(uint8_t reserved)
{
this->header->reserved = reserved;
}
inline uint16_t SenderExtendedReport::GetBlockLength() const
{
return uint16_t{ ntohs(this->header->blockLength) };
}
inline void SenderExtendedReport::SetBlockLength(uint16_t blockLength)
{
this->header->blockLength = uint16_t{ ntohs(blockLength) };
}
inline uint32_t SenderExtendedReport::GetSsrc() const inline uint32_t SenderExtendedReport::GetSsrc() const
{ {
return uint32_t{ ntohl(this->header->ssrc) }; return uint32_t{ ntohl(this->header->ssrc) };
......
...@@ -599,19 +599,12 @@ namespace RTC ...@@ -599,19 +599,12 @@ namespace RTC
packet->AddReceiverReport(report); packet->AddReceiverReport(report);
} }
if (true)
{
auto ntp = Utils::Time::TimeMs2Ntp(now); auto ntp = Utils::Time::TimeMs2Ntp(now);
auto report = new RTC::RTCP::ReceiverExtendedReport(); auto report = new RTC::RTCP::ReceiverExtendedReport();
report->SetBlockType(4);
report->SetReserved(0);
report->SetBlockLength(2);
report->SetNtpSec(ntp.seconds); report->SetNtpSec(ntp.seconds);
report->SetNtpFrac(ntp.fractions); report->SetNtpFrac(ntp.fractions);
packet->AddReceiverExtendedReport(report); packet->AddReceiverExtendedReport(report);
}
this->lastRtcpSentTime = now; this->lastRtcpSentTime = now;
} }
......
...@@ -22,7 +22,7 @@ namespace RTC ...@@ -22,7 +22,7 @@ namespace RTC
{ {
MS_WARN_TAG( MS_WARN_TAG(
rtcp, rtcp,
"only support 4(Receiver Reference Time Report Block), current is %hhu", "only support 4(Receiver Reference Time Report Block), current is %" PRIu8,
header->blockType); header->blockType);
return nullptr; return nullptr;
...@@ -46,9 +46,6 @@ namespace RTC ...@@ -46,9 +46,6 @@ namespace RTC
MS_TRACE(); MS_TRACE();
MS_DUMP("<ReceiverExtendedReport>"); MS_DUMP("<ReceiverExtendedReport>");
MS_DUMP(" block type : %" PRIu8, GetBlockType());
MS_DUMP(" reserved : %" PRIu8, GetReserved());
MS_DUMP(" block length : %" PRIu16, GetBlockLength());
MS_DUMP(" ntp sec : %" PRIu32, GetNtpSec()); MS_DUMP(" ntp sec : %" PRIu32, GetNtpSec());
MS_DUMP(" ntp frac : %" PRIu32, GetNtpFrac()); MS_DUMP(" ntp frac : %" PRIu32, GetNtpFrac());
MS_DUMP("</ReceiverExtendedReport>"); MS_DUMP("</ReceiverExtendedReport>");
......
...@@ -20,7 +20,7 @@ namespace RTC ...@@ -20,7 +20,7 @@ namespace RTC
if (header->blockType != 5) if (header->blockType != 5)
{ {
MS_WARN_TAG(rtcp, "only support 5(DLRR Report Block), current is %hhu", header->blockType); MS_WARN_TAG(rtcp, "only support 5(DLRR Report Block), current is %" PRIu8, header->blockType);
return nullptr; return nullptr;
} }
...@@ -43,9 +43,6 @@ namespace RTC ...@@ -43,9 +43,6 @@ namespace RTC
MS_TRACE(); MS_TRACE();
MS_DUMP("<SenderExtendedReport>"); MS_DUMP("<SenderExtendedReport>");
MS_DUMP(" block type : %" PRIu8, GetBlockType());
MS_DUMP(" reserved : %" PRIu8, GetReserved());
MS_DUMP(" block length : %" PRIu16, GetBlockLength());
MS_DUMP(" ssrc : %" PRIu32, GetSsrc()); MS_DUMP(" ssrc : %" PRIu32, GetSsrc());
MS_DUMP(" lrr : %" PRIu32, GetLastReceiverReport()); MS_DUMP(" lrr : %" PRIu32, GetLastReceiverReport());
MS_DUMP(" dlrr : %" PRIu32, GetDelaySinceLastReceiverReport()); MS_DUMP(" dlrr : %" PRIu32, GetDelaySinceLastReceiverReport());
......
...@@ -495,6 +495,8 @@ namespace RTC ...@@ -495,6 +495,8 @@ namespace RTC
void RtpStreamRecv::ReceiveRtcpSenderExtendedReport(RTC::RTCP::SenderExtendedReport* report) void RtpStreamRecv::ReceiveRtcpSenderExtendedReport(RTC::RTCP::SenderExtendedReport* report)
{ {
MS_TRACE();
/* Calculate RTT. */ /* Calculate RTT. */
// Get the NTP representation of the current timestamp. // Get the NTP representation of the current timestamp.
...@@ -512,8 +514,8 @@ namespace RTC ...@@ -512,8 +514,8 @@ namespace RTC
// RTT in 1/2^16 second fractions. // RTT in 1/2^16 second fractions.
uint32_t rtt{ 0 }; uint32_t rtt{ 0 };
// If no Sender Report was received by the remote endpoint yet, ignore lastRr // If no Receiver Extended Report was received by the remote endpoint yet, ignore lastRr
// and dlrr values in the Receiver Report. // and dlrr values in the Sender Extended Report.
if (!lastRr || !dlrr) if (!lastRr || !dlrr)
rtt = 0; rtt = 0;
else if (compactNtp > dlrr + lastRr) else if (compactNtp > dlrr + lastRr)
...@@ -524,8 +526,6 @@ namespace RTC ...@@ -524,8 +526,6 @@ namespace RTC
// RTT in milliseconds. // RTT in milliseconds.
this->rtt = (rtt >> 16) * 1000; this->rtt = (rtt >> 16) * 1000;
this->rtt += (static_cast<float>(rtt & 0x0000FFFF) / 65536) * 1000; this->rtt += (static_cast<float>(rtt & 0x0000FFFF) / 65536) * 1000;
MS_TRACE();
} }
void RtpStreamRecv::RequestKeyFrame() void RtpStreamRecv::RequestKeyFrame()
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论