Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
cce9de74
Commit
cce9de74
authored
Apr 20, 2021
by
xia-chu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善rtcp nack相关代码
parent
31b6dde7
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
52 行增加
和
0 行删除
+52
-0
src/Rtcp/RtcpFCI.cpp
+27
-0
src/Rtcp/RtcpFCI.h
+20
-0
tests/test_rtcp_fci.cpp
+5
-0
没有找到文件。
src/Rtcp/RtcpFCI.cpp
查看文件 @
cce9de74
...
...
@@ -142,4 +142,30 @@ string FCI_REMB::dumpString() const {
return
printer
;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void
FCI_NACK
::
net2Host
()
{
pid
=
ntohs
(
pid
);
blp
=
ntohs
(
blp
);
}
vector
<
bool
>
FCI_NACK
::
getBitArray
()
const
{
vector
<
bool
>
ret
;
ret
.
resize
(
kBitSize
);
for
(
size_t
i
=
0
;
i
<
kBitSize
;
++
i
)
{
ret
[
i
]
=
blp
&
(
1
<<
(
kBitSize
-
i
-
1
));
}
return
ret
;
}
string
FCI_NACK
::
dumpString
()
const
{
_StrPrinter
printer
;
printer
<<
"pid:"
<<
pid
<<
",blp:"
;
for
(
auto
&
flag
:
getBitArray
())
{
printer
<<
flag
<<
" "
;
}
return
std
::
move
(
printer
);
}
}
//
namespace
mediakit
\ No newline at end of file
src/Rtcp/RtcpFCI.h
查看文件 @
cce9de74
...
...
@@ -221,11 +221,31 @@ public:
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
class
FCI_NACK
{
public
:
static
constexpr
size_t
kBitSize
=
16
;
// The PID field is used to specify a lost packet. The PID field
// refers to the RTP sequence number of the lost packet.
uint16_t
pid
;
// bitmask of following lost packets (BLP): 16 bits
uint16_t
blp
;
void
net2Host
();
vector
<
bool
>
getBitArray
()
const
;
string
dumpString
()
const
;
template
<
typename
Type
>
FCI_NACK
(
uint16_t
pid_h
,
const
Type
&
type
){
uint16_t
blp_h
=
0
;
int
i
=
kBitSize
;
for
(
auto
&
item
:
type
)
{
--
i
;
if
(
item
)
{
blp_h
|=
(
1
<<
i
);
}
}
blp
=
htons
(
blp_h
);
pid
=
htons
(
pid_h
);
}
}
PACKED
;
//RTPFB fmt = 3
...
...
tests/test_rtcp_fci.cpp
查看文件 @
cce9de74
...
...
@@ -37,5 +37,10 @@ int main() {
ptr
->
net2Host
(
str
.
size
());
InfoL
<<
ptr
->
dumpString
();
}
{
FCI_NACK
nack
(
1234
,
vector
<
int
>
({
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
0
}));
nack
.
net2Host
();
InfoL
<<
nack
.
dumpString
();
}
return
0
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论