Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
3bdcb8a8
Unverified
提交
3bdcb8a8
authored
5月 25, 2022
作者:
prtmD
提交者:
GitHub
5月 25, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for H264 SVC (#798)
上级
4556001e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
26 个修改的文件
包含
822 行增加
和
3 行删除
+822
-3
ortc.js
node/lib/ortc.js
+1
-0
supportedRtpCapabilities.d.ts.map
node/lib/supportedRtpCapabilities.d.ts.map
+2
-2
supportedRtpCapabilities.js
node/lib/supportedRtpCapabilities.js
+15
-0
ortc.ts
node/src/ortc.ts
+1
-0
supportedRtpCapabilities.ts
node/src/supportedRtpCapabilities.ts
+15
-0
ortc.rs
rust/src/ortc.rs
+1
-1
rtp_parameters.rs
rust/src/rtp_parameters.rs
+3
-0
supported_rtp_capabilities.rs
rust/src/supported_rtp_capabilities.rs
+16
-0
H264_SVC.hpp
worker/include/RTC/Codecs/H264_SVC.hpp
+115
-0
Tools.hpp
worker/include/RTC/Codecs/Tools.hpp
+11
-0
RtpDictionaries.hpp
worker/include/RTC/RtpDictionaries.hpp
+1
-0
meson.build
worker/meson.build
+4
-0
H264_SVC.cpp
worker/src/RTC/Codecs/H264_SVC.cpp
+0
-0
RtpCodecMimeType.cpp
worker/src/RTC/RtpDictionaries/RtpCodecMimeType.cpp
+2
-0
2SL-I14.bin
worker/test/data/H264_SVC/2SL-I14.bin
+0
-0
I0-14.bin
worker/test/data/H264_SVC/I0-14.bin
+0
-0
I0-5.bin
worker/test/data/H264_SVC/I0-5.bin
+0
-0
I0-7.bin
worker/test/data/H264_SVC/I0-7.bin
+0
-0
I0-8.bin
worker/test/data/H264_SVC/I0-8.bin
+0
-0
I1-15.bin
worker/test/data/H264_SVC/I1-15.bin
+0
-0
naluInfo.264
worker/test/data/H264_SVC/naluInfo/naluInfo.264
+0
-0
naluInfo.csv
worker/test/data/H264_SVC/naluInfo/naluInfo.csv
+305
-0
helpers.hpp
worker/test/include/helpers.hpp
+119
-0
TestH264.cpp
worker/test/src/RTC/Codecs/TestH264.cpp
+30
-0
TestH264_SVC.cpp
worker/test/src/RTC/Codecs/TestH264_SVC.cpp
+181
-0
TestRtpPacketH264Svc.cpp
worker/test/src/RTC/TestRtpPacketH264Svc.cpp
+0
-0
没有找到文件。
node/lib/ortc.js
浏览文件 @
3bdcb8a8
...
@@ -828,6 +828,7 @@ function matchCodecs(aCodec, bCodec, { strict = false, modify = false } = {}) {
...
@@ -828,6 +828,7 @@ function matchCodecs(aCodec, bCodec, { strict = false, modify = false } = {}) {
break
;
break
;
}
}
case
'video/h264'
:
case
'video/h264'
:
case
'video/h264-svc'
:
{
{
if
(
strict
)
{
if
(
strict
)
{
const
aPacketizationMode
=
aCodec
.
parameters
[
'packetization-mode'
]
||
0
;
const
aPacketizationMode
=
aCodec
.
parameters
[
'packetization-mode'
]
||
0
;
...
...
node/lib/supportedRtpCapabilities.d.ts.map
浏览文件 @
3bdcb8a8
{"version":3,"file":"supportedRtpCapabilities.d.ts","sourceRoot":"","sources":["../src/supportedRtpCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,QAAA,MAAM,wBAAwB,EAAE,eAgX/B,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
{"version":3,"file":"supportedRtpCapabilities.d.ts","sourceRoot":"","sources":["../src/supportedRtpCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,QAAA,MAAM,wBAAwB,EAAE,eA+X/B,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
\ No newline at end of file
\ No newline at end of file
node/lib/supportedRtpCapabilities.js
浏览文件 @
3bdcb8a8
...
@@ -217,6 +217,21 @@ const supportedRtpCapabilities = {
...
@@ -217,6 +217,21 @@ const supportedRtpCapabilities = {
{
type
:
'transport-cc'
}
{
type
:
'transport-cc'
}
]
]
},
},
{
kind
:
'video'
,
mimeType
:
'video/H264-SVC'
,
clockRate
:
90000
,
parameters
:
{
'level-asymmetry-allowed'
:
1
},
rtcpFeedback
:
[
{
type
:
'nack'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'goog-remb'
},
{
type
:
'transport-cc'
}
]
},
{
{
kind
:
'video'
,
kind
:
'video'
,
mimeType
:
'video/H265'
,
mimeType
:
'video/H265'
,
...
...
node/src/ortc.ts
浏览文件 @
3bdcb8a8
...
@@ -1223,6 +1223,7 @@ function matchCodecs(
...
@@ -1223,6 +1223,7 @@ function matchCodecs(
}
}
case
'video/h264'
:
case
'video/h264'
:
case
'video/h264-svc'
:
{
{
if
(
strict
)
if
(
strict
)
{
{
...
...
node/src/supportedRtpCapabilities.ts
浏览文件 @
3bdcb8a8
...
@@ -240,6 +240,21 @@ const supportedRtpCapabilities: RtpCapabilities =
...
@@ -240,6 +240,21 @@ const supportedRtpCapabilities: RtpCapabilities =
{
type
:
'transport-cc'
}
{
type
:
'transport-cc'
}
]
]
},
},
{
kind
:
'video'
,
mimeType
:
'video/H264-SVC'
,
clockRate
:
90000
,
parameters
:
{
'level-asymmetry-allowed'
:
1
},
rtcpFeedback
:
[
{
type
:
'nack'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'goog-remb'
},
{
type
:
'transport-cc'
}
]
},
{
{
kind
:
'video'
,
kind
:
'video'
,
mimeType
:
'video/H265'
,
mimeType
:
'video/H265'
,
...
...
rust/src/ortc.rs
浏览文件 @
3bdcb8a8
...
@@ -999,7 +999,7 @@ fn match_codecs(
...
@@ -999,7 +999,7 @@ fn match_codecs(
return
Err
(());
return
Err
(());
}
}
}
}
MimeType
::
Video
(
MimeTypeVideo
::
H264
)
=>
{
MimeType
::
Video
(
MimeTypeVideo
::
H264
|
MimeTypeVideo
::
H264Svc
)
=>
{
if
strict
{
if
strict
{
let
packetization_mode_a
=
codec_a
let
packetization_mode_a
=
codec_a
.parameters
.parameters
...
...
rust/src/rtp_parameters.rs
浏览文件 @
3bdcb8a8
...
@@ -264,6 +264,9 @@ pub enum MimeTypeVideo {
...
@@ -264,6 +264,9 @@ pub enum MimeTypeVideo {
/// H264
/// H264
#[serde(rename
=
"video/H264"
)]
#[serde(rename
=
"video/H264"
)]
H264
,
H264
,
/// H264-SVC
#[serde(rename
=
"video/H264-SVC"
)]
H264Svc
,
/// H265
/// H265
#[serde(rename
=
"video/H265"
)]
#[serde(rename
=
"video/H265"
)]
H265
,
H265
,
...
...
rust/src/supported_rtp_capabilities.rs
浏览文件 @
3bdcb8a8
...
@@ -245,6 +245,22 @@ pub fn get_supported_rtp_capabilities() -> RtpCapabilities {
...
@@ -245,6 +245,22 @@ pub fn get_supported_rtp_capabilities() -> RtpCapabilities {
RtcpFeedback
::
TransportCc
,
RtcpFeedback
::
TransportCc
,
],
],
},
},
RtpCodecCapability
::
Video
{
mime_type
:
MimeTypeVideo
::
H264Svc
,
preferred_payload_type
:
None
,
clock_rate
:
NonZeroU32
::
new
(
90000
)
.unwrap
(),
parameters
:
RtpCodecParametersParameters
::
from
([(
"level-asymmetry-allowed"
,
1
_u32
.into
(),
)]),
rtcp_feedback
:
vec!
[
RtcpFeedback
::
Nack
,
RtcpFeedback
::
NackPli
,
RtcpFeedback
::
CcmFir
,
RtcpFeedback
::
GoogRemb
,
RtcpFeedback
::
TransportCc
,
],
},
RtpCodecCapability
::
Video
{
RtpCodecCapability
::
Video
{
mime_type
:
MimeTypeVideo
::
H265
,
mime_type
:
MimeTypeVideo
::
H265
,
preferred_payload_type
:
None
,
preferred_payload_type
:
None
,
...
...
worker/include/RTC/Codecs/H264_SVC.hpp
0 → 100644
浏览文件 @
3bdcb8a8
#ifndef MS_RTC_CODECS_H264_SVC_HPP
#define MS_RTC_CODECS_H264_SVC_HPP
#include "common.hpp"
#include "RTC/Codecs/PayloadDescriptorHandler.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/SeqManager.hpp"
namespace
RTC
{
namespace
Codecs
{
class
H264_SVC
{
public
:
struct
PayloadDescriptor
:
public
RTC
::
Codecs
::
PayloadDescriptor
{
~
PayloadDescriptor
()
=
default
;
void
Dump
()
const
override
;
// Fields in frame-marking extension.
uint8_t
s
:
1
;
// Start of Frame.
uint8_t
e
:
1
;
// End of Frame.
uint8_t
i
:
1
;
// Independent Frame.
uint8_t
d
:
1
;
// Discardable Frame.
uint8_t
b
:
1
;
// Base Layer Sync.
uint8_t
slIndex
{
0
};
// Temporal layer id.
uint8_t
tlIndex
{
0
};
// Spatial layer id.
uint8_t
tl0picidx
{
0
};
// TL0PICIDX
// Parsed values.
bool
hasSlIndex
{
false
};
bool
hasTlIndex
{
false
};
bool
hasTl0picidx
{
false
};
bool
isKeyFrame
{
false
};
// Extension fields.
uint8_t
idr
{
0
};
uint8_t
priorityId
{
0
};
uint8_t
noIntLayerPredFlag
{
true
};
};
public
:
static
H264_SVC
::
PayloadDescriptor
*
Parse
(
const
uint8_t
*
data
,
size_t
len
,
RTC
::
RtpPacket
::
FrameMarking
*
frameMarking
=
nullptr
,
uint8_t
frameMarkingLen
=
0
);
static
std
::
unique_ptr
<
H264_SVC
::
PayloadDescriptor
>
ParseSingleNalu
(
const
uint8_t
*
data
,
size_t
len
,
std
::
unique_ptr
<
H264_SVC
::
PayloadDescriptor
>
payloadDescriptor
,
bool
isStartBit
);
// useful in FU packet to indicate first packet. Set to true for other packets
static
void
ProcessRtpPacket
(
RTC
::
RtpPacket
*
packet
);
public
:
class
EncodingContext
:
public
RTC
::
Codecs
::
EncodingContext
{
public
:
explicit
EncodingContext
(
RTC
::
Codecs
::
EncodingContext
::
Params
&
params
)
:
RTC
::
Codecs
::
EncodingContext
(
params
)
{
}
~
EncodingContext
()
=
default
;
/* Pure virtual methods inherited from RTC::Codecs::EncodingContext. */
public
:
void
SyncRequired
()
override
{
}
public
:
RTC
::
SeqManager
<
uint16_t
>
pictureIdManager
;
bool
syncRequired
{
false
};
};
public
:
class
PayloadDescriptorHandler
:
public
RTC
::
Codecs
::
PayloadDescriptorHandler
{
public
:
explicit
PayloadDescriptorHandler
(
PayloadDescriptor
*
payloadDescriptor
);
~
PayloadDescriptorHandler
()
=
default
;
public
:
void
Dump
()
const
override
{
this
->
payloadDescriptor
->
Dump
();
}
bool
Process
(
RTC
::
Codecs
::
EncodingContext
*
encodingContext
,
uint8_t
*
data
,
bool
&
marker
)
override
;
void
Restore
(
uint8_t
*
data
)
override
;
uint8_t
GetSpatialLayer
()
const
override
{
// return 0u;
return
this
->
payloadDescriptor
->
hasSlIndex
?
this
->
payloadDescriptor
->
slIndex
:
0u
;
}
uint8_t
GetTemporalLayer
()
const
override
{
// return this->payloadDescriptor->tid;
return
this
->
payloadDescriptor
->
hasTlIndex
?
this
->
payloadDescriptor
->
tlIndex
:
0u
;
}
bool
IsKeyFrame
()
const
override
{
return
this
->
payloadDescriptor
->
isKeyFrame
;
}
private
:
std
::
unique_ptr
<
PayloadDescriptor
>
payloadDescriptor
;
};
};
}
// namespace Codecs
}
// namespace RTC
#endif
worker/include/RTC/Codecs/Tools.hpp
浏览文件 @
3bdcb8a8
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "common.hpp"
#include "common.hpp"
#include "RTC/Codecs/H264.hpp"
#include "RTC/Codecs/H264.hpp"
#include "RTC/Codecs/H264_SVC.hpp"
#include "RTC/Codecs/PayloadDescriptorHandler.hpp"
#include "RTC/Codecs/PayloadDescriptorHandler.hpp"
#include "RTC/Codecs/VP8.hpp"
#include "RTC/Codecs/VP8.hpp"
#include "RTC/Codecs/VP9.hpp"
#include "RTC/Codecs/VP9.hpp"
...
@@ -29,6 +30,7 @@ namespace RTC
...
@@ -29,6 +30,7 @@ namespace RTC
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP8
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP8
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP9
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP9
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
H264
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
H264
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
H264_SVC
:
return
true
;
return
true
;
default
:
default
:
return
false
;
return
false
;
...
@@ -70,6 +72,12 @@ namespace RTC
...
@@ -70,6 +72,12 @@ namespace RTC
break
;
break
;
}
}
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
H264_SVC
:
{
RTC
::
Codecs
::
H264_SVC
::
ProcessRtpPacket
(
packet
);
break
;
}
default
:
;
default
:
;
}
}
...
@@ -125,6 +133,7 @@ namespace RTC
...
@@ -125,6 +133,7 @@ namespace RTC
switch
(
mimeType
.
subtype
)
switch
(
mimeType
.
subtype
)
{
{
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP9
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP9
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
H264_SVC
:
return
true
;
return
true
;
default
:
default
:
return
false
;
return
false
;
...
@@ -165,6 +174,8 @@ namespace RTC
...
@@ -165,6 +174,8 @@ namespace RTC
return
new
RTC
::
Codecs
::
VP9
::
EncodingContext
(
params
);
return
new
RTC
::
Codecs
::
VP9
::
EncodingContext
(
params
);
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
H264
:
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
H264
:
return
new
RTC
::
Codecs
::
H264
::
EncodingContext
(
params
);
return
new
RTC
::
Codecs
::
H264
::
EncodingContext
(
params
);
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
H264_SVC
:
return
new
RTC
::
Codecs
::
H264_SVC
::
EncodingContext
(
params
);
default
:
default
:
return
nullptr
;
return
nullptr
;
}
}
...
...
worker/include/RTC/RtpDictionaries.hpp
浏览文件 @
3bdcb8a8
...
@@ -60,6 +60,7 @@ namespace RTC
...
@@ -60,6 +60,7 @@ namespace RTC
VP8
=
200
,
VP8
=
200
,
VP9
,
VP9
,
H264
,
H264
,
H264_SVC
,
X_H264UC
,
X_H264UC
,
H265
,
H265
,
// Complementary codecs:
// Complementary codecs:
...
...
worker/meson.build
浏览文件 @
3bdcb8a8
...
@@ -99,6 +99,7 @@ common_sources = [
...
@@ -99,6 +99,7 @@ common_sources = [
'src/RTC/UdpSocket.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/WebRtcTransport.cpp',
'src/RTC/WebRtcTransport.cpp',
'src/RTC/Codecs/H264.cpp',
'src/RTC/Codecs/H264.cpp',
'src/RTC/Codecs/H264_SVC.cpp',
'src/RTC/Codecs/VP8.cpp',
'src/RTC/Codecs/VP8.cpp',
'src/RTC/Codecs/VP9.cpp',
'src/RTC/Codecs/VP9.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
...
@@ -269,12 +270,15 @@ mediasoup_worker_test = executable(
...
@@ -269,12 +270,15 @@ mediasoup_worker_test = executable(
'test/src/RTC/TestNackGenerator.cpp',
'test/src/RTC/TestNackGenerator.cpp',
'test/src/RTC/TestRateCalculator.cpp',
'test/src/RTC/TestRateCalculator.cpp',
'test/src/RTC/TestRtpPacket.cpp',
'test/src/RTC/TestRtpPacket.cpp',
'test/src/RTC/TestRtpPacketH264Svc.cpp',
'test/src/RTC/TestRtpStreamSend.cpp',
'test/src/RTC/TestRtpStreamSend.cpp',
'test/src/RTC/TestRtpStreamRecv.cpp',
'test/src/RTC/TestRtpStreamRecv.cpp',
'test/src/RTC/TestSeqManager.cpp',
'test/src/RTC/TestSeqManager.cpp',
'test/src/RTC/TestTrendCalculator.cpp',
'test/src/RTC/TestTrendCalculator.cpp',
'test/src/RTC/TestRtpEncodingParameters.cpp',
'test/src/RTC/TestRtpEncodingParameters.cpp',
'test/src/RTC/Codecs/TestVP8.cpp',
'test/src/RTC/Codecs/TestVP8.cpp',
'test/src/RTC/Codecs/TestH264.cpp',
'test/src/RTC/Codecs/TestH264_SVC.cpp',
'test/src/RTC/RTCP/TestFeedbackPsAfb.cpp',
'test/src/RTC/RTCP/TestFeedbackPsAfb.cpp',
'test/src/RTC/RTCP/TestFeedbackPsFir.cpp',
'test/src/RTC/RTCP/TestFeedbackPsFir.cpp',
'test/src/RTC/RTCP/TestFeedbackPsLei.cpp',
'test/src/RTC/RTCP/TestFeedbackPsLei.cpp',
...
...
worker/src/RTC/Codecs/H264_SVC.cpp
0 → 100644
浏览文件 @
3bdcb8a8
差异被折叠。
点击展开。
worker/src/RTC/RtpDictionaries/RtpCodecMimeType.cpp
浏览文件 @
3bdcb8a8
...
@@ -36,6 +36,7 @@ namespace RTC
...
@@ -36,6 +36,7 @@ namespace RTC
{
"vp8"
,
RtpCodecMimeType
::
Subtype
::
VP8
},
{
"vp8"
,
RtpCodecMimeType
::
Subtype
::
VP8
},
{
"vp9"
,
RtpCodecMimeType
::
Subtype
::
VP9
},
{
"vp9"
,
RtpCodecMimeType
::
Subtype
::
VP9
},
{
"h264"
,
RtpCodecMimeType
::
Subtype
::
H264
},
{
"h264"
,
RtpCodecMimeType
::
Subtype
::
H264
},
{
"h264-svc"
,
RtpCodecMimeType
::
Subtype
::
H264_SVC
},
{
"x-h264uc"
,
RtpCodecMimeType
::
Subtype
::
X_H264UC
},
{
"x-h264uc"
,
RtpCodecMimeType
::
Subtype
::
X_H264UC
},
{
"h265"
,
RtpCodecMimeType
::
Subtype
::
H265
},
{
"h265"
,
RtpCodecMimeType
::
Subtype
::
H265
},
// Complementary codecs:
// Complementary codecs:
...
@@ -63,6 +64,7 @@ namespace RTC
...
@@ -63,6 +64,7 @@ namespace RTC
{
RtpCodecMimeType
::
Subtype
::
VP8
,
"VP8"
},
{
RtpCodecMimeType
::
Subtype
::
VP8
,
"VP8"
},
{
RtpCodecMimeType
::
Subtype
::
VP9
,
"VP9"
},
{
RtpCodecMimeType
::
Subtype
::
VP9
,
"VP9"
},
{
RtpCodecMimeType
::
Subtype
::
H264
,
"H264"
},
{
RtpCodecMimeType
::
Subtype
::
H264
,
"H264"
},
{
RtpCodecMimeType
::
Subtype
::
H264_SVC
,
"H264-SVC"
},
{
RtpCodecMimeType
::
Subtype
::
X_H264UC
,
"X-H264UC"
},
{
RtpCodecMimeType
::
Subtype
::
X_H264UC
,
"X-H264UC"
},
{
RtpCodecMimeType
::
Subtype
::
H265
,
"H265"
},
{
RtpCodecMimeType
::
Subtype
::
H265
,
"H265"
},
// Complementary codecs:
// Complementary codecs:
...
...
worker/test/data/H264_SVC/2SL-I14.bin
0 → 100644
浏览文件 @
3bdcb8a8
File added
worker/test/data/H264_SVC/I0-14.bin
0 → 100644
浏览文件 @
3bdcb8a8
File added
worker/test/data/H264_SVC/I0-5.bin
0 → 100644
浏览文件 @
3bdcb8a8
File added
worker/test/data/H264_SVC/I0-7.bin
0 → 100644
浏览文件 @
3bdcb8a8
File added
worker/test/data/H264_SVC/I0-8.bin
0 → 100644
浏览文件 @
3bdcb8a8
File added
worker/test/data/H264_SVC/I1-15.bin
0 → 100644
浏览文件 @
3bdcb8a8
File added
worker/test/data/H264_SVC/naluInfo/naluInfo.264
0 → 100644
浏览文件 @
3bdcb8a8
File added
worker/test/data/H264_SVC/naluInfo/naluInfo.csv
0 → 100644
浏览文件 @
3bdcb8a8
type,length,SId,TID,isIDR,firstSliceID,lastSliceID
7,13,-1,-1,-1,-1,-1
15,16,-1,-1,-1,-1,-1
8,10,-1,-1,-1,-1,-1
8,11,-1,-1,-1,-1,-1
14,9,-1,-1,-1,-1,-1
5,2023,0,0,1,0,0
20,4747,1,0,1,0,0
14,9,-1,-1,-1,-1,-1
1,144,0,1,0,0,0
20,514,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,148,0,2,0,0,0
20,716,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,310,0,0,0,0,0
20,1071,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,154,0,1,0,0,0
20,579,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,144,0,2,0,0,0
20,719,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,320,0,0,0,0,0
20,1039,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,148,0,1,0,0,0
20,594,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,179,0,2,0,0,0
20,707,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,252,0,0,0,0,0
20,1073,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,146,0,1,0,0,0
20,632,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,177,0,2,0,0,0
20,722,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,312,0,0,0,0,0
20,1157,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,179,0,1,0,0,0
20,716,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,207,0,2,0,0,0
20,857,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,368,0,0,0,0,0
20,1261,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,175,0,1,0,0,0
20,776,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,183,0,2,0,0,0
20,824,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,326,0,0,0,0,0
20,1258,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,188,0,1,0,0,0
20,676,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,189,0,2,0,0,0
20,828,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,333,0,0,0,0,0
20,1371,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,158,0,1,0,0,0
20,755,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,250,0,2,0,0,0
20,884,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,492,0,0,0,0,0
20,1744,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,274,0,1,0,0,0
20,1004,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,330,0,2,0,0,0
20,1122,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,580,0,0,0,0,0
20,1807,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,404,0,1,0,0,0
20,1397,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,462,0,2,0,0,0
20,1605,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,682,0,0,0,0,0
20,2205,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,439,0,1,0,0,0
20,1380,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,464,0,2,0,0,0
20,1525,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,694,0,0,0,0,0
20,2232,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,503,0,1,0,0,0
20,1488,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,548,0,2,0,0,0
20,1647,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,718,0,0,0,0,0
20,2207,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,624,0,1,0,0,0
20,1811,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,631,0,2,0,0,0
20,1739,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,790,0,0,0,0,0
20,2487,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,523,0,1,0,0,0
20,1684,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,563,0,2,0,0,0
20,1660,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,784,0,0,0,0,0
20,2331,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,535,0,1,0,0,0
20,1516,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,480,0,2,0,0,0
20,1579,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,679,0,0,0,0,0
20,2205,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,379,0,1,0,0,0
20,1363,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,393,0,2,0,0,0
20,1342,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,596,0,0,0,0,0
20,1902,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,351,0,1,0,0,0
20,1081,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,256,0,2,0,0,0
20,963,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,451,0,0,0,0,0
20,1590,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,185,0,1,0,0,0
20,704,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,182,0,2,0,0,0
20,687,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,415,0,0,0,0,0
20,1421,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,182,0,1,0,0,0
20,705,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,217,0,2,0,0,0
20,981,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,426,0,0,0,0,0
20,1702,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,162,0,1,0,0,0
20,588,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,155,0,2,0,0,0
20,710,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,284,0,0,0,0,0
20,1115,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,151,0,1,0,0,0
20,541,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,147,0,2,0,0,0
20,527,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,267,0,0,0,0,0
20,925,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,130,0,1,0,0,0
20,563,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,132,0,2,0,0,0
20,603,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,275,0,0,0,0,0
20,1089,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,111,0,1,0,0,0
20,594,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,162,0,2,0,0,0
20,620,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,265,0,0,0,0,0
20,1105,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,149,0,1,0,0,0
20,577,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,150,0,2,0,0,0
20,586,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,296,0,0,0,0,0
20,1009,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,86,0,1,0,0,0
20,474,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,160,0,2,0,0,0
20,481,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,278,0,0,0,0,0
20,934,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,117,0,1,0,0,0
20,500,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,155,0,2,0,0,0
20,559,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,233,0,0,0,0,0
20,932,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,107,0,1,0,0,0
20,470,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,91,0,2,0,0,0
20,574,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,202,0,0,0,0,0
20,982,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,132,0,1,0,0,0
20,558,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,132,0,2,0,0,0
20,564,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,255,0,0,0,0,0
20,1092,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,117,0,1,0,0,0
20,528,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,144,0,2,0,0,0
20,592,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,321,0,0,0,0,0
20,1253,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,164,0,1,0,0,0
20,694,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,174,0,2,0,0,0
20,680,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,317,0,0,0,0,0
20,1205,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,91,0,1,0,0,0
20,487,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,114,0,2,0,0,0
20,554,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,206,0,0,0,0,0
20,895,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,94,0,1,0,0,0
20,431,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,105,0,2,0,0,0
20,481,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,183,0,0,0,0,0
20,807,1,0,0,0,0
14,9,-1,-1,-1,-1,-1
1,86,0,1,0,0,0
20,424,1,1,0,0,0
14,9,-1,-1,-1,-1,-1
1,104,0,2,0,0,0
20,488,1,2,0,0,0
14,9,-1,-1,-1,-1,-1
1,191,0,0,0,0,0
20,790,1,0,0,0,0
worker/test/include/helpers.hpp
浏览文件 @
3bdcb8a8
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#include <fstream>
#include <fstream>
#include <string>
#include <string>
static
int
BUFFER_SIZE
=
65536
;
namespace
helpers
namespace
helpers
{
{
inline
bool
readBinaryFile
(
const
char
*
file
,
uint8_t
*
buffer
,
size_t
*
len
)
inline
bool
readBinaryFile
(
const
char
*
file
,
uint8_t
*
buffer
,
size_t
*
len
)
...
@@ -25,6 +27,123 @@ namespace helpers
...
@@ -25,6 +27,123 @@ namespace helpers
return
true
;
return
true
;
}
}
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
;
}
else
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
buf
[
*
size
+
i
]
=
data
[
i
];
}
}
*
size
+=
len
;
return
true
;
}
inline
bool
readPayloadData
(
const
char
*
file
,
int
pos
,
int
bytes
,
uint8_t
*
payload
)
{
std
::
string
filePath
=
"test/"
+
std
::
string
(
file
);
#ifdef _WIN32
std
::
replace
(
filePath
.
begin
(),
filePath
.
end
(),
'/'
,
'\\'
);
#endif
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
;
}
inline
bool
writeRtpPacket
(
const
char
*
file
,
uint8_t
nalType
,
size_t
nalLength
,
int32_t
sid
,
int32_t
tid
,
int32_t
isIdr
,
int32_t
firstSliceId
,
int32_t
lastSliceId
,
uint8_t
*
payload
,
uint8_t
*
buf
,
size_t
*
len
)
{
std
::
string
filePath
=
"test/"
+
std
::
string
(
file
);
#ifdef _WIN32
std
::
replace
(
filePath
.
begin
(),
filePath
.
end
(),
'/'
,
'\\'
);
#endif
uint8_t
buffer
[
16
]
=
{
144
,
111
,
92
,
65
,
98
,
245
,
71
,
218
,
159
,
113
,
8
,
226
,
190
,
222
,
0
,
1
};
int
packet_size
=
0
;
uint8_t
oneByte
=
0
;
// 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
;
return
true
;
}
}
// namespace helpers
}
// namespace helpers
#endif
#endif
worker/test/src/RTC/Codecs/TestH264.cpp
0 → 100644
浏览文件 @
3bdcb8a8
#include "common.hpp"
#include "RTC/Codecs/H264.hpp"
#include <catch2/catch.hpp>
#include <cstring> // std::memcmp()
using
namespace
RTC
;
SCENARIO
(
"parse H264 payload descriptor"
,
"[codecs][h264]"
)
{
SECTION
(
"parse payload descriptor"
)
{
// clang-format off
uint8_t
originalBuffer
[]
=
{
0x07
,
0x80
,
0x11
,
0x00
};
// clang-format on
//
// Keep a copy of the original buffer for comparing.
uint8_t
buffer
[
4
]
=
{
0
};
std
::
memcpy
(
buffer
,
originalBuffer
,
sizeof
(
buffer
));
const
auto
*
payloadDescriptor
=
Codecs
::
H264
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
payloadDescriptor
);
delete
payloadDescriptor
;
}
}
worker/test/src/RTC/Codecs/TestH264_SVC.cpp
0 → 100644
浏览文件 @
3bdcb8a8
#include "common.hpp"
#include "RTC/Codecs/H264_SVC.hpp"
#include <catch2/catch.hpp>
#include <cstring> // std::memcmp()
using
namespace
RTC
;
SCENARIO
(
"parse H264_SVC payload descriptor"
,
"[codecs][h264_svc]"
)
{
SECTION
(
"parse payload descriptor for NALU 7"
)
{
// clang-format off
uint8_t
originalBuffer
[]
=
{
0x67
,
0x42
,
0xc0
,
0x33
};
// clang-format on
// Keep a copy of the original buffer for comparing.
uint8_t
buffer
[
4
]
=
{
0
};
std
::
memcpy
(
buffer
,
originalBuffer
,
sizeof
(
buffer
));
const
auto
*
payloadDescriptor
=
Codecs
::
H264_SVC
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
payloadDescriptor
);
REQUIRE
(
payloadDescriptor
->
tlIndex
==
0
);
REQUIRE
(
payloadDescriptor
->
slIndex
==
0
);
REQUIRE
(
payloadDescriptor
->
isKeyFrame
==
true
);
REQUIRE
(
payloadDescriptor
->
hasTlIndex
==
false
);
REQUIRE
(
payloadDescriptor
->
hasSlIndex
==
false
);
delete
payloadDescriptor
;
}
SECTION
(
"parse payload descriptor for NALU 8"
)
{
// clang-format off
uint8_t
originalBuffer
[]
=
{
0x68
,
0xce
,
0x01
,
0xa8
};
// clang-format on
// Keep a copy of the original buffer for comparing.
uint8_t
buffer
[
4
]
=
{
0
};
std
::
memcpy
(
buffer
,
originalBuffer
,
sizeof
(
buffer
));
const
auto
*
payloadDescriptor
=
Codecs
::
H264_SVC
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
payloadDescriptor
);
REQUIRE
(
payloadDescriptor
->
tlIndex
==
0
);
REQUIRE
(
payloadDescriptor
->
slIndex
==
0
);
REQUIRE
(
payloadDescriptor
->
isKeyFrame
==
false
);
REQUIRE
(
payloadDescriptor
->
hasTlIndex
==
false
);
REQUIRE
(
payloadDescriptor
->
hasSlIndex
==
false
);
delete
payloadDescriptor
;
}
SECTION
(
"parse payload descriptor for NALU 1"
)
{
// clang-format off
uint8_t
originalBuffer
[]
=
{
0x81
,
0xe0
,
0x00
,
0x4e
};
// clang-format on
// Keep a copy of the original buffer for comparing.
uint8_t
buffer
[
4
]
=
{
0
};
std
::
memcpy
(
buffer
,
originalBuffer
,
sizeof
(
buffer
));
const
auto
*
payloadDescriptor
=
Codecs
::
H264_SVC
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
payloadDescriptor
);
REQUIRE
(
payloadDescriptor
->
tlIndex
==
0
);
REQUIRE
(
payloadDescriptor
->
slIndex
==
0
);
REQUIRE
(
payloadDescriptor
->
isKeyFrame
==
false
);
REQUIRE
(
payloadDescriptor
->
hasTlIndex
==
false
);
REQUIRE
(
payloadDescriptor
->
hasSlIndex
==
false
);
delete
payloadDescriptor
;
}
SECTION
(
"parse payload descriptor for NALU 5"
)
{
// clang-format off
uint8_t
originalBuffer
[]
=
{
0x85
,
0xb8
,
0x00
,
0x04
};
// clang-format on
// Keep a copy of the original buffer for comparing.
uint8_t
buffer
[
4
]
=
{
0
};
std
::
memcpy
(
buffer
,
originalBuffer
,
sizeof
(
buffer
));
const
auto
*
payloadDescriptor
=
Codecs
::
H264_SVC
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
payloadDescriptor
);
REQUIRE
(
payloadDescriptor
->
tlIndex
==
0
);
REQUIRE
(
payloadDescriptor
->
slIndex
==
0
);
REQUIRE
(
payloadDescriptor
->
isKeyFrame
==
true
);
REQUIRE
(
payloadDescriptor
->
hasTlIndex
==
false
);
REQUIRE
(
payloadDescriptor
->
hasSlIndex
==
false
);
delete
payloadDescriptor
;
}
SECTION
(
"parse payload descriptor for NALU 14"
)
{
// clang-format off
uint8_t
originalBuffer
[]
=
{
0x6e
,
0x80
,
0x90
,
0x20
};
// clang-format on
// Keep a copy of the original buffer for comparing.
uint8_t
buffer
[
4
]
=
{
0
};
std
::
memcpy
(
buffer
,
originalBuffer
,
sizeof
(
buffer
));
const
auto
*
payloadDescriptor
=
Codecs
::
H264_SVC
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
payloadDescriptor
);
REQUIRE
(
payloadDescriptor
->
idr
==
0
);
REQUIRE
(
payloadDescriptor
->
tlIndex
==
1
);
REQUIRE
(
payloadDescriptor
->
slIndex
==
1
);
REQUIRE
(
payloadDescriptor
->
isKeyFrame
==
false
);
REQUIRE
(
payloadDescriptor
->
hasTlIndex
==
true
);
REQUIRE
(
payloadDescriptor
->
hasSlIndex
==
true
);
delete
payloadDescriptor
;
}
SECTION
(
"parse payload descriptor for NALU 20"
)
{
// clang-format off
uint8_t
originalBuffer
[]
=
{
0x74
,
0x80
,
0x90
,
0x20
};
// clang-format on
// Keep a copy of the original buffer for comparing.
uint8_t
buffer
[
4
]
=
{
0
};
std
::
memcpy
(
buffer
,
originalBuffer
,
sizeof
(
buffer
));
const
auto
*
payloadDescriptor
=
Codecs
::
H264_SVC
::
Parse
(
buffer
,
sizeof
(
buffer
));
REQUIRE
(
payloadDescriptor
);
REQUIRE
(
payloadDescriptor
->
idr
==
0
);
REQUIRE
(
payloadDescriptor
->
tlIndex
==
1
);
REQUIRE
(
payloadDescriptor
->
slIndex
==
1
);
REQUIRE
(
payloadDescriptor
->
isKeyFrame
==
false
);
REQUIRE
(
payloadDescriptor
->
hasTlIndex
==
true
);
REQUIRE
(
payloadDescriptor
->
hasSlIndex
==
true
);
delete
payloadDescriptor
;
}
}
worker/test/src/RTC/TestRtpPacketH264Svc.cpp
0 → 100644
浏览文件 @
3bdcb8a8
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论