Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
262dba06
提交
262dba06
authored
11月 15, 2023
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
C++: add { } in all remaining if() conditions (test and include folders)
上级
0efec5f2
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
192 行增加
和
0 行删除
+192
-0
Logger.hpp
worker/include/Logger.hpp
+2
-0
FeedbackRtpTransport.hpp
worker/include/RTC/RTCP/FeedbackRtpTransport.hpp
+2
-0
ReceiverReport.hpp
worker/include/RTC/RTCP/ReceiverReport.hpp
+6
-0
Sdes.hpp
worker/include/RTC/RTCP/Sdes.hpp
+2
-0
SenderReport.hpp
worker/include/RTC/RTCP/SenderReport.hpp
+2
-0
XR.hpp
worker/include/RTC/RTCP/XR.hpp
+2
-0
RtpPacket.hpp
worker/include/RTC/RtpPacket.hpp
+44
-0
TransportTuple.hpp
worker/include/RTC/TransportTuple.hpp
+30
-0
helpers.hpp
worker/test/include/helpers.hpp
+34
-0
TestVP8.cpp
worker/test/src/RTC/Codecs/TestVP8.cpp
+2
-0
TestRtpPacket.cpp
worker/test/src/RTC/TestRtpPacket.cpp
+28
-0
TestRtpPacketH264Svc.cpp
worker/test/src/RTC/TestRtpPacketH264Svc.cpp
+33
-0
TestRtpStreamRecv.cpp
worker/test/src/RTC/TestRtpStreamRecv.cpp
+4
-0
TestSeqManager.cpp
worker/test/src/RTC/TestSeqManager.cpp
+1
-0
没有找到文件。
worker/include/Logger.hpp
浏览文件 @
262dba06
...
...
@@ -355,7 +355,9 @@ public:
bufferDataLen += loggerWritten; \
} \
if (bufferDataLen != 0) \
{ \
Logger::channel->SendLog(Logger::buffer, static_cast<uint32_t>(bufferDataLen)); \
} \
} \
while (false)
...
...
worker/include/RTC/RTCP/FeedbackRtpTransport.hpp
浏览文件 @
262dba06
...
...
@@ -293,7 +293,9 @@ namespace RTC
size_t
GetSize
()
const
override
{
if
(
this
->
size
)
{
return
this
->
size
;
}
// Fixed packet size.
size_t
size
=
FeedbackRtpPacket
::
GetSize
();
...
...
worker/include/RTC/RTCP/ReceiverReport.hpp
浏览文件 @
262dba06
...
...
@@ -71,11 +71,15 @@ namespace RTC
// Possitive value.
if
(((
value
>>
23
)
&
1
)
==
0
)
{
return
value
;
}
// Negative value.
if
(
value
!=
0x0800000
)
{
value
&=
~
(
1
<<
23
);
}
return
-
value
;
}
...
...
@@ -170,7 +174,9 @@ namespace RTC
auto
it
=
std
::
find
(
this
->
reports
.
begin
(),
this
->
reports
.
end
(),
report
);
if
(
it
!=
this
->
reports
.
end
())
{
this
->
reports
.
erase
(
it
);
}
}
Iterator
Begin
()
{
...
...
worker/include/RTC/RTCP/Sdes.hpp
浏览文件 @
262dba06
...
...
@@ -188,7 +188,9 @@ namespace RTC
auto
it
=
std
::
find
(
this
->
chunks
.
begin
(),
this
->
chunks
.
end
(),
chunk
);
if
(
it
!=
this
->
chunks
.
end
())
{
this
->
chunks
.
erase
(
it
);
}
}
Iterator
Begin
()
{
...
...
worker/include/RTC/RTCP/SenderReport.hpp
浏览文件 @
262dba06
...
...
@@ -133,7 +133,9 @@ namespace RTC
auto
it
=
std
::
find
(
this
->
reports
.
begin
(),
this
->
reports
.
end
(),
report
);
if
(
it
!=
this
->
reports
.
end
())
{
this
->
reports
.
erase
(
it
);
}
}
Iterator
Begin
()
{
...
...
worker/include/RTC/RTCP/XR.hpp
浏览文件 @
262dba06
...
...
@@ -107,7 +107,9 @@ namespace RTC
auto
it
=
std
::
find
(
this
->
reports
.
begin
(),
this
->
reports
.
end
(),
report
);
if
(
it
!=
this
->
reports
.
end
())
{
this
->
reports
.
erase
(
it
);
}
}
uint32_t
GetSsrc
()
const
{
...
...
worker/include/RTC/RtpPacket.hpp
浏览文件 @
262dba06
...
...
@@ -224,7 +224,9 @@ namespace RTC
uint16_t
GetHeaderExtensionId
()
const
{
if
(
!
this
->
headerExtension
)
{
return
0u
;
}
return
uint16_t
{
ntohs
(
this
->
headerExtension
->
id
)
};
}
...
...
@@ -232,7 +234,9 @@ namespace RTC
size_t
GetHeaderExtensionLength
()
const
{
if
(
!
this
->
headerExtension
)
{
return
0u
;
}
return
static_cast
<
size_t
>
(
ntohs
(
this
->
headerExtension
->
length
)
*
4
);
}
...
...
@@ -240,7 +244,9 @@ namespace RTC
uint8_t
*
GetHeaderExtensionValue
()
const
{
if
(
!
this
->
headerExtension
)
{
return
nullptr
;
}
return
this
->
headerExtension
->
value
;
}
...
...
@@ -307,7 +313,9 @@ namespace RTC
uint8_t
*
extenValue
=
GetExtension
(
this
->
midExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
==
0u
)
{
return
false
;
}
mid
.
assign
(
reinterpret_cast
<
const
char
*>
(
extenValue
),
static_cast
<
size_t
>
(
extenLen
));
...
...
@@ -347,7 +355,9 @@ namespace RTC
uint8_t
*
extenValue
=
GetExtension
(
this
->
absSendTimeExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
!=
3u
)
{
return
false
;
}
absSendtime
=
Utils
::
Byte
::
Get3Bytes
(
extenValue
,
0
);
...
...
@@ -360,7 +370,9 @@ namespace RTC
uint8_t
*
extenValue
=
GetExtension
(
this
->
absSendTimeExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
!=
3u
)
{
return
false
;
}
auto
absSendTime
=
Utils
::
Time
::
TimeMsToAbsSendTime
(
ms
);
...
...
@@ -375,7 +387,9 @@ namespace RTC
uint8_t
*
extenValue
=
GetExtension
(
this
->
transportWideCc01ExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
!=
2u
)
{
return
false
;
}
wideSeqNumber
=
Utils
::
Byte
::
Get2Bytes
(
extenValue
,
0
);
...
...
@@ -388,7 +402,9 @@ namespace RTC
uint8_t
*
extenValue
=
GetExtension
(
this
->
transportWideCc01ExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
!=
2u
)
{
return
false
;
}
Utils
::
Byte
::
Set2Bytes
(
extenValue
,
0
,
wideSeqNumber
);
...
...
@@ -402,10 +418,14 @@ namespace RTC
// NOTE: Remove this once framemarking draft becomes RFC.
if
(
!
extenValue
)
{
extenValue
=
GetExtension
(
this
->
frameMarking07ExtensionId
,
extenLen
);
}
if
(
!
extenValue
||
extenLen
>
3u
)
{
return
false
;
}
*
frameMarking
=
reinterpret_cast
<
RtpPacket
::
FrameMarking
*>
(
extenValue
);
length
=
extenLen
;
...
...
@@ -419,7 +439,9 @@ namespace RTC
uint8_t
*
extenValue
=
GetExtension
(
this
->
ssrcAudioLevelExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
!=
1u
)
{
return
false
;
}
volume
=
Utils
::
Byte
::
Get1Byte
(
extenValue
,
0
);
voice
=
(
volume
&
(
1
<<
7
))
?
true
:
false
;
...
...
@@ -434,7 +456,9 @@ namespace RTC
uint8_t
*
extenValue
=
GetExtension
(
this
->
videoOrientationExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
!=
1u
)
{
return
false
;
}
uint8_t
cvoByte
=
Utils
::
Byte
::
Get1Byte
(
extenValue
,
0
);
uint8_t
cameraValue
=
((
cvoByte
&
0
b00001000
)
>>
3
);
...
...
@@ -472,7 +496,9 @@ namespace RTC
else
if
(
HasOneByteExtensions
())
{
if
(
id
>
14
)
{
return
false
;
}
// `-1` because we have 14 elements total 0..13 and `id` is in the range 1..14.
return
this
->
oneByteExtensions
[
id
-
1
]
!=
nullptr
;
...
...
@@ -482,13 +508,17 @@ namespace RTC
auto
it
=
this
->
mapTwoBytesExtensions
.
find
(
id
);
if
(
it
==
this
->
mapTwoBytesExtensions
.
end
())
{
return
false
;
}
auto
*
extension
=
it
->
second
;
// In Two-Byte extensions value length may be zero. If so, return false.
if
(
extension
->
len
==
0u
)
{
return
false
;
}
return
true
;
}
...
...
@@ -509,13 +539,17 @@ namespace RTC
else
if
(
HasOneByteExtensions
())
{
if
(
id
>
14
)
{
return
nullptr
;
}
// `-1` because we have 14 elements total 0..13 and `id` is in the range 1..14.
auto
*
extension
=
this
->
oneByteExtensions
[
id
-
1
];
if
(
!
extension
)
{
return
nullptr
;
}
// In One-Byte extensions value length 0 means 1.
len
=
extension
->
len
+
1
;
...
...
@@ -527,7 +561,9 @@ namespace RTC
auto
it
=
this
->
mapTwoBytesExtensions
.
find
(
id
);
if
(
it
==
this
->
mapTwoBytesExtensions
.
end
())
{
return
nullptr
;
}
auto
*
extension
=
it
->
second
;
...
...
@@ -535,7 +571,9 @@ namespace RTC
// In Two-Byte extensions value length may be zero. If so, return nullptr.
if
(
extension
->
len
==
0u
)
{
return
nullptr
;
}
return
extension
->
value
;
}
...
...
@@ -567,7 +605,9 @@ namespace RTC
uint8_t
GetSpatialLayer
()
const
{
if
(
!
this
->
payloadDescriptorHandler
)
{
return
0u
;
}
return
this
->
payloadDescriptorHandler
->
GetSpatialLayer
();
}
...
...
@@ -575,7 +615,9 @@ namespace RTC
uint8_t
GetTemporalLayer
()
const
{
if
(
!
this
->
payloadDescriptorHandler
)
{
return
0u
;
}
return
this
->
payloadDescriptorHandler
->
GetTemporalLayer
();
}
...
...
@@ -583,7 +625,9 @@ namespace RTC
bool
IsKeyFrame
()
const
{
if
(
!
this
->
payloadDescriptorHandler
)
{
return
false
;
}
return
this
->
payloadDescriptorHandler
->
IsKeyFrame
();
}
...
...
worker/include/RTC/TransportTuple.hpp
浏览文件 @
262dba06
...
...
@@ -45,24 +45,34 @@ namespace RTC
protocol
(
tuple
->
protocol
)
{
if
(
protocol
==
TransportTuple
::
Protocol
::
UDP
)
{
StoreUdpRemoteAddress
();
}
}
public
:
void
Close
()
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
{
this
->
udpSocket
->
Close
();
}
else
{
this
->
tcpConnection
->
Close
();
}
}
bool
IsClosed
()
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
{
return
this
->
udpSocket
->
IsClosed
();
}
else
{
return
this
->
tcpConnection
->
IsClosed
();
}
}
flatbuffers
::
Offset
<
FBS
::
Transport
::
Tuple
>
FillBuffer
(
flatbuffers
::
FlatBufferBuilder
&
builder
)
const
;
...
...
@@ -90,9 +100,13 @@ namespace RTC
void
Send
(
const
uint8_t
*
data
,
size_t
len
,
RTC
::
TransportTuple
::
onSendCallback
*
cb
=
nullptr
)
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
{
this
->
udpSocket
->
Send
(
data
,
len
,
this
->
udpRemoteAddr
,
cb
);
}
else
{
this
->
tcpConnection
->
Send
(
data
,
len
,
cb
);
}
}
Protocol
GetProtocol
()
const
...
...
@@ -103,33 +117,49 @@ namespace RTC
const
struct
sockaddr
*
GetLocalAddress
()
const
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
{
return
this
->
udpSocket
->
GetLocalAddress
();
}
else
{
return
this
->
tcpConnection
->
GetLocalAddress
();
}
}
const
struct
sockaddr
*
GetRemoteAddress
()
const
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
{
return
(
const
struct
sockaddr
*
)
this
->
udpRemoteAddr
;
}
else
{
return
this
->
tcpConnection
->
GetPeerAddress
();
}
}
size_t
GetRecvBytes
()
const
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
{
return
this
->
udpSocket
->
GetRecvBytes
();
}
else
{
return
this
->
tcpConnection
->
GetRecvBytes
();
}
}
size_t
GetSentBytes
()
const
{
if
(
this
->
protocol
==
Protocol
::
UDP
)
{
return
this
->
udpSocket
->
GetSentBytes
();
}
else
{
return
this
->
tcpConnection
->
GetSentBytes
();
}
}
private
:
...
...
worker/test/include/helpers.hpp
浏览文件 @
262dba06
...
...
@@ -18,7 +18,9 @@ namespace helpers
std
::
ifstream
in
(
filePath
,
std
::
ios
::
ate
|
std
::
ios
::
binary
);
if
(
!
in
)
{
return
false
;
}
*
len
=
static_cast
<
size_t
>
(
in
.
tellg
())
-
1
;
in
.
seekg
(
0
,
std
::
ios
::
beg
);
...
...
@@ -31,9 +33,12 @@ namespace helpers
inline
bool
addToBuffer
(
uint8_t
*
buf
,
int
*
size
,
uint8_t
*
data
,
size_t
len
)
{
if
(
*
size
+
len
>
BUFFER_SIZE
)
{
return
false
;
}
int
i
=
0
;
if
(
len
==
1
)
{
buf
[
*
size
]
=
*
data
;
...
...
@@ -59,12 +64,15 @@ namespace helpers
std
::
ifstream
in
(
filePath
,
std
::
ios
::
ate
|
std
::
ios
::
binary
);
if
(
!
in
)
{
return
false
;
}
in
.
seekg
(
pos
,
std
::
ios
::
beg
);
in
.
read
(
reinterpret_cast
<
char
*>
(
payload
),
bytes
);
in
.
close
();
return
true
;
}
...
...
@@ -93,52 +101,78 @@ namespace helpers
// write the RTP header
if
(
!
addToBuffer
(
buf
,
&
packet_size
,
buffer
,
16
))
{
return
false
;
}
// write ID and length of frame marking extension
// if first layer then length should be 0, else 1
oneByte
=
oneByte
|
1
<<
4
;
if
(
sid
!=
-
1
)
{
oneByte
=
oneByte
|
0x01
;
}
if
(
!
addToBuffer
(
buf
,
&
packet_size
,
&
oneByte
,
1
))
{
return
false
;
}
// write SEIDB TID bits
oneByte
=
0
;
if
(
firstSliceId
==
1
)
{
oneByte
=
oneByte
|
1
<<
7
;
}
if
(
lastSliceId
==
1
)
{
oneByte
=
oneByte
|
1
<<
6
;
}
if
(
isIdr
==
1
)
{
oneByte
=
oneByte
|
1
<<
5
;
}
if
(
tid
!=
-
1
)
{
oneByte
=
oneByte
|
tid
;
}
if
(
!
addToBuffer
(
buf
,
&
packet_size
,
&
oneByte
,
1
))
{
return
false
;
}
// write DID QID bits
oneByte
=
0
;
if
(
sid
!=
-
1
)
{
oneByte
=
oneByte
|
sid
<<
6
;
}
if
(
!
addToBuffer
(
buf
,
&
packet_size
,
&
oneByte
,
1
))
{
return
false
;
}
// write TL0PICIDX
oneByte
=
0
;
if
(
!
addToBuffer
(
buf
,
&
packet_size
,
&
oneByte
,
1
))
{
return
false
;
}
// write payload
if
(
!
addToBuffer
(
buf
,
&
packet_size
,
payload
,
nalLength
))
{
return
false
;
}
*
len
=
packet_size
;
...
...
worker/test/src/RTC/Codecs/TestVP8.cpp
浏览文件 @
262dba06
...
...
@@ -228,7 +228,9 @@ Codecs::VP8::PayloadDescriptor* CreatePacket(
buffer
[
5
]
=
tlIndex
<<
6
;
if
(
layerSync
)
{
buffer
[
5
]
|=
0x20
;
// y bit
}
auto
*
payloadDescriptor
=
Codecs
::
VP8
::
Parse
(
buffer
,
bufferLen
);
...
...
worker/test/src/RTC/TestRtpPacket.cpp
浏览文件 @
262dba06
...
...
@@ -20,12 +20,16 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
std
::
string
rid
;
if
(
!
helpers
::
readBinaryFile
(
"data/packet1.raw"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -55,12 +59,16 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
size_t
len
;
if
(
!
helpers
::
readBinaryFile
(
"data/packet2.raw"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
false
);
...
...
@@ -86,12 +94,16 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
uint32_t
absSendTime
;
if
(
!
helpers
::
readBinaryFile
(
"data/packet3.raw"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -181,7 +193,9 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
false
);
...
...
@@ -213,7 +227,9 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -258,7 +274,9 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -325,7 +343,9 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -399,7 +419,9 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
GetPayloadType
()
==
1
);
...
...
@@ -511,7 +533,9 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
uint8_t
*
extenValue
;
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
GetSize
()
==
28
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
false
);
...
...
@@ -674,7 +698,9 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
uint8_t
*
extenValue
;
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
GetSize
()
==
28
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
false
);
...
...
@@ -810,7 +836,9 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
worker/test/src/RTC/TestRtpPacketH264Svc.cpp
浏览文件 @
262dba06
...
...
@@ -22,12 +22,16 @@ SCENARIO("parse RTP packets with H264 SVC", "[parser][rtp]")
uint8_t
*
extenValue
;
if
(
!
helpers
::
readBinaryFile
(
"data/H264_SVC/I0-7.bin"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -82,12 +86,16 @@ SCENARIO("parse RTP packets with H264 SVC", "[parser][rtp]")
uint8_t
*
extenValue
;
if
(
!
helpers
::
readBinaryFile
(
"data/H264_SVC/I0-8.bin"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -142,12 +150,16 @@ SCENARIO("parse RTP packets with H264 SVC", "[parser][rtp]")
uint8_t
*
extenValue
;
if
(
!
helpers
::
readBinaryFile
(
"data/H264_SVC/I0-5.bin"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -201,12 +213,16 @@ SCENARIO("parse RTP packets with H264 SVC", "[parser][rtp]")
uint8_t
*
extenValue
;
if
(
!
helpers
::
readBinaryFile
(
"data/H264_SVC/I1-15.bin"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -261,12 +277,16 @@ SCENARIO("parse RTP packets with H264 SVC", "[parser][rtp]")
uint8_t
*
extenValue
;
if
(
!
helpers
::
readBinaryFile
(
"data/H264_SVC/I0-14.bin"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -321,12 +341,16 @@ SCENARIO("parse RTP packets with H264 SVC", "[parser][rtp]")
uint8_t
*
extenValue
;
if
(
!
helpers
::
readBinaryFile
(
"data/H264_SVC/2SL-I14.bin"
,
buffer
,
&
len
))
{
FAIL
(
"cannot open file"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
REQUIRE
(
packet
->
HasMarker
()
==
false
);
REQUIRE
(
packet
->
HasHeaderExtension
()
==
true
);
...
...
@@ -391,10 +415,12 @@ SCENARIO("parse RTP packets with H264 SVC", "[parser][rtp]")
std
::
fstream
nf
;
nf
.
open
(
"data/H264_SVC/naluInfo/naluInfo.csv"
,
std
::
ios
::
in
);
if
(
nf
.
is_open
())
{
std
::
string
line
,
word
;
getline
(
nf
,
line
);
// omit the header in the CSV
while
(
getline
(
nf
,
line
))
{
std
::
stringstream
s
(
line
);
...
...
@@ -413,19 +439,26 @@ SCENARIO("parse RTP packets with H264 SVC", "[parser][rtp]")
if
(
!
helpers
::
readPayloadData
(
"data/H264_SVC/naluInfo/naluInfo.264"
,
pos
+
4
,
bytes
-
4
,
buffer
))
{
FAIL
(
"Failed to read payload data!
\n
"
);
}
// TODO: One additional byte is written as last value is omitted in the
// test bench
std
::
string
strFile1
=
"rtp-"
+
std
::
to_string
(
rows
)
+
".bin"
;
if
(
!
helpers
::
writeRtpPacket
(
strFile1
.
c_str
(),
type
,
bytes
-
4
,
sid
,
tid
,
isIdr
,
start
,
end
,
buffer
,
buffer2
,
&
len
))
{
FAIL
(
"Failed to write RTP packet!
\n
"
);
}
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer2
,
len
);
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
packet
->
SetFrameMarkingExtensionId
(
1
);
...
...
worker/test/src/RTC/TestRtpStreamRecv.cpp
浏览文件 @
262dba06
...
...
@@ -86,7 +86,9 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
for
(
size_t
i
{
1
};
i
<
MaxRequestedPackets
;
++
i
)
{
if
((
bitmask
&
1
)
!=
0
)
{
this
->
nackedSeqNumbers
.
push_back
(
firstSeq
+
i
);
}
bitmask
>>=
1
;
}
...
...
@@ -129,7 +131,9 @@ SCENARIO("receive RTP packets and trigger NACK", "[rtp][rtpstream]")
RtpPacket
*
packet
=
RtpPacket
::
Parse
(
buffer
,
sizeof
(
buffer
));
if
(
!
packet
)
{
FAIL
(
"not a RTP packet"
);
}
RtpStream
::
Params
params
;
...
...
worker/test/src/RTC/TestSeqManager.cpp
浏览文件 @
262dba06
...
...
@@ -45,6 +45,7 @@ void validate(SeqManager<T, N>& seqManager, std::vector<TestSeqManagerInput<T>>&
// Covert to string because otherwise Catch will print uint8_t as char.
REQUIRE
(
std
::
to_string
(
output
)
==
std
::
to_string
(
element
.
output
));
if
(
element
.
maxInput
!=
-
1
)
{
REQUIRE
(
std
::
to_string
(
element
.
maxInput
)
==
std
::
to_string
(
seqManager
.
GetMaxInput
()));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论