Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
31917af5
Unverified
提交
31917af5
authored
11月 15, 2023
作者:
Iñaki Baz Castillo
提交者:
GitHub
11月 15, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modernize clang-format (#1221)
上级
262dba06
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
138 行增加
和
50 行删除
+138
-50
mediasoup-worker.yaml
.github/workflows/mediasoup-worker.yaml
+3
-2
npm-scripts.mjs
npm-scripts.mjs
+5
-5
package.json
package.json
+1
-1
.clang-format
worker/.clang-format
+1
-0
Makefile
worker/Makefile
+2
-3
FeedbackItem.hpp
worker/include/RTC/RTCP/FeedbackItem.hpp
+2
-0
clang-format.mjs
worker/scripts/clang-format.mjs
+89
-0
gulpfile.mjs
worker/scripts/gulpfile.mjs
+0
-25
package-lock.json
worker/scripts/package-lock.json
+0
-0
package.json
worker/scripts/package.json
+7
-6
CompoundPacket.cpp
worker/src/RTC/RTCP/CompoundPacket.cpp
+8
-0
TestFeedbackRtpTransport.cpp
worker/test/src/RTC/RTCP/TestFeedbackRtpTransport.cpp
+20
-8
没有找到文件。
.github/workflows/mediasoup-worker.yaml
浏览文件 @
31917af5
...
...
@@ -68,8 +68,9 @@ jobs:
-
name
:
npm ci
run
:
npm ci --ignore-scripts --omit=dev
-
name
:
npm run install-clang-tools
run
:
npm run install-clang-tools
# We need to install deps on worker/scripts/package.json.
-
name
:
npm run install-worker-dev-tools
run
:
npm run install-worker-dev-tools
# TODO: Maybe fix this one day.
if
:
runner.os != 'Windows'
...
...
npm-scripts.mjs
浏览文件 @
31917af5
...
...
@@ -192,7 +192,7 @@ async function run()
break
;
}
case
'install-
clang
-tools'
:
case
'install-
worker-dev
-tools'
:
{
executeCmd
(
'npm ci --prefix worker/scripts'
);
...
...
@@ -353,7 +353,7 @@ function lintNode()
{
logInfo
(
'lintNode()'
);
executeCmd
(
'eslint -c node/.eslintrc.js --ignore-path node/.eslintignore --max-warnings 0 node/src node/.eslintrc.js npm-scripts.mjs worker/scripts/
gulpfile
.mjs'
);
executeCmd
(
'eslint -c node/.eslintrc.js --ignore-path node/.eslintignore --max-warnings 0 node/src node/.eslintrc.js npm-scripts.mjs worker/scripts/
clang-format
.mjs'
);
}
function
lintWorker
()
...
...
@@ -744,19 +744,19 @@ function executeCmd(command, exitOnError = true)
function
logInfo
(
message
)
{
// eslint-disable-next-line no-console
console
.
log
(
`npm-scripts \x1b[36m[INFO] [
${
task
}
]\x1b\[0m`
,
message
);
console
.
log
(
`npm-scripts
.mjs
\x1b[36m[INFO] [
${
task
}
]\x1b\[0m`
,
message
);
}
function
logWarn
(
message
)
{
// eslint-disable-next-line no-console
console
.
warn
(
`npm-scripts \x1b[33m[WARN] [
${
task
}
]\x1b\[0m`
,
message
);
console
.
warn
(
`npm-scripts
.mjs
\x1b[33m[WARN] [
${
task
}
]\x1b\[0m`
,
message
);
}
function
logError
(
message
)
{
// eslint-disable-next-line no-console
console
.
error
(
`npm-scripts \x1b[31m[ERROR] [
${
task
}
]\x1b\[0m`
,
message
);
console
.
error
(
`npm-scripts
.mjs
\x1b[31m[ERROR] [
${
task
}
]\x1b\[0m`
,
message
);
}
function
exitWithError
()
...
...
package.json
浏览文件 @
31917af5
...
...
@@ -67,7 +67,7 @@
"test:worker"
:
"node npm-scripts.mjs test:worker"
,
"coverage:node"
:
"node npm-scripts.mjs coverage:node"
,
"install-deps:node"
:
"node npm-scripts.mjs install-deps:node"
,
"install-
clang-tools"
:
"node npm-scripts.mjs install-clang
-tools"
,
"install-
worker-dev-tools"
:
"node npm-scripts.mjs install-worker-dev
-tools"
,
"release:check"
:
"node npm-scripts.mjs release:check"
,
"release"
:
"node npm-scripts.mjs release"
,
"release:upload-mac-arm-prebuilt-worker"
:
"node npm-scripts.mjs release:upload-mac-arm-prebuilt-worker"
...
...
worker/.clang-format
浏览文件 @
31917af5
...
...
@@ -61,6 +61,7 @@ IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
...
...
worker/Makefile
浏览文件 @
31917af5
...
...
@@ -13,7 +13,6 @@ MEDIASOUP_OUT_DIR ?= $(shell pwd)/out
# Check the meaning of useful macros in the `worker/include/Logger.hpp` header
# file if you want to enable tracing or other debug information.
MEDIASOUP_BUILDTYPE
?=
Release
GULP
=
./scripts/node_modules/.bin/gulp
LCOV
=
./deps/lcov/bin/lcov
DOCKER
?=
docker
PIP_DIR
=
$(MEDIASOUP_OUT_DIR)
/pip
...
...
@@ -213,10 +212,10 @@ xcode: setup
$(MESON)
setup
--buildtype
debug
--backend
xcode
$(MEDIASOUP_OUT_DIR)
/xcode
lint
:
$(GULP)
--gulpfile
./scripts/gulpfile.mjs lint:worker
npm run lint
--prefix
scripts/
format
:
$(GULP)
--gulpfile
./scripts/gulpfile.mjs format:worker
npm run format
--prefix
scripts/
test
:
setup flatc
$(MESON)
compile
-C
$(BUILD_DIR)
-j
$(CORES)
mediasoup-worker-test
...
...
worker/include/RTC/RTCP/FeedbackItem.hpp
浏览文件 @
31917af5
...
...
@@ -15,7 +15,9 @@ namespace RTC
{
// data size must be >= header.
if
(
Item
::
HeaderSize
>
len
)
{
return
nullptr
;
}
auto
*
header
=
const_cast
<
typename
Item
::
Header
*>
(
reinterpret_cast
<
const
typename
Item
::
Header
*>
(
data
));
...
...
worker/scripts/clang-format.mjs
0 → 100644
浏览文件 @
31917af5
import
{
execSync
}
from
'node:child_process'
;
import
{
glob
}
from
'glob'
;
import
clangFormat
from
'clang-format'
;
const
task
=
process
.
argv
.
slice
(
2
).
join
(
' '
);
run
();
async
function
run
()
{
const
clangFormatNativeBinary
=
clangFormat
.
getNativeBinary
();
const
workerFiles
=
await
glob
(
[
'../src/**/*.cpp'
,
'../include/**/*.hpp'
,
'../test/src/**/*.cpp'
,
'../test/include/helpers.hpp'
,
'../fuzzer/src/**/*.cpp'
,
'../fuzzer/include/**/*.hpp'
]
);
switch
(
task
)
{
case
'lint'
:
{
executeCmd
(
`
${
clangFormatNativeBinary
}
--Werror --dry-run
${
workerFiles
.
join
(
' '
)}
`
);
break
;
}
case
'format'
:
{
executeCmd
(
`
${
clangFormatNativeBinary
}
--Werror -i
${
workerFiles
.
join
(
' '
)}
`
);
break
;
}
default
:
{
logError
(
'unknown task'
);
exitWithError
();
}
}
}
function
executeCmd
(
command
)
{
try
{
execSync
(
command
,
{
stdio
:
[
'ignore'
,
process
.
stdout
,
process
.
stderr
]
});
}
catch
(
error
)
{
logError
(
'executeCmd() failed'
);
exitWithError
();
}
}
// eslint-disable-next-line no-unused-vars
function
logInfo
(
message
)
{
// eslint-disable-next-line no-console
console
.
log
(
`clang-format.mjs \x1b[36m[INFO] [
${
task
}
]\x1b\[0m`
,
message
);
}
// eslint-disable-next-line no-unused-vars
function
logWarn
(
message
)
{
// eslint-disable-next-line no-console
console
.
warn
(
`clang-format.mjs \x1b[33m[WARN] [
${
task
}
]\x1b\[0m`
,
message
);
}
function
logError
(
message
)
{
// eslint-disable-next-line no-console
console
.
error
(
`clang-format.mjs \x1b[31m[ERROR] [
${
task
}
]\x1b\[0m`
,
message
);
}
function
exitWithError
()
{
process
.
exit
(
1
);
}
worker/scripts/gulpfile.mjs
deleted
100644 → 0
浏览文件 @
262dba06
import
gulp
from
'gulp'
;
import
clangFormat
from
'gulp-clang-format'
;
const
workerFiles
=
[
'../src/**/*.cpp'
,
'../include/**/*.hpp'
,
'../test/src/**/*.cpp'
,
'../test/include/helpers.hpp'
,
'../fuzzer/src/**/*.cpp'
,
'../fuzzer/include/**/*.hpp'
];
gulp
.
task
(
'lint:worker'
,
()
=>
{
return
gulp
.
src
(
workerFiles
)
.
pipe
(
clangFormat
.
checkFormat
(
'file'
,
null
,
{
verbose
:
true
,
fail
:
true
}));
});
gulp
.
task
(
'format:worker'
,
()
=>
{
return
gulp
.
src
(
workerFiles
,
{
base
:
'.'
})
.
pipe
(
clangFormat
.
format
(
'file'
))
.
pipe
(
gulp
.
dest
(
'.'
));
});
worker/scripts/package-lock.json
浏览文件 @
31917af5
差异被折叠。
点击展开。
worker/scripts/package.json
浏览文件 @
31917af5
...
...
@@ -2,12 +2,13 @@
"name"
:
"mediasoup-worker-dev-tools"
,
"version"
:
"0.0.1"
,
"description"
:
"mediasoup worker dev tools"
,
"devDependencies"
:
{
"clang-tools-prebuilt"
:
"^0.1.4"
,
"gulp"
:
"^4.0.2"
,
"gulp-clang-format"
:
"^1.0.27"
"scripts"
:
{
"lint"
:
"node clang-format.mjs lint"
,
"format"
:
"node clang-format.mjs format"
},
"peerDependencies"
:
{
"uuid"
:
"^3.3.2"
"dependencies"
:
{
"clang-format"
:
"^1.8.0"
,
"clang-tools-prebuilt"
:
"^0.1.4"
,
"glob"
:
"^10.3.10"
}
}
worker/src/RTC/RTCP/CompoundPacket.cpp
浏览文件 @
31917af5
...
...
@@ -129,13 +129,19 @@ namespace RTC
// Add the items into the packet.
for
(
auto
*
report
:
senderReports
)
{
this
->
senderReportPacket
.
AddReport
(
report
);
}
for
(
auto
*
chunk
:
sdesChunks
)
{
this
->
sdesPacket
.
AddChunk
(
chunk
);
}
for
(
auto
*
report
:
delaySinceLastRrReports
)
{
this
->
xrPacket
.
AddReport
(
report
);
}
// New items can hold in the packet, report it.
if
(
GetSize
()
<=
MaxSize
)
...
...
@@ -174,7 +180,9 @@ namespace RTC
// Add the items into the packet.
for
(
auto
*
report
:
receiverReports
)
{
this
->
receiverReportPacket
.
AddReport
(
report
);
}
if
(
receiverReferenceTimeReport
)
{
...
...
worker/test/src/RTC/RTCP/TestFeedbackRtpTransport.cpp
浏览文件 @
31917af5
...
...
@@ -97,7 +97,9 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
packet
->
SetFeedbackPacketCount
(
1
);
for
(
auto
&
input
:
inputs
)
{
packet
->
AddPacket
(
input
.
sequenceNumber
,
input
.
timestamp
,
input
.
maxPacketSize
);
}
REQUIRE
(
packet
->
GetLatestSequenceNumber
()
==
1013
);
REQUIRE
(
packet
->
GetLatestTimestamp
()
==
1000000013
);
...
...
@@ -170,7 +172,9 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
packet
->
SetFeedbackPacketCount
(
10
);
for
(
auto
&
input
:
inputs
)
{
packet
->
AddPacket
(
input
.
sequenceNumber
,
input
.
timestamp
,
input
.
maxPacketSize
);
}
packet
->
Finish
();
validate
(
inputs
,
packet
->
GetPacketResults
());
...
...
@@ -233,7 +237,9 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
packet
->
SetFeedbackPacketCount
(
1
);
for
(
auto
&
input
:
inputs
)
{
packet
->
AddPacket
(
input
.
sequenceNumber
,
input
.
timestamp
,
input
.
maxPacketSize
);
}
packet
->
Finish
();
validate
(
inputs
,
packet
->
GetPacketResults
());
...
...
@@ -289,7 +295,9 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
packet
->
SetFeedbackPacketCount
(
1
);
for
(
auto
&
input
:
inputs
)
{
packet
->
AddPacket
(
input
.
sequenceNumber
,
input
.
timestamp
,
input
.
maxPacketSize
);
}
packet
->
Finish
();
validate
(
inputs
,
packet
->
GetPacketResults
());
...
...
@@ -354,7 +362,9 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
packet
->
SetFeedbackPacketCount
(
1
);
for
(
auto
&
input
:
inputs
)
{
packet
->
AddPacket
(
input
.
sequenceNumber
,
input
.
timestamp
,
input
.
maxPacketSize
);
}
packet
->
Finish
();
validate
(
inputs
,
packet
->
GetPacketResults
());
...
...
@@ -413,7 +423,9 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
packet2
->
SetFeedbackPacketCount
(
2
);
for
(
auto
&
input
:
inputs2
)
{
packet2
->
AddPacket
(
input
.
sequenceNumber
,
input
.
timestamp
,
input
.
maxPacketSize
);
}
packet2
->
Finish
();
validate
(
inputs2
,
packet2
->
GetPacketResults
());
...
...
@@ -593,8 +605,8 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
.
packetStatusCount
=
1
,
.
deltas
=
std
::
vector
<
int16_t
>
{
57
},
.
buffer
=
std
::
vector
<
uint8_t
>
{
0xaf
,
0xcd
,
0x00
,
0x05
,
0xfa
,
0x17
,
0xfa
,
0x17
,
0x00
,
0x00
,
0x04
,
0xd2
,
0x00
,
0x0d
,
0x00
,
0x01
,
0x00
,
0x8A
,
0xB0
,
0x00
,
0x20
,
0x01
,
0xE4
,
0x01
}
},
0x00
,
0x00
,
0x04
,
0xd2
,
0x00
,
0x0d
,
0x00
,
0x01
,
0x00
,
0x8A
,
0xB0
,
0x00
,
0x20
,
0x01
,
0xE4
,
0x01
}
},
{
.
baseTimeRaw
=
35504
,
.
baseTimeMs
=
1076014080
,
.
baseSequence
=
14
,
...
...
@@ -630,8 +642,8 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
.
packetStatusCount
=
2
,
.
deltas
=
std
::
vector
<
int16_t
>
{
35
,
17
},
.
buffer
=
std
::
vector
<
uint8_t
>
{
0x8F
,
0xCD
,
0x00
,
0x05
,
0xFA
,
0x17
,
0xFA
,
0x17
,
0x39
,
0xE9
,
0x42
,
0x38
,
0x00
,
0x01
,
0x00
,
0x02
,
0xBD
,
0x57
,
0xAA
,
0x00
,
0x20
,
0x02
,
0x8C
,
0x44
}
},
0x39
,
0xE9
,
0x42
,
0x38
,
0x00
,
0x01
,
0x00
,
0x02
,
0xBD
,
0x57
,
0xAA
,
0x00
,
0x20
,
0x02
,
0x8C
,
0x44
}
},
{
.
baseTimeRaw
=
818995
,
.
baseTimeMs
=
1126157504
,
...
...
@@ -690,16 +702,16 @@ SCENARIO("RTCP Feeback RTP transport", "[parser][rtcp][feedback-rtp][transport]"
.
packetStatusCount
=
2
,
.
deltas
=
std
::
vector
<
int16_t
>
{
44
,
18
},
.
buffer
=
std
::
vector
<
uint8_t
>
{
0x8F
,
0xCD
,
0x00
,
0x05
,
0xFA
,
0x17
,
0xFA
,
0x17
,
0x08
,
0xEB
,
0x06
,
0xD7
,
0x00
,
0x11
,
0x00
,
0x02
,
0x0C
,
0x89
,
0x14
,
0x01
,
0x20
,
0x02
,
0xB0
,
0x48
}
},
0x08
,
0xEB
,
0x06
,
0xD7
,
0x00
,
0x11
,
0x00
,
0x02
,
0x0C
,
0x89
,
0x14
,
0x01
,
0x20
,
0x02
,
0xB0
,
0x48
}
},
{
.
baseTimeRaw
=
821524
,
.
baseTimeMs
=
1126319360
,
.
baseSequence
=
17
,
.
packetStatusCount
=
1
,
.
deltas
=
std
::
vector
<
int16_t
>
{
62
},
.
buffer
=
std
::
vector
<
uint8_t
>
{
0xAF
,
0xCD
,
0x00
,
0x05
,
0xFA
,
0x17
,
0xFA
,
0x17
,
0x20
,
0x92
,
0x5E
,
0xB7
,
0x00
,
0x11
,
0x00
,
0x01
,
0x0C
,
0x89
,
0x14
,
0x00
,
0x20
,
0x01
,
0xF8
,
0x01
}
},
0x20
,
0x92
,
0x5E
,
0xB7
,
0x00
,
0x11
,
0x00
,
0x01
,
0x0C
,
0x89
,
0x14
,
0x00
,
0x20
,
0x01
,
0xF8
,
0x01
}
},
{
.
baseTimeRaw
=
821526
,
.
baseTimeMs
=
1126319488
,
.
baseSequence
=
19
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论