Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
ParaEncode
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ParaEncode
Commits
c1a69aae
Commit
c1a69aae
authored
May 11, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
fc687dec
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
569 deletions
+66
-569
.gitmodules
.gitmodules
+0
-3
ffmpeg.protos
lib/ffmpeg.protos
+0
-1
encWW.js
resources/workers/encWW.js
+1
-1
muxWW.js
resources/workers/muxWW.js
+3
-3
encGroup.js
src/encGroup.js
+5
-4
interfaces.cc
src/wasms/interfaces.cc
+0
-546
ENCH264Group.spec.js
tests/ENCH264Group.spec.js
+1
-1
wasm-build.sh
wasm-build.sh
+56
-10
No files found.
.gitmodules
View file @
c1a69aae
[submodule "lib/ffmpeg.protos"]
path = lib/ffmpeg.protos
url = git@gitlab.ilaihua.com:linshizhi/ffmpeg.sharedmemoryproto.git
[submodule "lib/ffmpeg.wasm-core"]
path = lib/ffmpeg.wasm-core
url = git@gitlab.ilaihua.com:linshizhi/ffmpeg.wasm-core.git
ffmpeg.protos
@
ed4e7ded
Subproject commit ed4e7ded6e361f8a6ac9e0adfd31cd7e75aed157
resources/workers/encWW.js
View file @
c1a69aae
...
...
@@ -24,7 +24,7 @@ self.importScripts('defs.js');
// Load wasm encoder
self
.
importScripts
(
'paraencoder.js'
);
create
Para
Encoder
().
then
(
m
=>
{
createEncoder
().
then
(
m
=>
{
encoder
=
m
;
});
...
...
resources/workers/muxWW.js
View file @
c1a69aae
...
...
@@ -27,8 +27,8 @@ let muxBuffer = null;
self
.
importScripts
(
'defs.js'
);
// Load wasm encoder
self
.
importScripts
(
'./para
encod
er.js'
);
create
ParaEncod
er
().
then
(
m
=>
{
self
.
importScripts
(
'./para
mux
er.js'
);
create
Mux
er
().
then
(
m
=>
{
muxer
=
m
;
});
...
...
@@ -129,7 +129,7 @@ async function step() {
// Check EOF
let
flag
=
chn
.
readPriv
();
if
(
flag
&
PRIV_FLAGS
.
EOF
)
{
console
.
log
(
"MUXER: EOF "
+
i
)
console
.
log
(
"MUXER: EOF "
+
i
)
;
muxer
.
_eof
(
i
);
++
eofCount
;
...
...
src/encGroup.js
View file @
c1a69aae
...
...
@@ -173,15 +173,16 @@ export class H264EncWWGroup extends WWGroup {
console
.
log
(
"Ready to push..."
);
while
(
this
.
#
channels
[
this
.
#
curProcWW
].
push
(
rgbFrame
)
==
false
)
{
console
.
log
(
"Pushing..."
);
await
sleep
(
300
);
}
if
(
!
this
.
#
channels
[
this
.
#
curProcWW
].
isSetPriv
(
PRIV_FLAGS
.
EXECUTING
))
{
this
.
#
encWorkers
[
this
.
#
curProcWW
].
postMessage
(
makeMsg
(
MESSAGE_TYPE
.
DATA
,
{}))
}
while
(
this
.
#
channels
[
this
.
#
curProcWW
].
push
(
rgbFrame
)
==
false
)
{
console
.
log
(
"Pushing..."
);
await
sleep
(
300
);
}
this
.
#
curProcWW
=
(
this
.
#
curProcWW
+
1
)
%
this
.
#
numOfEncWorker
;
}
...
...
src/wasms/interfaces.cc
deleted
100644 → 0
View file @
fc687dec
This diff is collapsed.
Click to expand it.
tests/ENCH264Group.spec.js
View file @
c1a69aae
...
...
@@ -15,7 +15,7 @@ describe("H264EncWWGroup Spec", () => {
const
RGBAFrameSize
=
1920
*
1080
*
4
;
let
grp
=
new
H264EncWWGroup
(
"h264enc"
,
{
numOfWW
:
8
,
numOfWW
:
11
,
encchnlsize
:
RGBAFrameSize
*
10
,
bridgechnlsize
:
Math
.
pow
(
2
,
25
)
});
...
...
wasm-build.sh
View file @
c1a69aae
...
...
@@ -18,7 +18,7 @@ FFMPEG_PROTO=${WORKPATH}/src/protos/src
WASM_DIR
=
${
WORKPATH
}
/src/wasms
#DEBUG="-O2"
DEBUG
=
"-g2
-gseparate-dwarf=./temp.debug.wasm -s SEPARATE_DWARF_URL=http://localhost:9876/temp.debug.wasm
"
DEBUG
=
"-g2"
BUILD_DIR
=
${
WORKPATH
}
/Build
...
...
@@ -68,24 +68,66 @@ fi
OPTIM_FLAGS
=
"
$DEBUG
--closure 0"
if
[[
"
$FFMPEG_ST
"
!=
"yes"
]]
;
then
EXTRA_FLAGS
=(
EXTRA_FLAGS
_ENCODER
=(
-pthread
-s
USE_PTHREADS
=
1
# enable pthreads support
-s
PROXY_TO_PTHREAD
=
1
# detach main() from browser/UI main thread
-o
${
DEMO_PATH
}
/resources/workers/paraencoder.js
)
EXTRA_FLAGS_MUXER
=(
-pthread
-s
USE_PTHREADS
=
1
# enable pthreads support
-s
PROXY_TO_PTHREAD
=
1
# detach main() from browser/UI main thread
-o
${
DEMO_PATH
}
/resources/workers/paraemuxer.js
)
else
EXTRA_FLAGS
=(
EXTRA_FLAGS
_ENCODER
=(
-o
${
DEMO_PATH
}
/resources/workers/paraencoder.js
)
EXTRA_FLAGS_MUXER
=(
-o
${
DEMO_PATH
}
/resources/workers/paramuxer.js
)
fi
FLAGS
=(
FLAGS_ENCODER
=(
-I
$BUILD_DIR
/include
-L
$BUILD_DIR
/lib
-I
$LIB_DIR
/ffmpeg.wasm-core
-I
$LIB_DIR
/ffmpeg.protos/src
-Wno-deprecated-declarations
-Wno-pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lx264
-lz
$WASM_DIR
/encoder.c
$LIB_DIR
/ffmpeg.protos/src/ioctx.cc
$LIB_DIR
/ffmpeg.protos/src/utils.cc
$LIB_DIR
/ffmpeg.protos/src/proto/movMemProto.cc
$LIB_DIR
/ffmpeg.protos/src/proto/proto.cc
-s
FORCE_FILESYSTEM
=
1
-s
WASM
=
1
#-s USE_SDL=0 # use SDL2
-s
INVOKE_RUN
=
0
# not to run the main() in the beginning
-s
EXIT_RUNTIME
=
1
# exit runtime after execution
-s
MODULARIZE
=
1
# 延迟加载 use modularized version to be more flexible
-s
EXPORT_NAME
=
"createEncoder"
# assign export name for browser
-s
EXPORTED_FUNCTIONS
=
"[_main,_malloc,_free]"
# export main and proxy_main funcs
-s
EXPORTED_RUNTIME_METHODS
=
"[FS, cwrap, ccall, setValue, writeAsciiToMemory, getValue]"
# export preamble funcs
-s
INITIAL_MEMORY
=
268435456
# 64 KB * 1024 * 16 * 2047 = 2146435072 bytes ~= 2 GB, 268435456 =256M, 134,217,728 =128M
--pre-js
$WORKPATH
/pre.js
--post-js
$WORKPATH
/post.js
-gseparate-dwarf
=
./encoder.debug.wasm
-s
SEPARATE_DWARF_URL
=
http://localhost:9876/encoder.debug.wasm
$OPTIM_FLAGS
${
EXTRA_FLAGS_ENCODER
[@]
}
)
FLAGS_MUXER
=(
-I
$BUILD_DIR
/include
-L
$BUILD_DIR
/lib
-I
$LIB_DIR
/ffmpeg.wasm-core
-I
$LIB_DIR
/ffmpeg.protos/src
-Wno-deprecated-declarations
-Wno-pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lx264
-lz
$WASM_DIR
/
interfaces
.cc
$WASM_DIR
/
muxer
.cc
$LIB_DIR
/ffmpeg.protos/src/ioctx.cc
$LIB_DIR
/ffmpeg.protos/src/utils.cc
$LIB_DIR
/ffmpeg.protos/src/proto/movMemProto.cc
...
...
@@ -98,18 +140,22 @@ FLAGS=(
-s
INVOKE_RUN
=
0
# not to run the main() in the beginning
-s
EXIT_RUNTIME
=
1
# exit runtime after execution
-s
MODULARIZE
=
1
# 延迟加载 use modularized version to be more flexible
-s
EXPORT_NAME
=
"create
ParaEncod
er"
# assign export name for browser
-s
EXPORT_NAME
=
"create
Mux
er"
# assign export name for browser
-s
EXPORTED_FUNCTIONS
=
"[_main,_malloc,_free]"
# export main and proxy_main funcs
-s
EXPORTED_RUNTIME_METHODS
=
"[FS, cwrap, ccall, setValue, writeAsciiToMemory, getValue]"
# export preamble funcs
-s
INITIAL_MEMORY
=
536870912
# 64 KB * 1024 * 16 * 2047 = 2146435072 bytes ~= 2 GB, 268435456 =256M, 134,217,728 =128M
-s
SAFE_HEAP
=
1
--pre-js
$WORKPATH
/pre.js
--post-js
$WORKPATH
/post.js
-gseparate-dwarf
=
./muxer.debug.wasm
-s
SEPARATE_DWARF_URL
=
http://localhost:9876/muxer.debug.wasm
$OPTIM_FLAGS
${
EXTRA_FLAGS
[@]
}
${
EXTRA_FLAGS
_MUXER
[@]
}
)
emcc
"
${
FLAGS
[@]
}
"
emcc
"
${
FLAGS_ENCODER
[@]
}
"
emcc
"
${
FLAGS_MUXER
[@]
}
"
chown
"
$1
:
$2
"
${
DEMO_PATH
}
/resources/workers/paraencoder.js
chown
"
$1
:
$2
"
${
DEMO_PATH
}
/resources/workers/paraencoder.js
chown
"
$1
:
$2
"
${
DEMO_PATH
}
/resources/workers/paraencoder.wasm
chown
"
$1
:
$2
"
${
DEMO_PATH
}
/resources/workers/paramuxer.wasm
chown
"
$1
:
$2
"
${
DEMO_PATH
}
/resources/workers/paramuxer.wasm
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment