Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
c84399c3
提交
c84399c3
authored
12月 15, 2018
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RTCP/FeedbackPsRemb: it seems to fix issue #246 but not 100% sure sue to #243
上级
0cadf998
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
28 行增加
和
20 行删除
+28
-20
FeedbackPsRemb.cpp
worker/src/RTC/RTCP/FeedbackPsRemb.cpp
+28
-20
没有找到文件。
worker/src/RTC/RTCP/FeedbackPsRemb.cpp
浏览文件 @
c84399c3
...
@@ -20,7 +20,9 @@ namespace RTC
...
@@ -20,7 +20,9 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
if
(
sizeof
(
CommonHeader
)
+
sizeof
(
FeedbackPacket
::
Header
)
>
len
)
// Check that there is space for CommonHeader, FeedbackPacket::Header and 8 bytes for
// REMB (unique identifier and basic fields).
if
(
sizeof
(
CommonHeader
)
+
sizeof
(
FeedbackPacket
::
Header
)
+
8
>
len
)
{
{
MS_WARN_TAG
(
rtcp
,
"not enough space for Feedback packet, discarded"
);
MS_WARN_TAG
(
rtcp
,
"not enough space for Feedback packet, discarded"
);
...
@@ -40,43 +42,49 @@ namespace RTC
...
@@ -40,43 +42,49 @@ namespace RTC
FeedbackPsRembPacket
::
FeedbackPsRembPacket
(
CommonHeader
*
commonHeader
)
FeedbackPsRembPacket
::
FeedbackPsRembPacket
(
CommonHeader
*
commonHeader
)
:
FeedbackPsAfbPacket
(
commonHeader
,
FeedbackPsAfbPacket
::
Application
::
REMB
)
:
FeedbackPsAfbPacket
(
commonHeader
,
FeedbackPsAfbPacket
::
Application
::
REMB
)
{
{
auto
*
data
=
reinterpret_cast
<
uint8_t
*>
(
commonHeader
+
1
);
// TODO: We should verify that this len matches the the len in Parse() function
// above.
size_t
len
=
static_cast
<
size_t
>
(
ntohs
(
commonHeader
->
length
)
+
1
)
*
4
;
// Make data point to the 4 bytes that must containt the "REMB" identifier.
auto
*
data
=
reinterpret_cast
<
uint8_t
*>
(
commonHeader
)
+
sizeof
(
CommonHeader
)
+
sizeof
(
FeedbackPacket
::
Header
);
size_t
numSsrcs
=
data
[
4
];
if
(
Utils
::
Byte
::
Get4Bytes
(
data
,
8
)
!=
uniqueIdentifier
)
// Ensure there is space for the the announced number of SSRC feedbacks.
if
(
len
!=
sizeof
(
CommonHeader
)
+
sizeof
(
FeedbackPacket
::
Header
)
+
8
+
(
numSsrcs
*
sizeof
(
uint32_t
)))
{
{
MS_WARN_TAG
(
rtcp
,
"invalid unique indentifier in REMB packet"
);
MS_WARN_TAG
(
rtcp
,
"invalid payload size (%zu bytes) for the given number of ssrcs (%zu)"
,
len
,
numSsrcs
);
this
->
isCorrect
=
false
;
this
->
isCorrect
=
false
;
return
;
return
;
}
}
size_t
numSsrcs
=
data
[
12
];
// Verify the "REMB" unique identifier.
uint8_t
exponent
=
data
[
13
]
>>
2
;
if
(
Utils
::
Byte
::
Get4Bytes
(
data
,
0
)
!=
FeedbackPsRembPacket
::
uniqueIdentifier
)
uint64_t
mantissa
=
(
static_cast
<
uint32_t
>
(
data
[
13
]
&
0x03
)
<<
16
)
|
Utils
::
Byte
::
Get2Bytes
(
data
,
14
);
this
->
bitrate
=
(
mantissa
<<
exponent
);
if
((
this
->
bitrate
>>
exponent
)
!=
mantissa
)
{
{
MS_WARN_TAG
(
rtcp
,
"invalid
REMB bitrate value : %"
PRIu64
" *2^%u"
,
mantissa
,
exponent
);
MS_WARN_TAG
(
rtcp
,
"invalid
unique indentifier in REMB packet"
);
this
->
isCorrect
=
false
;
this
->
isCorrect
=
false
;
return
;
return
;
}
}
// Check length.
// size_t numSsrcs = data[12];
size_t
len
=
static_cast
<
size_t
>
(
ntohs
(
commonHeader
->
length
)
+
1
)
*
4
;
uint8_t
exponent
=
data
[
5
]
>>
2
;
uint64_t
mantissa
=
(
static_cast
<
uint32_t
>
(
data
[
5
]
&
0x03
)
<<
16
)
|
Utils
::
Byte
::
Get2Bytes
(
data
,
6
);
if
(
len
!=
sizeof
(
CommonHeader
)
+
sizeof
(
FeedbackPacket
::
Header
)
+
sizeof
(
Header
)
+
(
numSsrcs
*
sizeof
(
uint32_t
)))
this
->
bitrate
=
(
mantissa
<<
exponent
);
if
((
this
->
bitrate
>>
exponent
)
!=
mantissa
)
{
{
MS_WARN_TAG
(
MS_WARN_TAG
(
rtcp
,
"invalid REMB bitrate value: %"
PRIu64
" *2^%u"
,
mantissa
,
exponent
);
rtcp
,
"invalid payload size (%zu bytes) for the given number of ssrcs (%zu)"
,
len
,
numSsrcs
);
this
->
isCorrect
=
false
;
this
->
isCorrect
=
false
;
return
;
return
;
}
}
size_t
index
{
16
};
// Make index point to the first SSRC feedback item.
size_t
index
{
8
};
this
->
ssrcs
.
reserve
(
numSsrcs
);
this
->
ssrcs
.
reserve
(
numSsrcs
);
for
(
size_t
n
{
0
};
n
<
numSsrcs
;
++
n
)
for
(
size_t
n
{
0
};
n
<
numSsrcs
;
++
n
)
...
@@ -100,8 +108,8 @@ namespace RTC
...
@@ -100,8 +108,8 @@ namespace RTC
++
exponent
;
++
exponent
;
}
}
Utils
::
Byte
::
Set4Bytes
(
buffer
,
offset
,
uniqueIdentifier
);
Utils
::
Byte
::
Set4Bytes
(
buffer
,
offset
,
FeedbackPsRembPacket
::
uniqueIdentifier
);
offset
+=
sizeof
(
uniqueIdentifier
);
offset
+=
sizeof
(
FeedbackPsRembPacket
::
uniqueIdentifier
);
buffer
[
offset
]
=
this
->
ssrcs
.
size
();
buffer
[
offset
]
=
this
->
ssrcs
.
size
();
offset
+=
1
;
offset
+=
1
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论