Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
9522597f
提交
9522597f
authored
11月 22, 2023
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve TestXr.cpp
上级
8d24fa7c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
38 行增加
和
3 行删除
+38
-3
TestVP8.cpp
worker/test/src/RTC/Codecs/TestVP8.cpp
+1
-1
TestXr.cpp
worker/test/src/RTC/RTCP/TestXr.cpp
+37
-2
没有找到文件。
worker/test/src/RTC/Codecs/TestVP8.cpp
浏览文件 @
9522597f
#include "common.hpp"
#include "common.hpp"
#include "RTC/Codecs/VP8.hpp"
#include "RTC/Codecs/VP8.hpp"
#include <catch2/catch.hpp>
#include <catch2/catch.hpp>
#include <cstring> // std::memcmp()
#include <cstring> // std::memcmp()
, std::memcpy()
using
namespace
RTC
;
using
namespace
RTC
;
...
...
worker/test/src/RTC/RTCP/TestXr.cpp
浏览文件 @
9522597f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#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>
#include <cstring> // std::memcmp
#include <cstring> // std::memcmp
(), std::memcpy()
using
namespace
RTC
::
RTCP
;
using
namespace
RTC
::
RTCP
;
...
@@ -12,7 +12,7 @@ SCENARIO("RTCP XR parsing", "[parser][rtcp][xr]")
...
@@ -12,7 +12,7 @@ SCENARIO("RTCP XR parsing", "[parser][rtcp][xr]")
// clang-format off
// clang-format off
uint8_t
buffer
[]
=
uint8_t
buffer
[]
=
{
{
0xa0
,
0xcf
,
0x00
,
0x0
8
,
// Padding, Type: 207 (XR), Length: 8
0xa0
,
0xcf
,
0x00
,
0x0
9
,
// Padding, Type: 207 (XR), Length: 9
0x5d
,
0x93
,
0x15
,
0x34
,
// Sender SSRC: 0x5d931534
0x5d
,
0x93
,
0x15
,
0x34
,
// Sender SSRC: 0x5d931534
// Extended Report DLRR
// Extended Report DLRR
0x05
,
0x00
,
0x00
,
0x06
,
// BT: 5 (DLRR), Block Length: 6
0x05
,
0x00
,
0x00
,
0x06
,
// BT: 5 (DLRR), Block Length: 6
...
@@ -33,6 +33,7 @@ SCENARIO("RTCP XR parsing", "[parser][rtcp][xr]")
...
@@ -33,6 +33,7 @@ SCENARIO("RTCP XR parsing", "[parser][rtcp][xr]")
REQUIRE
(
packet
);
REQUIRE
(
packet
);
// Despite total buffer size is 40 bytes, our GetSize() method doesn't not
// Despite total buffer size is 40 bytes, our GetSize() method doesn't not
// consider RTCP padding (4 bytes in this case).
// consider RTCP padding (4 bytes in this case).
// https://github.com/versatica/mediasoup/issues/1233
REQUIRE
(
packet
->
GetSize
()
==
36
);
REQUIRE
(
packet
->
GetSize
()
==
36
);
REQUIRE
(
packet
->
GetCount
()
==
0
);
REQUIRE
(
packet
->
GetCount
()
==
0
);
REQUIRE
(
packet
->
GetSsrc
()
==
0x5d931534
);
REQUIRE
(
packet
->
GetSsrc
()
==
0x5d931534
);
...
@@ -89,6 +90,40 @@ SCENARIO("RTCP XR parsing", "[parser][rtcp][xr]")
...
@@ -89,6 +90,40 @@ SCENARIO("RTCP XR parsing", "[parser][rtcp][xr]")
// There are 1 block (the DLRR block).
// There are 1 block (the DLRR block).
REQUIRE
(
blockIdx
==
1
);
REQUIRE
(
blockIdx
==
1
);
SECTION
(
"serialize packet instance"
)
{
// NOTE: Padding in RTCP is removed (if not needed) when serializing the
// packet, so we must mangle the buffer content (padding bit) and the
// buffer length before comparing the serialized packet with and original
// buffer.
const
size_t
paddingBytes
{
4
};
const
size_t
serializedBufferLength
=
sizeof
(
buffer
)
-
paddingBytes
;
uint8_t
serialized
[
serializedBufferLength
]
=
{
0
};
// Clone the original buffer into a new buffer without padding.
uint8_t
clonedBuffer
[
serializedBufferLength
]
=
{
0
};
std
::
memcpy
(
clonedBuffer
,
buffer
,
serializedBufferLength
);
// Remove the padding bit in the first byte of the cloned buffer.
clonedBuffer
[
0
]
=
0x80
;
// Change RTCP length field in the cloned buffer.
clonedBuffer
[
3
]
=
clonedBuffer
[
3
]
-
1
;
packet
->
Serialize
(
serialized
);
auto
*
packet2
=
ExtendedReportPacket
::
Parse
(
serialized
,
serializedBufferLength
);
REQUIRE
(
packet2
->
GetType
()
==
Type
::
XR
);
REQUIRE
(
packet2
->
GetCount
()
==
0
);
REQUIRE
(
packet2
->
GetSize
()
==
36
);
REQUIRE
(
std
::
memcmp
(
clonedBuffer
,
serialized
,
serializedBufferLength
)
==
0
);
delete
packet2
;
}
delete
packet
;
delete
packet
;
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论