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
a565d55a
Commit
a565d55a
authored
Apr 26, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement Muxer.
parent
66b85de2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
460 additions
and
409 deletions
+460
-409
defs.js
src/workers/defs.js
+394
-0
encWW.js
src/workers/encWW.js
+9
-408
muxWW.js
src/workers/muxWW.js
+57
-1
No files found.
src/workers/defs.js
0 → 100644
View file @
a565d55a
This diff is collapsed.
Click to expand it.
src/workers/encWW.js
View file @
a565d55a
This diff is collapsed.
Click to expand it.
src/workers/muxWW.js
View file @
a565d55a
let
isInited
=
false
;
let
isBridged
=
false
;
const
SLEEP_INTERVAL
=
100
;
const
SPIN_TIMEOUT
=
500
;
// Read H264 Encode Group definitions
self
.
importScripts
(
'/src/workers/defs.js'
);
// Load wasm encoder
self
.
importScripts
(
'/src/mp4encoder.js'
);
createMP4Encoder
().
then
(
m
=>
{
encoder
=
m
;
});
// Init
// Init
onmessage
=
e
=>
{
onmessage
=
async
e
=>
{
await
main
(
e
.
data
);
}
async
function
main
(
msg
)
{
if
(
!
isEncGrpMsg
(
msg
))
return
;
switch
(
typeOfMsg
(
msg
))
{
case
MESSAGE_TYPE
.
INIT
:
if
(
!
isInited
)
await
init
();
break
;
case
MESSAGE_TYPE
.
BRIDGE
:
if
(
!
isBridged
)
await
bridging
();
break
;
case
MESSAGE_TYPE
.
DATA
:
await
steps
();
break
;
case
MESSAGE_TYPE
.
DESTROY
:
break
;
}
}
async
function
init
(
msg
)
{}
async
function
bridge
(
msg
)
{}
async
function
steps
()
{
let
timeout
=
SPIN_TIMEOUT
;
src
.
setPriv
(
MSG
.
PRIV_FLAGS
.
EXECUTING
);
while
(
timeout
>
0
)
{
if
(
await
step
()
===
false
&&
retryCount
>=
0
)
{
timeout
-=
SLEEP_INTERVAL
;
await
sleep
(
SLEEP_INTERVAL
);
}
}
src
.
unsetPriv
(
MSG
.
PRIV_FLAGS
.
EXECUTING
);
}
}
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