提交 14a3020d authored 作者: José Luis Millán's avatar José Luis Millán

#276. Honor the MTU on RTCP compound packets

上级 086e6573
...@@ -774,14 +774,6 @@ namespace RTC ...@@ -774,14 +774,6 @@ namespace RTC
// Send the RTCP compound packet if there is a sender report. // Send the RTCP compound packet if there is a sender report.
if (packet->HasSenderReport()) if (packet->HasSenderReport())
{ {
// Ensure that the RTCP packet fits into the RTCP buffer.
if (packet->GetSize() > RTC::RTCP::BufferSize)
{
MS_WARN_TAG(rtcp, "cannot send RTCP packet, size too big (%zu bytes)", packet->GetSize());
return;
}
packet->Serialize(RTC::RTCP::Buffer); packet->Serialize(RTC::RTCP::Buffer);
SendRtcpCompoundPacket(packet.get()); SendRtcpCompoundPacket(packet.get());
...@@ -795,19 +787,20 @@ namespace RTC ...@@ -795,19 +787,20 @@ namespace RTC
auto* producer = kv.second; auto* producer = kv.second;
producer->GetRtcp(packet.get(), now); producer->GetRtcp(packet.get(), now);
}
// Send the RTCP compound with all receiver reports. // One more RR would exceed the MTU, send the compound packet now.
if (packet->GetReceiverReportCount() != 0u) if (packet->GetSize() + sizeof(RTCP::ReceiverReport::Header) > RTC::MtuSize)
{
// Ensure that the RTCP packet fits into the RTCP buffer.
if (packet->GetSize() > RTC::RTCP::BufferSize)
{ {
MS_WARN_TAG(rtcp, "cannot send RTCP packet, size too big (%zu bytes)", packet->GetSize()); packet->Serialize(RTC::RTCP::Buffer);
SendRtcpCompoundPacket(packet.get());
return; // Reset the Compound packet.
packet.reset(new RTC::RTCP::CompoundPacket());
} }
}
if (packet->GetReceiverReportCount() != 0u)
{
packet->Serialize(RTC::RTCP::Buffer); packet->Serialize(RTC::RTCP::Buffer);
SendRtcpCompoundPacket(packet.get()); SendRtcpCompoundPacket(packet.get());
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论