Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
1ed3a247
Unverified
提交
1ed3a247
authored
11月 22, 2023
作者:
Iñaki Baz Castillo
提交者:
GitHub
11月 22, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RTCP SDES: fix packet size calculation (#1236)
上级
9522597f
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
94 行增加
和
9 行删除
+94
-9
CHANGELOG.md
CHANGELOG.md
+5
-0
Sdes.hpp
worker/include/RTC/RTCP/Sdes.hpp
+1
-1
TestSdes.cpp
worker/test/src/RTC/RTCP/TestSdes.cpp
+88
-8
没有找到文件。
CHANGELOG.md
浏览文件 @
1ed3a247
# Changelog
# Changelog
### NEXT
*
Fix RTCP SDES packet size calculation (
[
PR #1236
](
https://github.com/versatica/mediasoup/pull/1236
)
based on PR
[
PR #1234
](
https://github.com/versatica/mediasoup/pull/1234
)
by @ybybwdwd).
### 3.13.4
### 3.13.4
*
Fix RTCP DLRR (Delay Since Last Receiver Report) block parsing (
[
PR #1234
](
https://github.com/versatica/mediasoup/pull/1234
)
).
*
Fix RTCP DLRR (Delay Since Last Receiver Report) block parsing (
[
PR #1234
](
https://github.com/versatica/mediasoup/pull/1234
)
).
...
...
worker/include/RTC/RTCP/Sdes.hpp
浏览文件 @
1ed3a247
...
@@ -214,7 +214,7 @@ namespace RTC
...
@@ -214,7 +214,7 @@ namespace RTC
// A serialized packet can contain a maximum of 31 chunks.
// A serialized packet can contain a maximum of 31 chunks.
// If number of chunks exceeds 31 then the required number of packets
// If number of chunks exceeds 31 then the required number of packets
// will be serialized which will take the size calculated below.
// will be serialized which will take the size calculated below.
size_t
size
=
Packet
::
CommonHeaderSize
*
((
this
->
GetCount
()
/
MaxChunksPerPacket
)
+
1
);
size_t
size
=
Packet
::
CommonHeaderSize
*
((
this
->
GetCount
()
/
(
MaxChunksPerPacket
+
1
)
)
+
1
);
for
(
auto
*
chunk
:
this
->
chunks
)
for
(
auto
*
chunk
:
this
->
chunks
)
{
{
...
...
worker/test/src/RTC/RTCP/TestSdes.cpp
浏览文件 @
1ed3a247
#include "common.hpp"
#include "common.hpp"
#include "RTC/RTCP/Packet.hpp"
#include "RTC/RTCP/Sdes.hpp"
#include "RTC/RTCP/Sdes.hpp"
#include <catch2/catch.hpp>
#include <catch2/catch.hpp>
#include <cstring> // std::memcmp()
#include <cstring> // std::memcmp()
...
@@ -383,40 +384,118 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
...
@@ -383,40 +384,118 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
REQUIRE
(
!
packet
);
REQUIRE
(
!
packet
);
}
}
SECTION
(
"create SDES packet with 31 chunks"
)
{
const
size_t
count
=
31
;
SdesPacket
packet
;
// Create a chunk and an item to obtain their size.
SdesChunk
*
chunk
=
new
SdesChunk
(
1234
/*ssrc*/
);
auto
*
item1
=
new
RTC
::
RTCP
::
SdesItem
(
SdesItem
::
Type
::
CNAME
,
item1Value
.
size
(),
item1Value
.
c_str
());
chunk
->
AddItem
(
item1
);
auto
chunkSize
=
chunk
->
GetSize
();
delete
chunk
;
for
(
auto
i
{
1
};
i
<=
count
;
++
i
)
{
// Create chunk and add to packet.
SdesChunk
*
chunk
=
new
SdesChunk
(
i
/*ssrc*/
);
auto
*
item1
=
new
RTC
::
RTCP
::
SdesItem
(
SdesItem
::
Type
::
CNAME
,
item1Value
.
size
(),
item1Value
.
c_str
());
chunk
->
AddItem
(
item1
);
packet
.
AddChunk
(
chunk
);
}
REQUIRE
(
packet
.
GetCount
()
==
count
);
REQUIRE
(
packet
.
GetSize
()
==
Packet
::
CommonHeaderSize
+
(
count
*
chunkSize
));
uint8_t
buffer1
[
1500
]
=
{
0
};
// Serialization must contain 1 SDES packet since report count doesn't
// exceed 31.
packet
.
Serialize
(
buffer1
);
auto
*
packet2
=
static_cast
<
SdesPacket
*>
(
Packet
::
Parse
(
buffer1
,
sizeof
(
buffer1
)));
REQUIRE
(
packet2
!=
nullptr
);
REQUIRE
(
packet2
->
GetCount
()
==
count
);
REQUIRE
(
packet2
->
GetSize
()
==
Packet
::
CommonHeaderSize
+
(
count
*
chunkSize
));
auto
reportIt
=
packet2
->
Begin
();
for
(
auto
i
{
1
};
i
<=
31
;
++
i
,
reportIt
++
)
{
auto
*
chunk
=
*
reportIt
;
REQUIRE
(
chunk
->
GetSsrc
()
==
i
);
auto
*
item
=
*
(
chunk
->
Begin
());
REQUIRE
(
item
->
GetType
()
==
SdesItem
::
Type
::
CNAME
);
REQUIRE
(
item
->
GetSize
()
==
2
+
item1Value
.
size
());
REQUIRE
(
std
::
string
(
item
->
GetValue
())
==
item1Value
);
}
SdesPacket
*
packet3
=
static_cast
<
SdesPacket
*>
(
packet2
->
GetNext
());
REQUIRE
(
packet3
==
nullptr
);
delete
packet3
;
}
SECTION
(
"create SDES packet with more than 31 chunks"
)
SECTION
(
"create SDES packet with more than 31 chunks"
)
{
{
const
size_t
count
=
33
;
const
size_t
count
=
33
;
SdesPacket
packet
;
SdesPacket
packet
;
// Create a chunk and an item to obtain their size.
SdesChunk
*
chunk
=
new
SdesChunk
(
1234
/*ssrc*/
);
auto
*
item1
=
new
RTC
::
RTCP
::
SdesItem
(
SdesItem
::
Type
::
CNAME
,
item1Value
.
size
(),
item1Value
.
c_str
());
chunk
->
AddItem
(
item1
);
auto
chunkSize
=
chunk
->
GetSize
();
delete
chunk
;
for
(
auto
i
=
1
;
i
<=
count
;
i
++
)
for
(
auto
i
{
1
};
i
<=
count
;
++
i
)
{
{
// Create chunk and add to packet.
// Create chunk and add to packet.
SdesChunk
*
chunk
1
=
new
SdesChunk
(
i
/*ssrc*/
);
SdesChunk
*
chunk
=
new
SdesChunk
(
i
/*ssrc*/
);
auto
*
item1
=
auto
*
item1
=
new
RTC
::
RTCP
::
SdesItem
(
SdesItem
::
Type
::
CNAME
,
item1Value
.
size
(),
item1Value
.
c_str
());
new
RTC
::
RTCP
::
SdesItem
(
SdesItem
::
Type
::
CNAME
,
item1Value
.
size
(),
item1Value
.
c_str
());
chunk
1
->
AddItem
(
item1
);
chunk
->
AddItem
(
item1
);
packet
.
AddChunk
(
chunk
1
);
packet
.
AddChunk
(
chunk
);
}
}
REQUIRE
(
packet
.
GetCount
()
==
count
);
REQUIRE
(
packet
.
GetCount
()
==
count
);
REQUIRE
(
packet
.
GetSize
()
==
Packet
::
CommonHeaderSize
+
(
31
*
chunkSize
)
+
Packet
::
CommonHeaderSize
+
((
count
-
31
)
*
chunkSize
));
uint8_t
buffer1
[
1500
]
=
{
0
};
uint8_t
buffer1
[
1500
]
=
{
0
};
// Serialization must contain 2
RR
packets since report count exceeds 31.
// Serialization must contain 2
SDES
packets since report count exceeds 31.
packet
.
Serialize
(
buffer1
);
packet
.
Serialize
(
buffer1
);
auto
*
packet2
=
static_cast
<
SdesPacket
*>
(
Packet
::
Parse
(
buffer1
,
sizeof
(
buffer1
)));
auto
*
packet2
=
static_cast
<
SdesPacket
*>
(
Packet
::
Parse
(
buffer1
,
sizeof
(
buffer1
)));
REQUIRE
(
packet2
!=
nullptr
);
REQUIRE
(
packet2
!=
nullptr
);
REQUIRE
(
packet2
->
GetCount
()
==
31
);
REQUIRE
(
packet2
->
GetCount
()
==
31
);
REQUIRE
(
packet2
->
GetSize
()
==
Packet
::
CommonHeaderSize
+
(
31
*
chunkSize
));
auto
reportIt
=
packet2
->
Begin
();
auto
reportIt
=
packet2
->
Begin
();
for
(
auto
i
=
1
;
i
<=
31
;
i
++
,
reportIt
++
)
for
(
auto
i
{
1
};
i
<=
31
;
++
i
,
reportIt
++
)
{
{
auto
*
chunk
=
*
reportIt
;
auto
*
chunk
=
*
reportIt
;
...
@@ -432,11 +511,12 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
...
@@ -432,11 +511,12 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
SdesPacket
*
packet3
=
static_cast
<
SdesPacket
*>
(
packet2
->
GetNext
());
SdesPacket
*
packet3
=
static_cast
<
SdesPacket
*>
(
packet2
->
GetNext
());
REQUIRE
(
packet3
!=
nullptr
);
REQUIRE
(
packet3
!=
nullptr
);
REQUIRE
(
packet3
->
GetCount
()
==
2
);
REQUIRE
(
packet3
->
GetCount
()
==
count
-
31
);
REQUIRE
(
packet3
->
GetSize
()
==
Packet
::
CommonHeaderSize
+
((
count
-
31
)
*
chunkSize
));
reportIt
=
packet3
->
Begin
();
reportIt
=
packet3
->
Begin
();
for
(
auto
i
=
1
;
i
<=
2
;
i
++
,
reportIt
++
)
for
(
auto
i
{
1
};
i
<=
2
;
++
i
,
reportIt
++
)
{
{
auto
*
chunk
=
*
reportIt
;
auto
*
chunk
=
*
reportIt
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论