Skip to content

Commit 02a87b2

Browse files
authored
Fix the problem of the TCC package being omitted from being sent. (#1492)
1 parent e570a7f commit 02a87b2

File tree

7 files changed

+26
-22
lines changed

7 files changed

+26
-22
lines changed

worker/include/RTC/RTCP/CompoundPacket.hpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "RTC/RTCP/SenderReport.hpp"
88
#include "RTC/RTCP/XrDelaySinceLastRr.hpp"
99
#include "RTC/RTCP/XrReceiverReferenceTime.hpp"
10-
#include "RTC/RtpPacket.hpp" // MtuSize.
10+
#include "RTC/RtpPacket.hpp" // MaxPacketSize.
1111
#include <vector>
1212

1313
namespace RTC
@@ -16,16 +16,6 @@ namespace RTC
1616
{
1717
class CompoundPacket
1818
{
19-
public:
20-
// Maximum size for a CompundPacket.
21-
// * IPv4|Ipv6 header size: 20|40 bytes. IPv6 considered.
22-
// * UDP|TCP header size: 8|20 bytes. TCP considered.
23-
// * SRTP Encryption: 148 bytes.
24-
// SRTP_MAX_TRAILER_LEN+4 is the maximum number of octects that will be
25-
// added to an RTCP packet by srtp_protect_rtcp().
26-
// srtp.h: SRTP_MAX_TRAILER_LEN (SRTP_MAX_TAG_LEN + SRTP_MAX_MKI_LEN)
27-
constexpr static size_t MaxSize{ RTC::MtuSize - 40u - 20u - 148u };
28-
2919
public:
3020
CompoundPacket() = default;
3121

worker/include/RTC/RtpPacket.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ namespace RTC
1818
{
1919
// Max MTU size.
2020
constexpr size_t MtuSize{ 1500u };
21+
// Maximum size for a CompundPacket.
22+
// * IPv4|Ipv6 header size: 20|40 bytes. IPv6 considered.
23+
// * UDP|TCP header size: 8|20 bytes. TCP considered.
24+
// * SRTP Encryption: 148 bytes.
25+
// SRTP_MAX_TRAILER_LEN+4 is the maximum number of octects that will be
26+
// added to an RTCP packet by srtp_protect_rtcp().
27+
// srtp.h: SRTP_MAX_TRAILER_LEN (SRTP_MAX_TAG_LEN + SRTP_MAX_MKI_LEN)
28+
constexpr size_t MaxPacketSize{ RTC::MtuSize - 40 - 20 - 148u };
2129
// MID header extension max length (just used when setting/updating MID
2230
// extension).
2331
constexpr uint8_t MidMaxLength{ 8u };

worker/src/RTC/RTCP/CompoundPacket.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ namespace RTC
101101
}
102102

103103
// New items can hold in the packet, report it.
104-
if (GetSize() <= MaxSize)
104+
if (GetSize() <= RTC::MaxPacketSize)
105105
{
106106
return true;
107107
}
@@ -160,7 +160,7 @@ namespace RTC
160160
}
161161

162162
// New items can hold in the packet, report it.
163-
if (GetSize() <= MaxSize)
163+
if (GetSize() <= RTC::MaxPacketSize)
164164
{
165165
return true;
166166
}
@@ -206,7 +206,7 @@ namespace RTC
206206
}
207207

208208
// New items can hold in the packet, report it.
209-
if (GetSize() <= MaxSize)
209+
if (GetSize() <= RTC::MaxPacketSize)
210210
{
211211
return true;
212212
}

worker/src/RTC/RtpStreamRecv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ namespace RTC
191191
RtpStreamRecv::RtpStreamRecv(
192192
RTC::RtpStreamRecv::Listener* listener,
193193
RTC::RtpStream::Params& params,
194-
unsigned int sendNackDelayMs,
194+
uint32_t sendNackDelayMs,
195195
bool useRtpInactivityCheck)
196196
: RTC::RtpStream::RtpStream(listener, params, 10), sendNackDelayMs(sendNackDelayMs),
197197
useRtpInactivityCheck(useRtpInactivityCheck),

worker/src/RTC/RtpStreamSend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ namespace RTC
471471
MS_DEBUG_TAG(
472472
rtx,
473473
"ignoring retransmission for a packet already resent in the last RTT ms "
474-
"[seq:%" PRIu16 ", rtt:%" PRIu32 "]",
474+
"[seq:%" PRIu16 ", rtt:%" PRIu16 "]",
475475
packet->GetSequenceNumber(),
476476
rtt);
477477
}

worker/src/RTC/Transport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,8 @@ namespace RTC
758758

759759
if (createTccServer)
760760
{
761-
this->tccServer =
762-
std::make_shared<RTC::TransportCongestionControlServer>(this, bweType, RTC::MtuSize);
761+
this->tccServer = std::make_shared<RTC::TransportCongestionControlServer>(
762+
this, bweType, RTC::MaxPacketSize);
763763

764764
if (this->maxIncomingBitrate != 0u)
765765
{

worker/src/RTC/TransportCongestionControlServer.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,20 @@ namespace RTC
233233

234234
case RTC::RTCP::FeedbackRtpTransportPacket::AddPacketResult::MAX_SIZE_EXCEEDED:
235235
{
236-
// This should not happen.
237-
MS_WARN_TAG(rtcp, "transport-cc feedback packet is exceeded");
236+
// Send ongoing feedback packet.
237+
auto sent = SendTransportCcFeedback();
238+
239+
if (sent)
240+
{
241+
++this->transportCcFeedbackPacketCount;
242+
}
238243

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

247+
// Decrease iterator to add current packet again.
248+
--it;
249+
244250
break;
245251
}
246252

0 commit comments

Comments
 (0)