Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
e176a2b3
提交
e176a2b3
authored
10月 01, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tests: gulp format
上级
0b447b04
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
133 行增加
和
112 行删除
+133
-112
test-bitrate.cpp
worker/test/test-bitrate.cpp
+2
-2
test-nack-generator.cpp
worker/test/test-nack-generator.cpp
+38
-18
test-nack.cpp
worker/test/test-nack.cpp
+5
-5
test-rtcp.cpp
worker/test/test-rtcp.cpp
+61
-62
test-rtp.cpp
worker/test/test-rtp.cpp
+8
-7
test-rtpstreamrecv.cpp
worker/test/test-rtpstreamrecv.cpp
+9
-9
test-seqmanager.cpp
worker/test/test-seqmanager.cpp
+6
-5
tests.cpp
worker/test/tests.cpp
+4
-4
没有找到文件。
worker/test/test-bitrate.cpp
浏览文件 @
e176a2b3
#include "include/catch.hpp"
#include "common.hpp"
#include "common.hpp"
#include "DepLibUV.hpp"
#include "DepLibUV.hpp"
#include "include/catch.hpp"
#include "RTC/RtpDataCounter.hpp"
#include "RTC/RtpDataCounter.hpp"
#include <vector>
#include <vector>
...
@@ -13,7 +13,7 @@ struct data
...
@@ -13,7 +13,7 @@ struct data
uint32_t
rate
;
uint32_t
rate
;
};
};
void
validate
(
RateCalculator
&
rate
,
uint64_t
timeBase
,
std
::
vector
<
data
>&
input
)
void
validate
(
RateCalculator
&
rate
,
uint64_t
timeBase
,
std
::
vector
<
data
>&
input
)
{
{
for
(
auto
it
=
input
.
begin
();
it
!=
input
.
end
();
++
it
)
for
(
auto
it
=
input
.
begin
();
it
!=
input
.
end
();
++
it
)
{
{
...
...
worker/test/test-nack-generator.cpp
浏览文件 @
e176a2b3
#include "include/catch.hpp"
#include "common.hpp"
#include "common.hpp"
#include "
RTC/NackGenerator
.hpp"
#include "
include/catch
.hpp"
#include "RTC/Codecs/PayloadDescriptorHandler.hpp"
#include "RTC/Codecs/PayloadDescriptorHandler.hpp"
#include "RTC/NackGenerator.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpPacket.hpp"
#include <vector>
#include <vector>
...
@@ -10,9 +10,17 @@ using namespace RTC;
...
@@ -10,9 +10,17 @@ using namespace RTC;
struct
TestNackGeneratorInput
struct
TestNackGeneratorInput
{
{
TestNackGeneratorInput
()
=
default
;
TestNackGeneratorInput
()
=
default
;
TestNackGeneratorInput
(
uint16_t
seq
,
bool
isKeyFrame
,
uint16_t
firstNacked
,
size_t
numNacked
,
bool
keyFrameRequired
=
false
,
size_t
nackListSize
=
0
)
TestNackGeneratorInput
(
:
seq
(
seq
),
isKeyFrame
(
isKeyFrame
),
firstNacked
(
firstNacked
),
numNacked
(
numNacked
),
keyFrameRequired
(
keyFrameRequired
),
nackListSize
(
nackListSize
)
uint16_t
seq
,
{}
bool
isKeyFrame
,
uint16_t
firstNacked
,
size_t
numNacked
,
bool
keyFrameRequired
=
false
,
size_t
nackListSize
=
0
)
:
seq
(
seq
),
isKeyFrame
(
isKeyFrame
),
firstNacked
(
firstNacked
),
numNacked
(
numNacked
),
keyFrameRequired
(
keyFrameRequired
),
nackListSize
(
nackListSize
)
{
}
uint16_t
seq
{
0
};
uint16_t
seq
{
0
};
bool
isKeyFrame
{
false
};
bool
isKeyFrame
{
false
};
...
@@ -24,16 +32,28 @@ struct TestNackGeneratorInput
...
@@ -24,16 +32,28 @@ struct TestNackGeneratorInput
class
TestPayloadDescriptorHandler
:
public
RTC
::
Codecs
::
PayloadDescriptorHandler
class
TestPayloadDescriptorHandler
:
public
RTC
::
Codecs
::
PayloadDescriptorHandler
{
{
public
:
public
:
TestPayloadDescriptorHandler
(
bool
isKeyFrame
)
:
isKeyFrame
(
isKeyFrame
)
{};
TestPayloadDescriptorHandler
(
bool
isKeyFrame
)
:
isKeyFrame
(
isKeyFrame
){};
~
TestPayloadDescriptorHandler
()
=
default
;
~
TestPayloadDescriptorHandler
()
=
default
;
void
Dump
()
const
{
return
;
};
void
Dump
()
const
void
Encode
(
RTC
::
Codecs
::
EncodingContext
*
/*context*/
,
uint8_t
*
/*data*/
)
{
return
;
};
{
void
Restore
(
uint8_t
*
/*data*/
)
{
return
;
};
return
;
bool
IsKeyFrame
()
const
{
return
this
->
isKeyFrame
;
};
};
void
Encode
(
RTC
::
Codecs
::
EncodingContext
*
/*context*/
,
uint8_t
*
/*data*/
)
private
:
{
bool
isKeyFrame
{
false
};
return
;
};
void
Restore
(
uint8_t
*
/*data*/
)
{
return
;
};
bool
IsKeyFrame
()
const
{
return
this
->
isKeyFrame
;
};
private
:
bool
isKeyFrame
{
false
};
};
};
class
TestNackGeneratorListener
:
public
NackGenerator
::
Listener
class
TestNackGeneratorListener
:
public
NackGenerator
::
Listener
...
@@ -42,7 +62,7 @@ class TestNackGeneratorListener : public NackGenerator::Listener
...
@@ -42,7 +62,7 @@ class TestNackGeneratorListener : public NackGenerator::Listener
{
{
this
->
nackRequiredTriggered
=
true
;
this
->
nackRequiredTriggered
=
true
;
auto
it
=
seqNumbers
.
begin
();
auto
it
=
seqNumbers
.
begin
();
auto
firstNacked
=
*
it
;
auto
firstNacked
=
*
it
;
auto
numNacked
=
seqNumbers
.
size
();
auto
numNacked
=
seqNumbers
.
size
();
...
@@ -61,8 +81,8 @@ class TestNackGeneratorListener : public NackGenerator::Listener
...
@@ -61,8 +81,8 @@ class TestNackGeneratorListener : public NackGenerator::Listener
public
:
public
:
void
Reset
(
TestNackGeneratorInput
input
)
void
Reset
(
TestNackGeneratorInput
input
)
{
{
this
->
currentInput
=
input
;
this
->
currentInput
=
input
;
this
->
nackRequiredTriggered
=
false
;
this
->
nackRequiredTriggered
=
false
;
this
->
keyFrameRequiredTriggered
=
false
;
this
->
keyFrameRequiredTriggered
=
false
;
}
}
...
...
worker/test/test-nack.cpp
浏览文件 @
e176a2b3
#include "include/catch.hpp"
#include "common.hpp"
#include "common.hpp"
#include "
RTC/RtpPacket
.hpp"
#include "
include/catch
.hpp"
#include "RTC/RTCP/FeedbackRtpNack.hpp"
#include "RTC/RTCP/FeedbackRtpNack.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpStream.hpp"
#include "RTC/RtpStream.hpp"
#include "RTC/RtpStreamSend.hpp"
#include "RTC/RtpStreamSend.hpp"
#include <vector>
#include <vector>
...
@@ -79,9 +79,9 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp]")
...
@@ -79,9 +79,9 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp]")
RtpStream
::
Params
params
;
RtpStream
::
Params
params
;
params
.
ssrc
=
packet1
->
GetSsrc
();
params
.
ssrc
=
packet1
->
GetSsrc
();
params
.
clockRate
=
90000
;
params
.
clockRate
=
90000
;
params
.
useNack
=
true
;
params
.
useNack
=
true
;
// Create a RtpStreamSend.
// Create a RtpStreamSend.
RtpStreamSend
*
stream
=
new
RtpStreamSend
(
&
rtpStreamSendListener
,
params
,
200
);
RtpStreamSend
*
stream
=
new
RtpStreamSend
(
&
rtpStreamSendListener
,
params
,
200
);
...
@@ -100,7 +100,7 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp]")
...
@@ -100,7 +100,7 @@ SCENARIO("NACK and RTP packets retransmission", "[rtp][rtcp]")
REQUIRE
(
nackItem
.
GetLostPacketBitmask
()
==
0
b0000000000001111
);
REQUIRE
(
nackItem
.
GetLostPacketBitmask
()
==
0
b0000000000001111
);
stream
->
RequestRtpRetransmission
(
stream
->
RequestRtpRetransmission
(
nackItem
.
GetPacketId
(),
nackItem
.
GetLostPacketBitmask
(),
rtpRetransmissionContainer
);
nackItem
.
GetPacketId
(),
nackItem
.
GetLostPacketBitmask
(),
rtpRetransmissionContainer
);
auto
rtxPacket1
=
rtpRetransmissionContainer
[
0
];
auto
rtxPacket1
=
rtpRetransmissionContainer
[
0
];
auto
rtxPacket2
=
rtpRetransmissionContainer
[
1
];
auto
rtxPacket2
=
rtpRetransmissionContainer
[
1
];
...
...
worker/test/test-rtcp.cpp
浏览文件 @
e176a2b3
#include "common.hpp"
#include "include/catch.hpp"
#include "include/catch.hpp"
#include "include/helpers.hpp"
#include "include/helpers.hpp"
#include "common.hpp"
#include "RTC/RTCP/Packet.hpp"
#include "RTC/RTCP/Sdes.hpp"
#include "RTC/RTCP/SenderReport.hpp"
#include "RTC/RTCP/ReceiverReport.hpp"
#include "RTC/RTCP/Bye.hpp"
#include "RTC/RTCP/Bye.hpp"
#include "RTC/RTCP/FeedbackRtpNack.hpp"
#include "RTC/RTCP/FeedbackPsAfb.hpp"
#include "RTC/RTCP/FeedbackRtpTmmb.hpp"
#include "RTC/RTCP/FeedbackRtpTllei.hpp"
#include "RTC/RTCP/FeedbackRtpEcn.hpp"
#include "RTC/RTCP/FeedbackPsSli.hpp"
#include "RTC/RTCP/FeedbackPsRpsi.hpp"
#include "RTC/RTCP/FeedbackPsFir.hpp"
#include "RTC/RTCP/FeedbackPsFir.hpp"
#include "RTC/RTCP/FeedbackPsTst.hpp"
#include "RTC/RTCP/FeedbackPsVbcm.hpp"
#include "RTC/RTCP/FeedbackPsLei.hpp"
#include "RTC/RTCP/FeedbackPsLei.hpp"
#include "RTC/RTCP/FeedbackPsAfb.hpp"
#include "RTC/RTCP/FeedbackPsRemb.hpp"
#include "RTC/RTCP/FeedbackPsRemb.hpp"
#include "RTC/RTCP/FeedbackPsRpsi.hpp"
#include "RTC/RTCP/FeedbackPsSli.hpp"
#include "RTC/RTCP/FeedbackPsTst.hpp"
#include "RTC/RTCP/FeedbackPsVbcm.hpp"
#include "RTC/RTCP/FeedbackRtpEcn.hpp"
#include "RTC/RTCP/FeedbackRtpNack.hpp"
#include "RTC/RTCP/FeedbackRtpTllei.hpp"
#include "RTC/RTCP/FeedbackRtpTmmb.hpp"
#include "RTC/RTCP/Packet.hpp"
#include "RTC/RTCP/ReceiverReport.hpp"
#include "RTC/RTCP/Sdes.hpp"
#include "RTC/RTCP/SenderReport.hpp"
#include <string>
#include <string>
using
namespace
RTC
::
RTCP
;
using
namespace
RTC
::
RTCP
;
...
@@ -107,11 +107,11 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -107,11 +107,11 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
0x6e
,
0x6e
,
0x65
,
0x6c
0x6e
,
0x6e
,
0x65
,
0x6c
};
};
uint32_t
ssrc
=
0
;
uint32_t
ssrc
=
0
;
SdesItem
::
Type
type
=
SdesItem
::
Type
::
CNAME
;
SdesItem
::
Type
type
=
SdesItem
::
Type
::
CNAME
;
std
::
string
value
=
"outChannel"
;
std
::
string
value
=
"outChannel"
;
size_t
len
=
value
.
size
();
size_t
len
=
value
.
size
();
SdesChunk
*
chunk
=
SdesChunk
::
Parse
(
buffer
,
sizeof
(
buffer
));
SdesChunk
*
chunk
=
SdesChunk
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
chunk
->
GetSsrc
()
==
ssrc
);
REQUIRE
(
chunk
->
GetSsrc
()
==
ssrc
);
...
@@ -126,10 +126,10 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -126,10 +126,10 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
SECTION
(
"create SdesChunk"
)
SECTION
(
"create SdesChunk"
)
{
{
uint32_t
ssrc
=
0
;
uint32_t
ssrc
=
0
;
SdesItem
::
Type
type
=
SdesItem
::
Type
::
CNAME
;
SdesItem
::
Type
type
=
SdesItem
::
Type
::
CNAME
;
std
::
string
value
=
"outChannel"
;
std
::
string
value
=
"outChannel"
;
size_t
len
=
value
.
size
();
size_t
len
=
value
.
size
();
// Create sdes item.
// Create sdes item.
SdesItem
*
item
=
new
SdesItem
(
type
,
len
,
value
.
c_str
());
SdesItem
*
item
=
new
SdesItem
(
type
,
len
,
value
.
c_str
());
...
@@ -161,12 +161,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -161,12 +161,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
0x00
,
0x00
,
0x04
,
0xD2
,
// octet count
0x00
,
0x00
,
0x04
,
0xD2
,
// octet count
};
};
uint32_t
ssrc
=
1234
;
uint32_t
ssrc
=
1234
;
uint32_t
ntpSec
=
1234
;
uint32_t
ntpSec
=
1234
;
uint32_t
ntpFrac
=
1234
;
uint32_t
ntpFrac
=
1234
;
uint32_t
rtpTs
=
1234
;
uint32_t
rtpTs
=
1234
;
uint32_t
packetCount
=
1234
;
uint32_t
packetCount
=
1234
;
uint32_t
octetCount
=
1234
;
uint32_t
octetCount
=
1234
;
SenderReport
*
report
=
SenderReport
::
Parse
(
buffer
,
sizeof
(
SenderReport
::
Header
));
SenderReport
*
report
=
SenderReport
::
Parse
(
buffer
,
sizeof
(
SenderReport
::
Header
));
REQUIRE
(
report
);
REQUIRE
(
report
);
...
@@ -183,12 +183,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -183,12 +183,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
SECTION
(
"create SenderReport"
)
SECTION
(
"create SenderReport"
)
{
{
uint32_t
ssrc
=
1234
;
uint32_t
ssrc
=
1234
;
uint32_t
ntpSec
=
1234
;
uint32_t
ntpSec
=
1234
;
uint32_t
ntpFrac
=
1234
;
uint32_t
ntpFrac
=
1234
;
uint32_t
rtpTs
=
1234
;
uint32_t
rtpTs
=
1234
;
uint32_t
packetCount
=
1234
;
uint32_t
packetCount
=
1234
;
uint32_t
octetCount
=
1234
;
uint32_t
octetCount
=
1234
;
// Create local report and check content.
// Create local report and check content.
// SenderReport();
// SenderReport();
SenderReport
report1
;
SenderReport
report1
;
...
@@ -232,12 +232,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -232,12 +232,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
0x00
,
0x00
,
0x04
,
0xD2
// dlsr
0x00
,
0x00
,
0x04
,
0xD2
// dlsr
};
};
uint32_t
ssrc
=
1234
;
uint32_t
ssrc
=
1234
;
uint8_t
fractionLost
=
1
;
uint8_t
fractionLost
=
1
;
int32_t
totalLost
=
4
;
int32_t
totalLost
=
4
;
uint32_t
lastSeq
=
1234
;
uint32_t
lastSeq
=
1234
;
uint32_t
jitter
=
1234
;
uint32_t
jitter
=
1234
;
uint32_t
lastSenderReport
=
1234
;
uint32_t
lastSenderReport
=
1234
;
uint32_t
delaySinceLastSenderReport
=
1234
;
uint32_t
delaySinceLastSenderReport
=
1234
;
ReceiverReport
*
report
=
ReceiverReport
::
Parse
(
buffer
,
sizeof
(
ReceiverReport
::
Header
));
ReceiverReport
*
report
=
ReceiverReport
::
Parse
(
buffer
,
sizeof
(
ReceiverReport
::
Header
));
...
@@ -253,12 +253,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -253,12 +253,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
SECTION
(
"create ReceiverReport"
)
SECTION
(
"create ReceiverReport"
)
{
{
uint32_t
ssrc
=
1234
;
uint32_t
ssrc
=
1234
;
uint8_t
fractionLost
=
1
;
uint8_t
fractionLost
=
1
;
int32_t
totalLost
=
4
;
int32_t
totalLost
=
4
;
uint32_t
lastSeq
=
1234
;
uint32_t
lastSeq
=
1234
;
uint32_t
jitter
=
1234
;
uint32_t
jitter
=
1234
;
uint32_t
lastSenderReport
=
1234
;
uint32_t
lastSenderReport
=
1234
;
uint32_t
delaySinceLastSenderReport
=
1234
;
uint32_t
delaySinceLastSenderReport
=
1234
;
// Create local report and check content.
// Create local report and check content.
// ReceiverReport();
// ReceiverReport();
...
@@ -313,12 +313,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -313,12 +313,12 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
0x00
,
0x00
,
0x00
,
0x05
// DLSR: 0
0x00
,
0x00
,
0x00
,
0x05
// DLSR: 0
};
};
uint32_t
ssrc
=
0x5d931534
;
uint32_t
ssrc
=
0x5d931534
;
uint32_t
ntpSec
=
3711615412
;
uint32_t
ntpSec
=
3711615412
;
uint32_t
ntpFrac
=
1985245553
;
uint32_t
ntpFrac
=
1985245553
;
uint32_t
rtpTs
=
577280
;
uint32_t
rtpTs
=
577280
;
uint32_t
packetCount
=
3608
;
uint32_t
packetCount
=
3608
;
uint32_t
octetCount
=
577280
;
uint32_t
octetCount
=
577280
;
auto
packet
=
Packet
::
Parse
(
buffer
,
sizeof
(
buffer
));
auto
packet
=
Packet
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
@@ -326,7 +326,7 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -326,7 +326,7 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
auto
sr
=
dynamic_cast
<
SenderReportPacket
*>
(
packet
);
auto
sr
=
dynamic_cast
<
SenderReportPacket
*>
(
packet
);
auto
sIt
=
sr
->
Begin
();
auto
sIt
=
sr
->
Begin
();
auto
sReport
=
*
sIt
;
auto
sReport
=
*
sIt
;
REQUIRE
(
sReport
->
GetSsrc
()
==
ssrc
);
REQUIRE
(
sReport
->
GetSsrc
()
==
ssrc
);
...
@@ -338,17 +338,16 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -338,17 +338,16 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
REQUIRE
(
packet
->
GetNext
());
REQUIRE
(
packet
->
GetNext
());
auto
rr
=
dynamic_cast
<
ReceiverReportPacket
*>
(
packet
->
GetNext
());
auto
rr
=
dynamic_cast
<
ReceiverReportPacket
*>
(
packet
->
GetNext
());
auto
rIt
=
rr
->
Begin
();
auto
rIt
=
rr
->
Begin
();
auto
rReport
=
*
rIt
;
auto
rReport
=
*
rIt
;
ssrc
=
0x01932db4
;
ssrc
=
0x01932db4
;
auto
fractionLost
=
0
;
auto
fractionLost
=
0
;
auto
totalLost
=
1
;
auto
totalLost
=
1
;
auto
lastSeq
=
0
;
auto
lastSeq
=
0
;
auto
jitter
=
0
;
auto
jitter
=
0
;
auto
lastSenderReport
=
0
;
auto
lastSenderReport
=
0
;
auto
delaySinceLastSenderReport
=
5
;
auto
delaySinceLastSenderReport
=
5
;
REQUIRE
(
rReport
);
REQUIRE
(
rReport
);
...
@@ -405,7 +404,7 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -405,7 +404,7 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
};
};
uint16_t
packetId
=
2500
;
uint16_t
packetId
=
2500
;
uint16_t
lostPacketBitmask
=
0
b1010101001010101
;
uint16_t
lostPacketBitmask
=
0
b1010101001010101
;
FeedbackRtpNackItem
*
item
=
FeedbackRtpNackItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
FeedbackRtpNackItem
*
item
=
FeedbackRtpNackItem
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
item
);
REQUIRE
(
item
);
REQUIRE
(
item
->
GetPacketId
()
==
packetId
);
REQUIRE
(
item
->
GetPacketId
()
==
packetId
);
...
@@ -416,7 +415,7 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -416,7 +415,7 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
SECTION
(
"create FeedbackRtpNackItem"
)
SECTION
(
"create FeedbackRtpNackItem"
)
{
{
uint16_t
packetId
=
1
;
uint16_t
packetId
=
1
;
uint16_t
lostPacketBitmask
=
0
b1010101001010101
;
uint16_t
lostPacketBitmask
=
0
b1010101001010101
;
// Create local NackItem and check content.
// Create local NackItem and check content.
// FeedbackRtpNackItem();
// FeedbackRtpNackItem();
...
@@ -447,8 +446,8 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
...
@@ -447,8 +446,8 @@ SCENARIO("parse RTCP packets", "[parser][rtcp]")
SECTION
(
"create FeedbackRtpTmmbrItem"
)
SECTION
(
"create FeedbackRtpTmmbrItem"
)
{
{
uint32_t
ssrc
=
1234
;
uint32_t
ssrc
=
1234
;
uint64_t
bitrate
=
3000000
;
// bits per second.
uint64_t
bitrate
=
3000000
;
// bits per second.
uint32_t
overhead
=
1
;
uint32_t
overhead
=
1
;
FeedbackRtpTmmbrItem
item
;
FeedbackRtpTmmbrItem
item
;
...
...
worker/test/test-rtp.cpp
浏览文件 @
e176a2b3
#include "common.hpp"
#include "include/catch.hpp"
#include "include/catch.hpp"
#include "include/helpers.hpp"
#include "include/helpers.hpp"
#include "common.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpDictionaries.hpp"
#include
<map>
#include
"RTC/RtpPacket.hpp"
#include <cstring> // std::memcmp()
#include <cstring> // std::memcmp()
#include <map>
using
namespace
RTC
;
using
namespace
RTC
;
...
@@ -182,7 +182,8 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
...
@@ -182,7 +182,8 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
REQUIRE
(
clonedPacket
->
ReadAbsSendTime
(
&
absSendTime
)
==
true
);
REQUIRE
(
clonedPacket
->
ReadAbsSendTime
(
&
absSendTime
)
==
true
);
REQUIRE
(
absSendTime
==
0x65341e
);
REQUIRE
(
absSendTime
==
0x65341e
);
REQUIRE
(
std
::
memcmp
(
clonedPacket
->
GetPayload
(),
packet
->
GetPayload
(),
packet
->
GetPayloadLength
())
==
0
);
REQUIRE
(
std
::
memcmp
(
clonedPacket
->
GetPayload
(),
packet
->
GetPayload
(),
packet
->
GetPayloadLength
())
==
0
);
delete
clonedPacket
;
delete
clonedPacket
;
}
}
...
@@ -288,8 +289,8 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
...
@@ -288,8 +289,8 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
};
};
uint8_t
rtxPayloadType
=
102
;
uint8_t
rtxPayloadType
=
102
;
uint32_t
rtxSsrc
=
6
;
uint32_t
rtxSsrc
=
6
;
uint16_t
rtxSeq
=
80
;
uint16_t
rtxSeq
=
80
;
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
...
@@ -421,7 +422,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
...
@@ -421,7 +422,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
0x00
,
0x00
,
0x00
,
0x00
};
};
size_t
len
=
40
;
size_t
len
=
40
;
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
if
(
!
packet
)
...
...
worker/test/test-rtpstreamrecv.cpp
浏览文件 @
e176a2b3
#include "common.hpp"
#include "include/catch.hpp"
#include "include/catch.hpp"
#include "include/helpers.hpp"
#include "include/helpers.hpp"
#include "common.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpStream.hpp"
#include "RTC/RtpStream.hpp"
#include "RTC/RtpStreamRecv.hpp"
#include "RTC/RtpStreamRecv.hpp"
...
@@ -10,8 +10,7 @@ using namespace RTC;
...
@@ -10,8 +10,7 @@ using namespace RTC;
SCENARIO
(
"receive RTP packets and trigger NACK"
,
"[rtp][rtpstream]"
)
SCENARIO
(
"receive RTP packets and trigger NACK"
,
"[rtp][rtpstream]"
)
{
{
class
RtpStreamRecvListener
:
class
RtpStreamRecvListener
:
public
RtpStreamRecv
::
Listener
public
RtpStreamRecv
::
Listener
{
{
public
:
public
:
virtual
void
OnRtpStreamDied
(
RTC
::
RtpStream
*
rtpStream
)
override
virtual
void
OnRtpStreamDied
(
RTC
::
RtpStream
*
rtpStream
)
override
...
@@ -26,14 +25,15 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
...
@@ -26,14 +25,15 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
{
{
}
}
virtual
void
OnRtpStreamRecvNackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
virtual
void
OnRtpStreamRecvNackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
{
{
INFO
(
"NACK required"
);
INFO
(
"NACK required"
);
REQUIRE
(
this
->
shouldTriggerNack
==
true
);
REQUIRE
(
this
->
shouldTriggerNack
==
true
);
this
->
shouldTriggerNack
=
false
;
this
->
shouldTriggerNack
=
false
;
this
->
seqNumbers
=
seqNumbers
;
this
->
seqNumbers
=
seqNumbers
;
}
}
virtual
void
OnRtpStreamRecvPliRequired
(
RtpStreamRecv
*
rtpStream
)
override
virtual
void
OnRtpStreamRecvPliRequired
(
RtpStreamRecv
*
rtpStream
)
override
...
@@ -47,7 +47,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
...
@@ -47,7 +47,7 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
}
}
public
:
public
:
bool
shouldTriggerNack
=
false
;
bool
shouldTriggerNack
=
false
;
bool
shouldTriggerKeyFrame
=
false
;
bool
shouldTriggerKeyFrame
=
false
;
std
::
vector
<
uint16_t
>
seqNumbers
;
std
::
vector
<
uint16_t
>
seqNumbers
;
};
};
...
@@ -65,10 +65,10 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
...
@@ -65,10 +65,10 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
RtpStream
::
Params
params
;
RtpStream
::
Params
params
;
params
.
ssrc
=
packet
->
GetSsrc
();
params
.
ssrc
=
packet
->
GetSsrc
();
params
.
clockRate
=
90000
;
params
.
clockRate
=
90000
;
params
.
useNack
=
true
;
params
.
useNack
=
true
;
params
.
usePli
=
true
;
params
.
usePli
=
true
;
SECTION
(
"NACK one packet"
)
SECTION
(
"NACK one packet"
)
{
{
...
...
worker/test/test-seqmanager.cpp
浏览文件 @
e176a2b3
#include "include/catch.hpp"
#include "common.hpp"
#include "common.hpp"
#include
<vector>
#include
"include/catch.hpp"
#include "RTC/SeqManager.hpp"
#include "RTC/SeqManager.hpp"
#include <vector>
using
namespace
RTC
;
using
namespace
RTC
;
struct
TestSeqManagerInput
struct
TestSeqManagerInput
{
{
TestSeqManagerInput
(
uint16_t
input
,
uint16_t
output
,
bool
sync
=
false
,
bool
drop
=
false
)
TestSeqManagerInput
(
uint16_t
input
,
uint16_t
output
,
bool
sync
=
false
,
bool
drop
=
false
)
:
input
(
input
),
output
(
output
),
sync
(
sync
),
drop
(
drop
)
:
input
(
input
),
output
(
output
),
sync
(
sync
),
drop
(
drop
)
{}
{
}
uint16_t
input
{
0
};
uint16_t
input
{
0
};
uint16_t
output
{
0
};
uint16_t
output
{
0
};
...
...
worker/test/tests.cpp
浏览文件 @
e176a2b3
#define CATCH_CONFIG_RUNNER
#define CATCH_CONFIG_RUNNER
#include "include/catch.hpp"
#include "Settings.hpp"
#include "LogLevel.hpp"
#include "Logger.hpp"
#include "DepLibUV.hpp"
#include "DepLibUV.hpp"
#include "DepOpenSSL.hpp"
#include "DepOpenSSL.hpp"
#include "LogLevel.hpp"
#include "Logger.hpp"
#include "Settings.hpp"
#include "Utils.hpp"
#include "Utils.hpp"
#include "include/catch.hpp"
#include <string>
#include <string>
static
void
init
();
static
void
init
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论