Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
21ceb014
提交
21ceb014
authored
10月 19, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Worker tests: clang-format
上级
d025f6a4
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
157 行增加
和
44 行删除
+157
-44
gulpfile.js
gulpfile.js
+3
-1
TestBye.cpp
worker/test/RTC/RTCP/TestBye.cpp
+5
-2
TestFeedbackPs.cpp
worker/test/RTC/RTCP/TestFeedbackPs.cpp
+35
-17
TestFeedbackRtp.cpp
worker/test/RTC/RTCP/TestFeedbackRtp.cpp
+24
-13
TestPacket.cpp
worker/test/RTC/RTCP/TestPacket.cpp
+3
-0
TestReceiverReport.cpp
worker/test/RTC/RTCP/TestReceiverReport.cpp
+3
-0
TestSdes.cpp
worker/test/RTC/RTCP/TestSdes.cpp
+7
-3
TestSenderReport.cpp
worker/test/RTC/RTCP/TestSenderReport.cpp
+6
-4
TestNackGenerator.cpp
worker/test/RTC/TestNackGenerator.cpp
+21
-1
TestRtpDataCounter.cpp
worker/test/RTC/TestRtpDataCounter.cpp
+9
-0
TestRtpPacket.cpp
worker/test/RTC/TestRtpPacket.cpp
+14
-0
TestRtpStreamRecv.cpp
worker/test/RTC/TestRtpStreamRecv.cpp
+3
-0
TestRtpStreamSend.cpp
worker/test/RTC/TestRtpStreamSend.cpp
+6
-3
TestSeqManager.cpp
worker/test/RTC/TestSeqManager.cpp
+18
-0
没有找到文件。
gulpfile.js
浏览文件 @
21ceb014
...
...
@@ -19,7 +19,9 @@ const nodeFiles =
const
workerFiles
=
[
'worker/src/**/*.cpp'
,
'worker/include/**/*.hpp'
'worker/include/**/*.hpp'
,
'worker/test/**/*.cpp'
];
const
nodeTests
=
[
...
...
worker/test/RTC/RTCP/TestBye.cpp
浏览文件 @
21ceb014
...
...
@@ -9,6 +9,8 @@ using namespace RTC::RTCP;
namespace
TestBye
{
// RCTP BYE packet.
// clang-format off
uint8_t
buffer
[]
=
{
0x82
,
0xcb
,
0x00
,
0x06
,
// Type: 203 (Bye), Count: 2, length: 2
...
...
@@ -19,6 +21,7 @@ namespace TestBye
0x61
,
0x20
,
0x76
,
0x69
,
0x73
,
0x74
,
0x61
,
0x00
};
// clang-format on
uint32_t
ssrc1
=
0x624276e0
;
uint32_t
ssrc2
=
0x2624670e
;
...
...
@@ -52,7 +55,7 @@ SCENARIO("RTCP BYE parsing", "[parser][rtcp][bye]")
SECTION
(
"serialize packet instance"
)
{
uint8_t
serialized
[
sizeof
(
buffer
)]
=
{
0
};
uint8_t
serialized
[
sizeof
(
buffer
)]
=
{
0
};
packet
->
Serialize
(
serialized
);
...
...
@@ -78,7 +81,7 @@ SCENARIO("RTCP BYE parsing", "[parser][rtcp][bye]")
SECTION
(
"serialize packet instance"
)
{
uint8_t
serialized
[
sizeof
(
buffer
)]
=
{
0
};
uint8_t
serialized
[
sizeof
(
buffer
)]
=
{
0
};
packet
.
Serialize
(
serialized
);
...
...
worker/test/RTC/RTCP/TestFeedbackPs.cpp
浏览文件 @
21ceb014
...
...
@@ -15,7 +15,10 @@ using namespace RTC::RTCP;
namespace
TestFeedbackPsRemb
{
// RTCP REMB packet.
uint8_t
buffer
[]
=
{
// clang-format off
uint8_t
buffer
[]
=
{
0x8f
,
0xce
,
0x00
,
0x06
,
// Type: 206 (Payload Specific), Length: 6
0xfa
,
0x17
,
0xfa
,
0x17
,
// Sender SSRC: 0xfa17fa17
0x00
,
0x00
,
0x00
,
0x00
,
// Media source SSRC: 0x00000000
...
...
@@ -24,12 +27,13 @@ namespace TestFeedbackPsRemb
0x02
,
0xd0
,
0x37
,
0x02
,
// SSRC1: 0x02d03702
0x04
,
0xa7
,
0x67
,
0x47
// SSRC2: 0x04a76747
};
// clang-format on
// REMB values.
uint32_t
senderSsrc
=
0xfa17fa17
;
uint32_t
mediaSsrc
=
0
;
uint64_t
bitrate
=
122754
;
std
::
vector
<
uint32_t
>
ssrcs
{
0x02d03702
,
0x04a76747
};
uint32_t
mediaSsrc
=
0
;
uint64_t
bitrate
=
122754
;
std
::
vector
<
uint32_t
>
ssrcs
{
0x02d03702
,
0x04a76747
};
void
verifyRembPacket
(
FeedbackPsRembPacket
*
packet
)
{
...
...
@@ -44,13 +48,15 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
{
SECTION
(
"parse FeedbackPsSliItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x00
,
0x08
,
0x01
,
0x01
};
// clang-format on
uint16_t
first
=
1
;
uint16_t
number
=
4
;
uint16_t
first
=
1
;
uint16_t
number
=
4
;
uint8_t
pictureId
=
1
;
FeedbackPsSliItem
*
item
=
FeedbackPsSliItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
...
@@ -65,6 +71,7 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
SECTION
(
"parse FeedbackPsRpsiItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x08
,
// Padding Bits
...
...
@@ -72,31 +79,34 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
0x00
,
0x00
,
// Native RPSI bit string
0x00
,
0x00
,
0x01
,
0x00
};
// clang-format on
uint8_t
payloadType
=
1
;
uint8_t
payloadMask
=
1
;
size_t
length
=
5
;
size_t
length
=
5
;
FeedbackPsRpsiItem
*
item
=
FeedbackPsRpsiItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
item
);
REQUIRE
(
item
->
GetPayloadType
()
==
payloadType
);
REQUIRE
(
item
->
GetLength
()
==
length
);
REQUIRE
((
item
->
GetBitString
()[
item
->
GetLength
()
-
1
]
&
1
)
==
payloadMask
);
REQUIRE
((
item
->
GetBitString
()[
item
->
GetLength
()
-
1
]
&
1
)
==
payloadMask
);
delete
item
;
}
SECTION
(
"parse FeedbackPsFirItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
// SSRC
0x08
,
0x00
,
0x00
,
0x00
// Seq nr.
};
// clang-format on
uint32_t
ssrc
=
0
;
uint8_t
seq
=
8
;
uint8_t
seq
=
8
;
FeedbackPsFirItem
*
item
=
FeedbackPsFirItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
...
@@ -109,15 +119,17 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
SECTION
(
"parse FeedbackPsTstnItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
// SSRC
0x08
,
// Seq nr.
0x00
,
0x00
,
0x08
// Reserved | Index
};
// clang-format on
uint32_t
ssrc
=
0
;
uint8_t
seq
=
8
;
uint8_t
seq
=
8
;
uint8_t
index
=
1
;
FeedbackPsTstnItem
*
item
=
FeedbackPsTstnItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
...
@@ -132,6 +144,7 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
SECTION
(
"parse FeedbackPsVbcmItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
// SSRC
...
...
@@ -141,12 +154,13 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
0x01
,
// VBCM Octet String
0x00
,
0x00
,
0x00
// Padding
};
// clang-format on
uint32_t
ssrc
=
0
;
uint8_t
seq
=
8
;
uint32_t
ssrc
=
0
;
uint8_t
seq
=
8
;
uint8_t
payloadType
=
1
;
uint16_t
length
=
1
;
uint8_t
valueMask
=
1
;
uint16_t
length
=
1
;
uint8_t
valueMask
=
1
;
FeedbackPsVbcmItem
*
item
=
FeedbackPsVbcmItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
...
@@ -155,17 +169,19 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
REQUIRE
(
item
->
GetSequenceNumber
()
==
seq
);
REQUIRE
(
item
->
GetPayloadType
()
==
payloadType
);
REQUIRE
(
item
->
GetLength
()
==
length
);
REQUIRE
((
item
->
GetValue
()[
item
->
GetLength
()
-
1
]
&
1
)
==
valueMask
);
REQUIRE
((
item
->
GetValue
()[
item
->
GetLength
()
-
1
]
&
1
)
==
valueMask
);
delete
item
;
}
SECTION
(
"parse FeedbackPsLeiItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x00
,
0x00
,
0x00
,
0x01
// SSRC
};
// clang-format on
uint32_t
ssrc
=
1
;
...
...
@@ -179,6 +195,7 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
SECTION
(
"parse FeedbackPsAfbPacket"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x8F
,
0xce
,
0x00
,
0x03
,
// RTCP common header
...
...
@@ -186,8 +203,9 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
0x00
,
0x00
,
0x00
,
0x00
,
// Media SSRC
0x00
,
0x00
,
0x00
,
0x01
// Data
};
// clang-format on
size_t
dataSize
=
4
;
size_t
dataSize
=
4
;
uint8_t
dataBitmask
=
1
;
FeedbackPsAfbPacket
*
packet
=
FeedbackPsAfbPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
...
@@ -210,7 +228,7 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
SECTION
(
"serialize packet instance"
)
{
uint8_t
serialized
[
sizeof
(
buffer
)]
=
{
0
};
uint8_t
serialized
[
sizeof
(
buffer
)]
=
{
0
};
packet
->
Serialize
(
serialized
);
...
...
worker/test/RTC/RTCP/TestFeedbackRtp.cpp
浏览文件 @
21ceb014
...
...
@@ -11,6 +11,8 @@ using namespace RTC::RTCP;
namespace
TestFeedbackRtpNack
{
// RTCP NACK packet.
// clang-format off
uint8_t
buffer
[]
=
{
0x81
,
0xcd
,
0x00
,
0x03
,
// Type: 205 (Generic RTP Feedback), Length: 3
...
...
@@ -18,11 +20,12 @@ namespace TestFeedbackRtpNack
0x03
,
0x30
,
0xbd
,
0xee
,
// Media source SSRC: 0x0330bdee
0x0b
,
0x8f
,
0x00
,
0x03
// NACK PID: 2959, NACK BLP: 0x00000003
};
// clang-format on
// NACK values.
uint32_t
senderSsrc
=
0x00000001
;
uint32_t
mediaSsrc
=
0x0330bdee
;
uint16_t
pid
=
2959
;
uint32_t
senderSsrc
=
0x00000001
;
uint32_t
mediaSsrc
=
0x0330bdee
;
uint16_t
pid
=
2959
;
uint16_t
lostPacketBitmask
=
0x00000003
;
void
verifyNackPacket
(
FeedbackRtpNackPacket
*
packet
)
...
...
@@ -30,7 +33,7 @@ namespace TestFeedbackRtpNack
REQUIRE
(
packet
->
GetSenderSsrc
()
==
senderSsrc
);
REQUIRE
(
packet
->
GetMediaSsrc
()
==
mediaSsrc
);
auto
it
=
packet
->
Begin
();
auto
it
=
packet
->
Begin
();
auto
item
=
*
it
;
REQUIRE
(
item
->
GetPacketId
()
==
pid
);
...
...
@@ -52,7 +55,7 @@ SCENARIO("RTCP Feeback RTP parsing", "[parser][rtcp][feedback-rtp]")
SECTION
(
"serialize packet instance"
)
{
uint8_t
serialized
[
sizeof
(
buffer
)]
=
{
0
};
uint8_t
serialized
[
sizeof
(
buffer
)]
=
{
0
};
packet
->
Serialize
(
serialized
);
...
...
@@ -109,11 +112,13 @@ SCENARIO("RTCP Feeback RTP parsing", "[parser][rtcp][feedback-rtp]")
SECTION
(
"parse FeedbackRtpTmmbrItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0xba
,
0xac
,
0x8c
,
0xcd
,
0x18
,
0x2c
,
0x9e
,
0x00
};
// clang-format on
uint32_t
ssrc
=
3131870413
;
uint64_t
bitrate
=
365504
;
...
...
@@ -131,6 +136,7 @@ SCENARIO("RTCP Feeback RTP parsing", "[parser][rtcp][feedback-rtp]")
SECTION
(
"parse FeedbackRtpTmmbrPacket"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x83
,
0xcd
,
0x00
,
0x04
,
...
...
@@ -139,6 +145,7 @@ SCENARIO("RTCP Feeback RTP parsing", "[parser][rtcp][feedback-rtp]")
0xba
,
0xac
,
0x8c
,
0xcd
,
0x18
,
0x2c
,
0x9e
,
0x00
};
// clang-format on
uint32_t
ssrc
=
3131870413
;
uint64_t
bitrate
=
365504
;
...
...
@@ -160,12 +167,14 @@ SCENARIO("RTCP Feeback RTP parsing", "[parser][rtcp][feedback-rtp]")
SECTION
(
"parse FeedbackRtpTlleiItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x00
,
0x01
,
0
b10101010
,
0
b01010101
};
// clang-format on
uint16_t
packetId
=
1
;
uint16_t
packetId
=
1
;
uint16_t
lostPacketBitmask
=
0
b1010101001010101
;
FeedbackRtpTlleiItem
*
item
=
FeedbackRtpTlleiItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
...
@@ -179,6 +188,7 @@ SCENARIO("RTCP Feeback RTP parsing", "[parser][rtcp][feedback-rtp]")
SECTION
(
"parse FeedbackRtpEcnItem"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0x00
,
0x00
,
0x00
,
0x01
,
// Extended Highest Sequence Number
...
...
@@ -189,13 +199,14 @@ SCENARIO("RTCP Feeback RTP parsing", "[parser][rtcp][feedback-rtp]")
0x00
,
0x01
,
// Lost Packets Counter
0x00
,
0x01
// Duplication Counter
};
uint32_t
sequenceNumber
=
1
;
uint32_t
ect0Counter
=
1
;
uint32_t
ect1Counter
=
1
;
uint16_t
ecnCeCounter
=
1
;
uint16_t
notEctCounter
=
1
;
uint16_t
lostPackets
=
1
;
// clang-format on
uint32_t
sequenceNumber
=
1
;
uint32_t
ect0Counter
=
1
;
uint32_t
ect1Counter
=
1
;
uint16_t
ecnCeCounter
=
1
;
uint16_t
notEctCounter
=
1
;
uint16_t
lostPackets
=
1
;
uint16_t
duplicatedPackets
=
1
;
FeedbackRtpEcnItem
*
item
=
FeedbackRtpEcnItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
...
worker/test/RTC/RTCP/TestPacket.cpp
浏览文件 @
21ceb014
...
...
@@ -8,10 +8,13 @@ SCENARIO("RTCP parsing", "[parser][rtcp][packet]")
{
// RTCP common header
// Version:2, Padding:false, Count:0, Type:200(SR), Lengh:0
// clang-format off
uint8_t
buffer
[]
=
{
0x80
,
0xc8
,
0x00
,
0x00
};
// clang-format on
SECTION
(
"a RTCP packet may only contain the RTCP common header"
)
{
...
...
worker/test/RTC/RTCP/TestReceiverReport.cpp
浏览文件 @
21ceb014
...
...
@@ -8,6 +8,8 @@ using namespace RTC::RTCP;
namespace
TestReceiverReport
{
// RTCP Packet. Sender Report and Receiver Report.
// clang-format off
uint8_t
buffer
[]
=
{
0x81
,
0xc8
,
0x00
,
0x0c
,
// Type: 200 (Sender Report), Count: 1, Length: 12
...
...
@@ -25,6 +27,7 @@ namespace TestReceiverReport
0x00
,
0x00
,
0x00
,
0x00
,
// Last SR: 0
0x00
,
0x00
,
0x00
,
0x05
// DLSR: 0
};
// clang-format on
// Receiver Report buffer start point.
uint8_t
*
rrBuffer
=
buffer
+
sizeof
(
Packet
::
CommonHeader
)
+
sizeof
(
SenderReport
::
Header
);
...
...
worker/test/RTC/RTCP/TestSdes.cpp
浏览文件 @
21ceb014
...
...
@@ -9,6 +9,8 @@ using namespace RTC::RTCP;
namespace
TestSdes
{
// RTCP Sdes Packet.
// clang-format off
uint8_t
buffer
[]
=
{
0x81
,
0xca
,
0x00
,
0x06
,
// Type: 202 (SDES), Count: 1, Length: 6
...
...
@@ -19,11 +21,12 @@ namespace TestSdes
0x4f
,
0x63
,
0x49
,
0x4e
,
0x79
,
0x2f
,
0x00
,
0x00
};
// clang-format on
uint8_t
*
chunkBuffer
=
buffer
+
sizeof
(
Packet
::
CommonHeader
);
// SDES values.
uint32_t
ssrc
=
0x9f65e742
;
uint32_t
ssrc
=
0x9f65e742
;
SdesItem
::
Type
type
=
SdesItem
::
Type
::
CNAME
;
std
::
string
value
(
"t7mkYnCm46OcINy/"
);
size_t
length
=
16
;
...
...
@@ -56,13 +59,14 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
SECTION
(
"serialize SdesChunk instance"
)
{
uint8_t
serialized
[
sizeof
(
buffer
)
-
sizeof
(
Packet
::
CommonHeader
)]
=
{
0
};
uint8_t
serialized
[
sizeof
(
buffer
)
-
sizeof
(
Packet
::
CommonHeader
)]
=
{
0
};
chunk
->
Serialize
(
serialized
);
SECTION
(
"compare serialized SdesChunk with original buffer"
)
{
REQUIRE
(
std
::
memcmp
(
chunkBuffer
,
serialized
,
sizeof
(
buffer
)
-
sizeof
(
Packet
::
CommonHeader
))
==
0
);
REQUIRE
(
std
::
memcmp
(
chunkBuffer
,
serialized
,
sizeof
(
buffer
)
-
sizeof
(
Packet
::
CommonHeader
))
==
0
);
}
}
delete
packet
;
...
...
worker/test/RTC/RTCP/TestSenderReport.cpp
浏览文件 @
21ceb014
...
...
@@ -7,8 +7,9 @@ using namespace RTC::RTCP;
namespace
TestSenderReport
{
// RTCP Packet. Sender Report and Receiver Report.
// clang-format off
uint8_t
buffer
[]
=
{
0x81
,
0xc8
,
0x00
,
0x0c
,
// Type: 200 (Sender Report), Count: 1, Length: 12
...
...
@@ -26,6 +27,7 @@ namespace TestSenderReport
0x00
,
0x00
,
0x00
,
0x00
,
// Last SR: 0
0x00
,
0x00
,
0x00
,
0x05
// DLSR: 0
};
// clang-format on
// Sender Report buffer start point.
uint8_t
*
srBuffer
=
buffer
+
sizeof
(
Packet
::
CommonHeader
);
...
...
@@ -63,7 +65,7 @@ SCENARIO("RTCP SR parsing", "[parser][rtcp][sr]")
SECTION
(
"serialize SenderReport instance"
)
{
uint8_t
serialized
[
sizeof
(
SenderReport
::
Header
)]
=
{
0
};
uint8_t
serialized
[
sizeof
(
SenderReport
::
Header
)]
=
{
0
};
report
->
Serialize
(
serialized
);
...
...
@@ -105,8 +107,8 @@ SCENARIO("RTCP SR parsing", "[parser][rtcp][sr]")
REQUIRE
(
packet
);
REQUIRE
(
packet
->
GetType
()
==
Type
::
SR
);
auto
sr
=
dynamic_cast
<
SenderReportPacket
*>
(
packet
);
auto
it
=
sr
->
Begin
();
auto
sr
=
dynamic_cast
<
SenderReportPacket
*>
(
packet
);
auto
it
=
sr
->
Begin
();
auto
report
=
*
it
;
verifySenderReport
(
report
);
...
...
worker/test/RTC/TestNackGenerator.cpp
浏览文件 @
21ceb014
...
...
@@ -96,16 +96,18 @@ public:
private
:
TestNackGeneratorInput
currentInput
{};
bool
nackRequiredTriggered
=
false
;
bool
nackRequiredTriggered
=
false
;
bool
keyFrameRequiredTriggered
=
false
;
};
// clang-format off
uint8_t
rtpBuffer
[]
=
{
0
b10000000
,
0
b01111011
,
0
b01010010
,
0
b00001110
,
0
b01011011
,
0
b01101011
,
0
b11001010
,
0
b10110101
,
0
,
0
,
0
,
2
};
// clang-format on
// [pt:123, seq:21006, timestamp:1533790901]
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
rtpBuffer
,
sizeof
(
rtpBuffer
));
...
...
@@ -133,6 +135,7 @@ SCENARIO("NACK generator", "[rtp][rtcp]")
{
SECTION
(
"no NACKs required"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
2371
,
false
,
0
,
0
,
false
,
0
},
...
...
@@ -148,47 +151,55 @@ SCENARIO("NACK generator", "[rtp][rtcp]")
{
2254
,
false
,
0
,
0
,
false
,
0
},
{
2250
,
false
,
0
,
0
,
false
,
0
},
};
// clang-format on
validate
(
inputs
);
}
SECTION
(
"generate NACK for missing ordered packet"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
2381
,
false
,
0
,
0
,
false
,
0
},
{
2383
,
false
,
2382
,
1
,
false
,
1
}
};
// clang-format on
validate
(
inputs
);
}
SECTION
(
"sequence wrap generates no NACK"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
65534
,
false
,
0
,
0
,
false
,
0
},
{
65535
,
false
,
0
,
0
,
false
,
0
},
{
0
,
false
,
0
,
0
,
false
,
0
}
};
// clang-format on
validate
(
inputs
);
}
SECTION
(
"generate NACK after sequence wrap"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
65534
,
false
,
0
,
0
,
false
,
0
},
{
65535
,
false
,
0
,
0
,
false
,
0
},
{
1
,
false
,
0
,
1
,
false
,
1
}
};
// clang-format on
validate
(
inputs
);
}
SECTION
(
"generate NACK after sequence wrap, and yet another NACK"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
65534
,
false
,
0
,
0
,
false
,
0
},
...
...
@@ -198,12 +209,14 @@ SCENARIO("NACK generator", "[rtp][rtcp]")
{
12
,
true
,
0
,
0
,
false
,
10
},
{
13
,
true
,
0
,
0
,
false
,
0
}
};
// clang-format on
validate
(
inputs
);
}
SECTION
(
"intercalated missing packets"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
1
,
false
,
0
,
0
,
false
,
0
},
...
...
@@ -212,12 +225,14 @@ SCENARIO("NACK generator", "[rtp][rtcp]")
{
7
,
false
,
6
,
1
,
false
,
3
},
{
9
,
false
,
8
,
1
,
false
,
4
}
};
// clang-format on
validate
(
inputs
);
}
SECTION
(
"non contiguous intercalated missing packets"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
1
,
false
,
0
,
0
,
false
,
0
},
...
...
@@ -225,12 +240,14 @@ SCENARIO("NACK generator", "[rtp][rtcp]")
{
7
,
false
,
4
,
3
,
false
,
4
},
{
9
,
false
,
8
,
1
,
false
,
5
}
};
// clang-format on
validate
(
inputs
);
}
SECTION
(
"big jump"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
1
,
false
,
0
,
0
,
false
,
0
},
...
...
@@ -239,17 +256,20 @@ SCENARIO("NACK generator", "[rtp][rtcp]")
{
4
,
false
,
0
,
0
,
false
,
296
},
{
5
,
false
,
0
,
0
,
false
,
295
}
};
// clang-format on
validate
(
inputs
);
}
SECTION
(
"Key Frame required. Nack list too large to be requested"
)
{
// clang-format off
std
::
vector
<
TestNackGeneratorInput
>
inputs
=
{
{
1
,
false
,
0
,
0
,
false
,
0
},
{
3000
,
false
,
0
,
0
,
true
,
0
}
};
// clang-format on
validate
(
inputs
);
}
...
...
worker/test/RTC/TestRtpDataCounter.cpp
浏览文件 @
21ceb014
...
...
@@ -31,10 +31,13 @@ SCENARIO("Bitrate calculator", "[rtp][bitrate]")
SECTION
(
"receive single item per 1000 ms"
)
{
RateCalculator
rate
;
// clang-format off
std
::
vector
<
data
>
input
=
{
{
0
,
5
,
40
}
};
// clang-format on
validate
(
rate
,
now
,
input
);
}
...
...
@@ -42,6 +45,8 @@ SCENARIO("Bitrate calculator", "[rtp][bitrate]")
SECTION
(
"receive multiple items per 1000 ms"
)
{
RateCalculator
rate
;
// clang-format off
std
::
vector
<
data
>
input
=
{
{
0
,
5
,
40
},
...
...
@@ -49,6 +54,7 @@ SCENARIO("Bitrate calculator", "[rtp][bitrate]")
{
300
,
2
,
72
},
{
999
,
4
,
104
}
};
// clang-format on
validate
(
rate
,
now
,
input
);
}
...
...
@@ -56,6 +62,8 @@ SCENARIO("Bitrate calculator", "[rtp][bitrate]")
SECTION
(
"slide"
)
{
RateCalculator
rate
;
// clang-format off
std
::
vector
<
data
>
input
=
{
{
0
,
5
,
40
},
...
...
@@ -64,6 +72,7 @@ SCENARIO("Bitrate calculator", "[rtp][bitrate]")
{
1001
,
1
,
32
},
{
2000
,
1
,
24
}
};
// clang-format on
validate
(
rate
,
now
,
input
);
...
...
worker/test/RTC/TestRtpPacket.cpp
浏览文件 @
21ceb014
...
...
@@ -190,12 +190,15 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
SECTION
(
"create RtpPacket without extension header"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0
b10000000
,
0
b00000001
,
0
,
8
,
0
,
0
,
0
,
4
,
0
,
0
,
0
,
5
};
// clang-format on
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
...
...
@@ -215,6 +218,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
SECTION
(
"create RtpPacket with One-Byte extension header"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0
b10010000
,
0
b00000001
,
0
,
8
,
...
...
@@ -225,6 +229,8 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
0xFF
,
0
,
0
,
0
b00110011
,
0xFF
,
0xFF
,
0xFF
,
0xFF
};
// clang-format on
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
...
...
@@ -246,6 +252,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
SECTION
(
"create RtpPacket with Two-Bytes extension header"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0
b10010000
,
0
b00000001
,
0
,
8
,
...
...
@@ -256,6 +263,8 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
0xFF
,
0
,
3
,
4
,
0xFF
,
0xFF
,
0xFF
,
0xFF
};
// clang-format on
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
...
...
@@ -276,6 +285,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
SECTION
(
"rtx encryption-decryption"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0
b10010000
,
0
b00000001
,
0
,
8
,
...
...
@@ -287,6 +297,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0x11
,
0x11
,
0x11
,
0x11
// Payload
};
// clang-format on
uint8_t
rtxPayloadType
=
102
;
uint32_t
rtxSsrc
=
6
;
...
...
@@ -405,6 +416,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
SECTION
(
"create RtpPacket and apply payload shift to it"
)
{
// clang-format off
uint8_t
buffer
[]
=
{
0
b10110000
,
0
b00000001
,
0
,
8
,
...
...
@@ -422,6 +434,8 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
// clang-format on
size_t
len
=
40
;
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
...
...
worker/test/RTC/TestRtpStreamRecv.cpp
浏览文件 @
21ceb014
...
...
@@ -48,12 +48,15 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
std
::
vector
<
uint16_t
>
seqNumbers
;
};
// clang-format off
uint8_t
buffer
[]
=
{
0
b10000000
,
0
b00000001
,
0
,
1
,
0
,
0
,
0
,
4
,
0
,
0
,
0
,
5
};
// clang-format on
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
...
...
worker/test/RTC/TestRtpStreamSend.cpp
浏览文件 @
21ceb014
...
...
@@ -13,21 +13,24 @@ static std::vector<RtpPacket*> rtpRetransmissionContainer(18);
class
RtpStreamSendListener
:
public
RtpStreamSend
::
Listener
{
public
:
void
OnRtpStreamHealthy
(
RTC
::
RtpStream
*
/*rtpStream*/
)
{};
void
OnRtpStreamUnhealthy
(
RTC
::
RtpStream
*
/*rtpStream*/
)
{};
public
:
void
OnRtpStreamHealthy
(
RTC
::
RtpStream
*
/*rtpStream*/
)
{};
void
OnRtpStreamUnhealthy
(
RTC
::
RtpStream
*
/*rtpStream*/
)
{};
}
rtpStreamSendListener
;
SCENARIO
(
"NACK and RTP packets retransmission"
,
"[rtp][rtcp]"
)
{
SECTION
(
"receive NACK and get retransmitted packets"
)
{
// clang-format off
uint8_t
rtpBuffer1
[]
=
{
0
b10000000
,
0
b01111011
,
0
b01010010
,
0
b00001110
,
0
b01011011
,
0
b01101011
,
0
b11001010
,
0
b10110101
,
0
,
0
,
0
,
2
};
// clang-format on
uint8_t
rtpBuffer2
[
65536
];
uint8_t
rtpBuffer3
[
65536
];
uint8_t
rtpBuffer4
[
65536
];
...
...
worker/test/RTC/TestSeqManager.cpp
浏览文件 @
21ceb014
...
...
@@ -48,6 +48,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"receive ordered numbers, no sync, no drop"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
0
,
0
,
false
,
false
},
...
...
@@ -63,6 +64,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
10
,
10
,
false
,
false
},
{
11
,
11
,
false
,
false
}
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
@@ -70,6 +72,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"receive ordered numbers, sync, no drop"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
0
,
0
,
false
,
false
},
...
...
@@ -81,6 +84,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
83
,
6
,
false
,
false
},
{
84
,
7
,
false
,
false
}
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
@@ -88,6 +92,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"receive ordered numbers, sync, drop"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
0
,
0
,
false
,
false
},
...
...
@@ -104,6 +109,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
10
,
9
,
false
,
false
},
{
12
,
10
,
false
,
false
},
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
@@ -111,6 +117,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"receive ordered wrapped numbers"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
65533
,
65533
,
false
,
false
},
...
...
@@ -119,6 +126,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
0
,
0
,
false
,
false
},
{
1
,
1
,
false
,
false
}
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
@@ -126,6 +134,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"receive sequence numbers with a big jump"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
0
,
0
,
false
,
false
},
...
...
@@ -133,6 +142,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
1000
,
1000
,
false
,
false
},
{
1001
,
1001
,
false
,
false
}
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
@@ -140,6 +150,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"receive mixed numbers with a big jump, drop before jump"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
0
,
0
,
false
,
false
},
...
...
@@ -149,6 +160,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
103
,
0
,
false
,
true
},
// drop.
{
101
,
100
,
false
,
false
}
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
@@ -156,6 +168,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"receive mixed numbers with a big jump, drop after jump"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
0
,
0
,
false
,
false
},
...
...
@@ -164,6 +177,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
103
,
0
,
false
,
true
},
// drop.
{
101
,
100
,
false
,
false
}
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
@@ -171,6 +185,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"drop, receive numbers newer and older than the one dropped"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
0
,
0
,
false
,
false
},
...
...
@@ -179,6 +194,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
4
,
3
,
false
,
false
},
{
1
,
1
,
false
,
false
}
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
@@ -186,6 +202,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
SECTION
(
"receive mixed numbers, sync, drop"
)
{
// clang-format off
std
::
vector
<
TestSeqManagerInput
>
inputs
=
{
{
0
,
0
,
false
,
false
},
...
...
@@ -235,6 +252,7 @@ SCENARIO("RTC::SeqManager", "[rtc]")
{
6
,
46
,
false
,
false
},
{
7
,
47
,
false
,
false
}
};
// clang-format on
RTC
::
SeqManager
<
uint16_t
>
seqManager
;
validate
(
seqManager
,
inputs
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论