Skip to content

Commit

Permalink
fix lack of tcc feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
penguinol committed Feb 20, 2025
1 parent 4d3f5c5 commit 203ff19
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 22 deletions.
12 changes: 1 addition & 11 deletions worker/include/RTC/RTCP/CompoundPacket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "RTC/RTCP/SenderReport.hpp"
#include "RTC/RTCP/XrDelaySinceLastRr.hpp"
#include "RTC/RTCP/XrReceiverReferenceTime.hpp"
#include "RTC/RtpPacket.hpp" // MtuSize.
#include "RTC/RtpPacket.hpp" // MaxPacketSize.
#include <vector>

namespace RTC
Expand All @@ -16,16 +16,6 @@ namespace RTC
{
class CompoundPacket
{
public:
// Maximum size for a CompundPacket.
// * IPv4|Ipv6 header size: 20|40 bytes. IPv6 considered.
// * UDP|TCP header size: 8|20 bytes. TCP considered.
// * SRTP Encryption: 148 bytes.
// SRTP_MAX_TRAILER_LEN+4 is the maximum number of octects that will be
// added to an RTCP packet by srtp_protect_rtcp().
// srtp.h: SRTP_MAX_TRAILER_LEN (SRTP_MAX_TAG_LEN + SRTP_MAX_MKI_LEN)
constexpr static size_t MaxSize{ RTC::MtuSize - 40u - 20u - 148u };

public:
CompoundPacket() = default;

Expand Down
8 changes: 8 additions & 0 deletions worker/include/RTC/RtpPacket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ namespace RTC
{
// Max MTU size.
constexpr size_t MtuSize{ 1500u };
// Maximum size for a CompundPacket.
// * IPv4|Ipv6 header size: 20|40 bytes. IPv6 considered.
// * UDP|TCP header size: 8|20 bytes. TCP considered.
// * SRTP Encryption: 148 bytes.
// SRTP_MAX_TRAILER_LEN+4 is the maximum number of octects that will be
// added to an RTCP packet by srtp_protect_rtcp().
// srtp.h: SRTP_MAX_TRAILER_LEN (SRTP_MAX_TAG_LEN + SRTP_MAX_MKI_LEN)
constexpr size_t MaxPacketSize{ RTC::MtuSize - 40 - 20 - 148u };
// MID header extension max length (just used when setting/updating MID
// extension).
constexpr uint8_t MidMaxLength{ 8u };
Expand Down
6 changes: 3 additions & 3 deletions worker/src/RTC/RTCP/CompoundPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace RTC
}

// New items can hold in the packet, report it.
if (GetSize() <= MaxSize)
if (GetSize() <= RTC::MaxPacketSize)
{
return true;
}
Expand Down Expand Up @@ -160,7 +160,7 @@ namespace RTC
}

// New items can hold in the packet, report it.
if (GetSize() <= MaxSize)
if (GetSize() <= RTC::MaxPacketSize)
{
return true;
}
Expand Down Expand Up @@ -206,7 +206,7 @@ namespace RTC
}

// New items can hold in the packet, report it.
if (GetSize() <= MaxSize)
if (GetSize() <= RTC::MaxPacketSize)
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion worker/src/RTC/RtpStreamRecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ namespace RTC
RtpStreamRecv::RtpStreamRecv(
RTC::RtpStreamRecv::Listener* listener,
RTC::RtpStream::Params& params,
unsigned int sendNackDelayMs,
uint32_t sendNackDelayMs,
bool useRtpInactivityCheck)
: RTC::RtpStream::RtpStream(listener, params, 10), sendNackDelayMs(sendNackDelayMs),
useRtpInactivityCheck(useRtpInactivityCheck),
Expand Down
2 changes: 1 addition & 1 deletion worker/src/RTC/RtpStreamSend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ namespace RTC
MS_DEBUG_TAG(
rtx,
"ignoring retransmission for a packet already resent in the last RTT ms "
"[seq:%" PRIu16 ", rtt:%" PRIu32 "]",
"[seq:%" PRIu16 ", rtt:%" PRIu16 "]",
packet->GetSequenceNumber(),
rtt);
}
Expand Down
4 changes: 2 additions & 2 deletions worker/src/RTC/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,8 @@ namespace RTC

if (createTccServer)
{
this->tccServer =
std::make_shared<RTC::TransportCongestionControlServer>(this, bweType, RTC::MtuSize);
this->tccServer = std::make_shared<RTC::TransportCongestionControlServer>(
this, bweType, RTC::MaxPacketSize);

if (this->maxIncomingBitrate != 0u)
{
Expand Down
14 changes: 10 additions & 4 deletions worker/src/RTC/TransportCongestionControlServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,20 @@ namespace RTC

case RTC::RTCP::FeedbackRtpTransportPacket::AddPacketResult::MAX_SIZE_EXCEEDED:
{
// This should not happen.
MS_WARN_TAG(rtcp, "transport-cc feedback packet is exceeded");
// Send ongoing feedback packet
auto sent = SendTransportCcFeedback();

if (sent)
{
++this->transportCcFeedbackPacketCount;
}

// Create a new feedback packet.
// NOTE: Do not increment packet count it since the previous ongoing
// feedback packet was not sent.
ResetTransportCcFeedback(this->transportCcFeedbackPacketCount);

// Decrease iterator to add current packet again.
--it;

break;
}

Expand Down

0 comments on commit 203ff19

Please sign in to comment.