Unverified 提交 2e9c231b authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

Fix RTCP DLRR (Delay Since Last Receiver Report) block parsing (#1234)

上级 c65f8ffd
# Changelog # Changelog
### NEXT
* Fix RTCP DLRR (Delay Since Last Receiver Report) block parsing ([PR #1234](https://github.com/versatica/mediasoup/pull/1234)).
### 3.13.3 ### 3.13.3
* Node: Fix issue when 'pause'/'resume' events are not emitted ([PR #1231](https://github.com/versatica/mediasoup/pull/1231) by @douglaseel). * Node: Fix issue when 'pause'/'resume' events are not emitted ([PR #1231](https://github.com/versatica/mediasoup/pull/1231) by @douglaseel).
......
...@@ -213,7 +213,7 @@ libmediasoup-worker: setup flatc ...@@ -213,7 +213,7 @@ libmediasoup-worker: setup flatc
flatc: setup flatc: setup
$(MESON) compile -C $(BUILD_DIR) flatbuffers-generator $(MESON) compile -C $(BUILD_DIR) flatbuffers-generator
xcode: setup xcode: setup flatc
$(MESON) setup --buildtype debug --backend xcode $(MEDIASOUP_OUT_DIR)/xcode $(MESON) setup --buildtype debug --backend xcode $(MEDIASOUP_OUT_DIR)/xcode
lint: lint:
...@@ -234,7 +234,7 @@ else ...@@ -234,7 +234,7 @@ else
$(BUILD_DIR)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS) $(BUILD_DIR)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
endif endif
test-asan: setup test-asan: setup flatc
$(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker-test-asan $(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker-test-asan
$(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker-test-asan $(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker-test-asan
ASAN_OPTIONS=detect_leaks=1 $(BUILD_DIR)/mediasoup-worker-test-asan --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS) ASAN_OPTIONS=detect_leaks=1 $(BUILD_DIR)/mediasoup-worker-test-asan --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
...@@ -249,7 +249,7 @@ tidy: ...@@ -249,7 +249,7 @@ tidy:
-checks=$(MEDIASOUP_TIDY_CHECKS) \ -checks=$(MEDIASOUP_TIDY_CHECKS) \
-quiet -quiet
fuzzer: setup fuzzer: setup flatc
$(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker-fuzzer $(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker-fuzzer
$(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker-fuzzer $(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker-fuzzer
......
...@@ -289,6 +289,8 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( ...@@ -289,6 +289,8 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo(
if (payload_size > kMinProbePacketSize && if (payload_size > kMinProbePacketSize &&
(!remote_rate_.ValidEstimate() || (!remote_rate_.ValidEstimate() ||
now_ms - first_packet_time_ms_ < kInitialProbingIntervalMs)) { now_ms - first_packet_time_ms_ < kInitialProbingIntervalMs)) {
#if MS_LOG_DEV_LEVEL == 3
// TODO(holmer): Use a map instead to get correct order? // TODO(holmer): Use a map instead to get correct order?
if (total_probes_received_ < kMaxProbePackets) { if (total_probes_received_ < kMaxProbePackets) {
int send_delta_ms = -1; int send_delta_ms = -1;
...@@ -306,6 +308,8 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( ...@@ -306,6 +308,8 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo(
send_delta_ms, send_delta_ms,
recv_delta_ms); recv_delta_ms);
} }
#endif
probes_.push_back(Probe(send_time_ms, arrival_time_ms, payload_size)); probes_.push_back(Probe(send_time_ms, arrival_time_ms, payload_size));
++total_probes_received_; ++total_probes_received_;
// Make sure that a probe which updated the bitrate immediately has an // Make sure that a probe which updated the bitrate immediately has an
......
...@@ -75,14 +75,12 @@ namespace RTC ...@@ -75,14 +75,12 @@ namespace RTC
{ {
report->AddSsrcInfo(ssrcInfo); report->AddSsrcInfo(ssrcInfo);
offset += ssrcInfo->GetSize(); offset += ssrcInfo->GetSize();
reportLength -= ssrcInfo->GetSize();
} }
else else
{ {
return report.release(); return report.release();
} }
offset += ssrcInfo->GetSize();
reportLength -= DelaySinceLastRr::SsrcInfo::BodySize;
} }
return report.release(); return report.release();
......
#include "common.hpp" #include "common.hpp"
#include "RTC/RTCP/XR.hpp"
#include "RTC/RTCP/XrDelaySinceLastRr.hpp" #include "RTC/RTCP/XrDelaySinceLastRr.hpp"
#include "RTC/RTCP/XrReceiverReferenceTime.hpp" #include "RTC/RTCP/XrReceiverReferenceTime.hpp"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
...@@ -6,6 +7,92 @@ ...@@ -6,6 +7,92 @@
using namespace RTC::RTCP; using namespace RTC::RTCP;
SCENARIO("RTCP XR parsing", "[parser][rtcp][xr]")
{
// clang-format off
uint8_t buffer[] =
{
0xa0, 0xcf, 0x00, 0x08, // Padding, Type: 207 (XR), Length: 8
0x5d, 0x93, 0x15, 0x34, // Sender SSRC: 0x5d931534
// Extended Report DLRR
0x05, 0x00, 0x00, 0x06, // BT: 5 (DLRR), Block Length: 6
0x11, 0x12, 0x13, 0x14, // SSRC 1
0x00, 0x11, 0x00, 0x11, // LRR 1
0x11, 0x00, 0x11, 0x00, // DLRR 1
0x21, 0x22, 0x23, 0x24, // SSRC 2
0x00, 0x22, 0x00, 0x22, // LRR 2
0x22, 0x00, 0x22, 0x00, // DLRR 2
0x00, 0x00, 0x00, 0x04 // Padding (4 bytes)
};
// clang-format on
SECTION("parse XR packet")
{
auto* packet = ExtendedReportPacket::Parse(buffer, sizeof(buffer));
REQUIRE(packet);
// Despite total buffer size is 40 bytes, our GetSize() method doesn't not
// consider RTCP padding (4 bytes in this case).
REQUIRE(packet->GetSize() == 36);
REQUIRE(packet->GetCount() == 0);
REQUIRE(packet->GetSsrc() == 0x5d931534);
size_t blockIdx{ 0u };
for (auto it = packet->Begin(); it != packet->End(); ++it, ++blockIdx)
{
auto* block = *it;
switch (blockIdx)
{
case 0:
{
REQUIRE(block->GetSize() == 28);
size_t ssrcInfoIdx{ 0u };
auto* dlrrBlock = reinterpret_cast<DelaySinceLastRr*>(block);
for (auto it2 = dlrrBlock->Begin(); it2 != dlrrBlock->End(); ++it2, ++ssrcInfoIdx)
{
auto* ssrcInfo = *it2;
switch (ssrcInfoIdx)
{
case 0:
{
REQUIRE(ssrcInfo->GetSsrc() == 0x11121314);
REQUIRE(ssrcInfo->GetLastReceiverReport() == 0x00110011);
REQUIRE(ssrcInfo->GetDelaySinceLastReceiverReport() == 0x11001100);
break;
}
case 1:
{
REQUIRE(ssrcInfo->GetSsrc() == 0x21222324);
REQUIRE(ssrcInfo->GetLastReceiverReport() == 0x00220022);
REQUIRE(ssrcInfo->GetDelaySinceLastReceiverReport() == 0x22002200);
break;
}
}
}
// There are 2 SSRC infos.
REQUIRE(ssrcInfoIdx == 2);
break;
}
}
}
// There are 1 block (the DLRR block).
REQUIRE(blockIdx == 1);
delete packet;
}
}
SCENARIO("RTCP XrDelaySinceLastRt parsing", "[parser][rtcp][xr-dlrr]") SCENARIO("RTCP XrDelaySinceLastRt parsing", "[parser][rtcp][xr-dlrr]")
{ {
SECTION("create RRT") SECTION("create RRT")
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论