Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
9bbc2770
提交
9bbc2770
authored
10月 18, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Worker tests: RTCP Sender Report
上级
a1e2d57d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
71 行增加
和
106 行删除
+71
-106
gulpfile.js
gulpfile.js
+1
-0
TestSenderReport.cpp
worker/test/RTC/RTCP/TestSenderReport.cpp
+70
-106
没有找到文件。
gulpfile.js
浏览文件 @
9bbc2770
...
...
@@ -112,6 +112,7 @@ gulp.task('test:node', shell.task(
gulp
.
task
(
'test:worker'
,
shell
.
task
(
[
'./worker/deps/lcov/bin/lcov --directory ./ --zerocounters'
,
'if type make &> /dev/null; then make test; fi'
,
`cd worker && ./out/
${
process
.
env
.
MEDIASOUP_BUILDTYPE
===
'Debug'
?
'Debug'
:
'Release'
}
/mediasoup-worker-test --invisibles --use-colour=yes `
+
...
...
worker/test/RTC/RTCP/TestSenderReport.cpp
浏览文件 @
9bbc2770
#include "common.hpp"
#include "catch.hpp"
#include "RTC/RTCP/SenderReport.hpp"
#include "RTC/RTCP/ReceiverReport.hpp"
using
namespace
RTC
::
RTCP
;
// RTCP Packet. Sender Report and Receiver Report.
uint8_t
buffer
[]
=
{
0x81
,
0xc8
,
0x00
,
0x0c
,
// Type: 200 (Sender Report), Count: 1, Length: 12
0x5d
,
0x93
,
0x15
,
0x34
,
// SSRC: 0x5d931534
0xdd
,
0x3a
,
0xc1
,
0xb4
,
// NTP Sec: 3711615412
0x76
,
0x54
,
0x71
,
0x71
,
// NTP Frac: 1985245553
0x00
,
0x08
,
0xcf
,
0x00
,
// RTP timestamp: 577280
0x00
,
0x00
,
0x0e
,
0x18
,
// Packet count: 3608
0x00
,
0x08
,
0xcf
,
0x00
,
// Octed count: 577280
// Receiver Report
0x01
,
0x93
,
0x2d
,
0xb4
,
// SSRC. 0x01932db4
0x00
,
0x00
,
0x00
,
0x01
,
// Fraction lost: 0, Total lost: 1
0x00
,
0x00
,
0x00
,
0x00
,
// Extended highest sequence number: 0
0x00
,
0x00
,
0x00
,
0x00
,
// Jitter: 0
0x00
,
0x00
,
0x00
,
0x00
,
// Last SR: 0
0x00
,
0x00
,
0x00
,
0x05
// DLSR: 0
};
// Sender Report buffer start point.
uint8_t
*
srBuffer
=
buffer
+
sizeof
(
Packet
::
CommonHeader
);
// SR values.
uint32_t
ssrc
=
0x5d931534
;
uint32_t
ntpSec
=
3711615412
;
uint32_t
ntpFrac
=
1985245553
;
uint32_t
rtpTs
=
577280
;
uint32_t
packetCount
=
3608
;
uint32_t
octetCount
=
577280
;
void
verifySenderReport
(
SenderReport
*
report
)
{
REQUIRE
(
report
->
GetSsrc
()
==
ssrc
);
REQUIRE
(
report
->
GetNtpSec
()
==
ntpSec
);
REQUIRE
(
report
->
GetNtpFrac
()
==
ntpFrac
);
REQUIRE
(
report
->
GetRtpTs
()
==
rtpTs
);
REQUIRE
(
report
->
GetPacketCount
()
==
packetCount
);
REQUIRE
(
report
->
GetOctetCount
()
==
octetCount
);
}
SCENARIO
(
"RTCP SR parsing"
,
"[parser][rtcp][sr]"
)
{
SECTION
(
"parse
SenderR
eport"
)
SECTION
(
"parse
sender r
eport"
)
{
uint8_t
buffer
[]
=
{
0x00
,
0x00
,
0x04
,
0xD2
,
// ssrc
0x00
,
0x00
,
0x04
,
0xD2
,
// ntp sec
0x00
,
0x00
,
0x04
,
0xD2
,
// ntp frac
0x00
,
0x00
,
0x04
,
0xD2
,
// rtp ts
0x00
,
0x00
,
0x04
,
0xD2
,
// packet count
0x00
,
0x00
,
0x04
,
0xD2
,
// octet count
};
uint32_t
ssrc
=
1234
;
uint32_t
ntpSec
=
1234
;
uint32_t
ntpFrac
=
1234
;
uint32_t
rtpTs
=
1234
;
uint32_t
packetCount
=
1234
;
uint32_t
octetCount
=
1234
;
SenderReport
*
report
=
SenderReport
::
Parse
(
buffer
,
sizeof
(
SenderReport
::
Header
));
SenderReport
*
report
=
SenderReport
::
Parse
(
srBuffer
,
sizeof
(
SenderReport
::
Header
));
REQUIRE
(
report
);
REQUIRE
(
report
->
GetSsrc
()
==
ssrc
);
REQUIRE
(
report
->
GetNtpSec
()
==
ntpSec
);
REQUIRE
(
report
->
GetNtpFrac
()
==
ntpFrac
);
REQUIRE
(
report
->
GetRtpTs
()
==
rtpTs
);
REQUIRE
(
report
->
GetPacketCount
()
==
packetCount
);
REQUIRE
(
report
->
GetOctetCount
()
==
octetCount
);
verifySenderReport
(
report
);
SECTION
(
"serialize SenderReport object"
)
{
uint8_t
serialized
[
sizeof
(
SenderReport
::
Header
)]
=
{
0
};
report
->
Serialize
(
serialized
);
SECTION
(
"compare serialized SenderReport with original buffer"
)
{
REQUIRE
(
std
::
memcmp
(
srBuffer
,
serialized
,
sizeof
(
SenderReport
::
Header
))
==
0
);
}
}
delete
report
;
}
SECTION
(
"create SenderReport"
)
{
uint32_t
ssrc
=
1234
;
uint32_t
ntpSec
=
1234
;
uint32_t
ntpFrac
=
1234
;
uint32_t
rtpTs
=
1234
;
uint32_t
packetCount
=
1234
;
uint32_t
octetCount
=
1234
;
// Create local report and check content.
// SenderReport();
SenderReport
report1
;
report1
.
SetSsrc
(
ssrc
);
...
...
@@ -58,89 +81,30 @@ SCENARIO("RTCP SR parsing", "[parser][rtcp][sr]")
report1
.
SetPacketCount
(
packetCount
);
report1
.
SetOctetCount
(
octetCount
);
REQUIRE
(
report1
.
GetSsrc
()
==
ssrc
);
REQUIRE
(
report1
.
GetNtpSec
()
==
ntpSec
);
REQUIRE
(
report1
.
GetNtpFrac
()
==
ntpFrac
);
REQUIRE
(
report1
.
GetRtpTs
()
==
rtpTs
);
REQUIRE
(
report1
.
GetPacketCount
()
==
packetCount
);
REQUIRE
(
report1
.
GetOctetCount
()
==
octetCount
);
// Create report out of the existing one and check content.
// SenderReport(SenderReport* report);
SenderReport
report2
(
&
report1
);
REQUIRE
(
report2
.
GetSsrc
()
==
ssrc
);
REQUIRE
(
report2
.
GetNtpSec
()
==
ntpSec
);
REQUIRE
(
report2
.
GetNtpFrac
()
==
ntpFrac
);
REQUIRE
(
report2
.
GetRtpTs
()
==
rtpTs
);
REQUIRE
(
report2
.
GetPacketCount
()
==
packetCount
);
REQUIRE
(
report2
.
GetOctetCount
()
==
octetCount
);
}
verifySenderReport
(
&
report1
);
SECTION
(
"parse SenderReport"
)
{
uint8_t
buffer
[]
=
SECTION
(
"create a report out of the existing one"
)
{
0x81
,
0xc8
,
0x00
,
0x0c
,
// Type: 200 (Sender Report), Count: 1, Length: 12
0x5d
,
0x93
,
0x15
,
0x34
,
// SSRC: 0x5d931534
0xdd
,
0x3a
,
0xc1
,
0xb4
,
// NTP Sec: 3711615412
0x76
,
0x54
,
0x71
,
0x71
,
// NTP Frac: 1985245553
0x00
,
0x08
,
0xcf
,
0x00
,
// RTP timestamp: 577280
0x00
,
0x00
,
0x0e
,
0x18
,
// Packet count: 3608
0x00
,
0x08
,
0xcf
,
0x00
,
// Octed count: 577280
// Receiver Report
0x01
,
0x93
,
0x2d
,
0xb4
,
// SSRC. 0x01932db4
0x00
,
0x00
,
0x00
,
0x01
,
// Fraction lost: 0, Total lost: 1
0x00
,
0x00
,
0x00
,
0x00
,
// Extended highest sequence number: 0
0x00
,
0x00
,
0x00
,
0x00
,
// Jitter: 0
0x00
,
0x00
,
0x00
,
0x00
,
// Last SR: 0
0x00
,
0x00
,
0x00
,
0x05
// DLSR: 0
};
uint32_t
ssrc
=
0x5d931534
;
uint32_t
ntpSec
=
3711615412
;
uint32_t
ntpFrac
=
1985245553
;
uint32_t
rtpTs
=
577280
;
uint32_t
packetCount
=
3608
;
uint32_t
octetCount
=
577280
;
SenderReport
report2
(
&
report1
);
verifySenderReport
(
&
report2
);
}
}
SECTION
(
"parse Packet with SenderReport and ReceiverReport"
)
{
auto
packet
=
Packet
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
packet
);
REQUIRE
(
packet
->
GetType
()
==
Type
::
SR
);
auto
sr
=
dynamic_cast
<
SenderReportPacket
*>
(
packet
);
auto
sIt
=
sr
->
Begin
();
auto
sReport
=
*
sI
t
;
auto
sr
=
dynamic_cast
<
SenderReportPacket
*>
(
packet
);
auto
it
=
sr
->
Begin
();
auto
report
=
*
i
t
;
REQUIRE
(
sReport
->
GetSsrc
()
==
ssrc
);
REQUIRE
(
sReport
->
GetNtpSec
()
==
ntpSec
);
REQUIRE
(
sReport
->
GetNtpFrac
()
==
ntpFrac
);
REQUIRE
(
sReport
->
GetRtpTs
()
==
rtpTs
);
REQUIRE
(
sReport
->
GetPacketCount
()
==
packetCount
);
REQUIRE
(
sReport
->
GetOctetCount
()
==
octetCount
);
verifySenderReport
(
report
);
REQUIRE
(
packet
->
GetNext
());
auto
rr
=
dynamic_cast
<
ReceiverReportPacket
*>
(
packet
->
GetNext
());
auto
rIt
=
rr
->
Begin
();
auto
rReport
=
*
rIt
;
ssrc
=
0x01932db4
;
uint8_t
fractionLost
=
0
;
uint8_t
totalLost
=
1
;
uint32_t
lastSeq
=
0
;
uint32_t
jitter
=
0
;
uint32_t
lastSenderReport
=
0
;
uint32_t
delaySinceLastSenderReport
=
5
;
REQUIRE
(
rReport
);
REQUIRE
(
rReport
->
GetSsrc
()
==
ssrc
);
REQUIRE
(
rReport
->
GetFractionLost
()
==
fractionLost
);
REQUIRE
(
rReport
->
GetTotalLost
()
==
totalLost
);
REQUIRE
(
rReport
->
GetLastSeq
()
==
lastSeq
);
REQUIRE
(
rReport
->
GetJitter
()
==
jitter
);
REQUIRE
(
rReport
->
GetLastSenderReport
()
==
lastSenderReport
);
REQUIRE
(
rReport
->
GetDelaySinceLastSenderReport
()
==
delaySinceLastSenderReport
);
REQUIRE
(
packet
->
GetNext
()
->
GetType
()
==
Type
::
RR
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论