Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
6697804f
Unverified
提交
6697804f
authored
8月 09, 2023
作者:
Iñaki Baz Castillo
提交者:
GitHub
8月 09, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix RTCP SDES (#1139)
上级
df1f224e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
100 行增加
和
12 行删除
+100
-12
CHANGELOG.md
CHANGELOG.md
+5
-0
Dockerfile
worker/Dockerfile
+1
-1
Sdes.hpp
worker/include/RTC/RTCP/Sdes.hpp
+3
-0
Sdes.cpp
worker/src/RTC/RTCP/Sdes.cpp
+87
-11
TestSdes.cpp
worker/test/src/RTC/RTCP/TestSdes.cpp
+0
-0
tests.cpp
worker/test/src/tests.cpp
+4
-0
没有找到文件。
CHANGELOG.md
浏览文件 @
6697804f
# Changelog
### Next
*
Fix RTCP SDES (
[
PR #1139
](
https://github.com/versatica/mediasoup/pull/1139
)
).
### 3.12.8
*
Export
`workerBin`
absolute path (
[
PR #1123
](
https://github.com/versatica/mediasoup/pull/1123
)
).
...
...
worker/Dockerfile
浏览文件 @
6697804f
...
...
@@ -12,7 +12,7 @@ RUN \
clang
# Install node 16.
RUN
curl
-sL
https://deb.nodesource.com/setup_1
6
.x | bash -
RUN
curl
-sL
https://deb.nodesource.com/setup_1
8
.x | bash -
RUN
apt-get
install
-y
nodejs
# Make CC and CXX point to clang/clang++ installed above.
...
...
worker/include/RTC/RTCP/Sdes.hpp
浏览文件 @
6697804f
...
...
@@ -121,6 +121,9 @@ namespace RTC
size
+=
item
->
GetSize
();
}
// Add the mandatory null octet.
++
size
;
// Consider pading to 32 bits (4 bytes) boundary.
// http://stackoverflow.com/questions/11642210/computing-padding-required-for-n-byte-alignment
return
(
size
+
3
)
&
~
3
;
...
...
worker/src/RTC/RTCP/Sdes.cpp
浏览文件 @
6697804f
...
...
@@ -36,17 +36,21 @@ namespace RTC
// Get the header.
auto
*
header
=
const_cast
<
Header
*>
(
reinterpret_cast
<
const
Header
*>
(
data
));
// If item type is 0, there is no need for length field (unless padding
// is needed).
if
(
len
>
0
&&
header
->
type
==
SdesItem
::
Type
::
END
)
{
return
nullptr
;
}
// data size must be >= header + length value.
if
(
len
<
HeaderSize
||
len
<
(
1u
*
2
)
+
header
->
length
)
if
(
len
<
HeaderSize
||
len
<
HeaderSize
+
header
->
length
)
{
MS_WARN_TAG
(
rtcp
,
"not enough space for SDES item, discarded"
);
return
nullptr
;
}
if
(
header
->
type
==
SdesItem
::
Type
::
END
)
return
nullptr
;
return
new
SdesItem
(
header
);
}
...
...
@@ -57,7 +61,9 @@ namespace RTC
auto
it
=
SdesItem
::
type2String
.
find
(
type
);
if
(
it
==
SdesItem
::
type2String
.
end
())
{
return
Unknown
;
}
return
it
->
second
;
}
...
...
@@ -123,19 +129,77 @@ namespace RTC
std
::
unique_ptr
<
SdesChunk
>
chunk
(
new
SdesChunk
(
ssrc
));
size_t
offset
=
4u
/* ssrc */
;
size_t
offset
{
4u
};
/* ssrc */
size_t
chunkLength
{
4u
};
while
(
len
>
offset
)
{
SdesItem
*
item
=
SdesItem
::
Parse
(
data
+
offset
,
len
-
offset
);
auto
*
item
=
SdesItem
::
Parse
(
data
+
offset
,
len
-
offset
);
if
(
!
item
)
{
break
;
}
chunk
->
AddItem
(
item
);
chunkLength
+=
item
->
GetSize
();
offset
+=
item
->
GetSize
();
}
// Once all items have been parsed, there must be 1, 2, 3 or 4 null octets
// (this is mandatory). The first one (AKA item type 0) means "end of
// items", and the others maybe needed for padding the chunk to 4 bytes.
// First ensure that there is at least one null octet.
if
(
offset
==
len
||
(
offset
<
len
&&
Utils
::
Byte
::
Get1Byte
(
data
,
offset
)
!=
0u
))
{
MS_WARN_TAG
(
rtcp
,
"invalid SDES chunk (missing mandatory null octet), discarded"
);
return
nullptr
;
}
// So we have the mandatory null octet.
++
chunkLength
;
++
offset
;
// Then check that there are 0, 1, 2 or 3 (no more) null octets that pad
// the chunk to 4 bytes.
uint16_t
neededAdditionalNullOctets
=
Utils
::
Byte
::
PadTo4Bytes
(
static_cast
<
uint16_t
>
(
chunkLength
))
-
static_cast
<
uint16_t
>
(
chunkLength
);
uint16_t
foundAdditionalNullOctets
{
0u
};
for
(
uint16_t
i
{
0u
};
len
>
offset
&&
i
<
neededAdditionalNullOctets
;
++
i
)
{
if
(
Utils
::
Byte
::
Get1Byte
(
data
,
offset
)
!=
0u
)
{
MS_WARN_TAG
(
rtcp
,
"invalid SDES chunk (missing additional null octets [needed:%"
PRIu16
", found:%"
PRIu16
"]), discarded"
,
neededAdditionalNullOctets
,
foundAdditionalNullOctets
);
return
nullptr
;
}
++
foundAdditionalNullOctets
;
++
chunkLength
;
++
offset
;
}
if
(
foundAdditionalNullOctets
!=
neededAdditionalNullOctets
)
{
MS_WARN_TAG
(
rtcp
,
"invalid SDES chunk (missing additional null octets [needed:%"
PRIu16
", found:%"
PRIu16
"]), discarded"
,
neededAdditionalNullOctets
,
foundAdditionalNullOctets
);
return
nullptr
;
}
return
chunk
.
release
();
}
...
...
@@ -155,10 +219,15 @@ namespace RTC
offset
+=
item
->
Serialize
(
buffer
+
offset
);
}
// Add the mandatory null octet.
buffer
[
offset
]
=
0
;
++
offset
;
// 32 bits padding.
const
size_t
padding
=
(
-
offset
)
&
3
;
for
(
size_t
i
{
0
};
i
<
padding
;
++
i
)
for
(
size_t
i
{
0
u
};
i
<
padding
;
++
i
)
{
buffer
[
offset
+
i
]
=
0
;
}
...
...
@@ -195,9 +264,9 @@ namespace RTC
size_t
offset
=
Packet
::
CommonHeaderSize
;
uint8_t
count
=
header
->
count
;
while
(
(
count
--
!=
0u
)
&&
(
len
>
offset
))
while
(
count
--
&&
(
len
>
offset
))
{
SdesChunk
*
chunk
=
SdesChunk
::
Parse
(
data
+
offset
,
len
-
offset
);
auto
*
chunk
=
SdesChunk
::
Parse
(
data
+
offset
,
len
-
offset
);
if
(
chunk
!=
nullptr
)
{
...
...
@@ -206,10 +275,17 @@ namespace RTC
}
else
{
return
packet
.
release
()
;
break
;
}
}
if
(
packet
->
GetCount
()
!=
header
->
count
)
{
MS_WARN_TAG
(
rtcp
,
"RTCP count value doesn't match found number of chunks, discarded"
);
return
nullptr
;
}
return
packet
.
release
();
}
...
...
@@ -223,7 +299,7 @@ namespace RTC
size_t
length
=
0
;
uint8_t
*
header
=
{
nullptr
};
for
(
size_t
i
=
0
;
i
<
this
->
GetCount
();
i
++
)
for
(
size_t
i
{
0u
};
i
<
this
->
GetCount
();
++
i
)
{
// Create a new SDES packet header for each 31 chunks.
if
(
i
%
MaxChunksPerPacket
==
0
)
...
...
worker/test/src/RTC/RTCP/TestSdes.cpp
浏览文件 @
6697804f
差异被折叠。
点击展开。
worker/test/src/tests.cpp
浏览文件 @
6697804f
...
...
@@ -40,6 +40,10 @@ int main(int argc, char* argv[])
{
Settings
::
configuration
.
logTags
.
rtp
=
true
;
}
if
(
std
::
getenv
(
"MS_TEST_LOG_TAG_RTCP"
))
{
Settings
::
configuration
.
logTags
.
rtcp
=
true
;
}
// Initialize static stuff.
DepLibUV
::
ClassInit
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论