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
51ec9c11
Commit
51ec9c11
authored
May 18, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
48a03a16
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
14 deletions
+23
-14
paraEncode.js
src/paraEncode.js
+4
-1
ENCH264Group.spec.js
tests/ENCH264Group.spec.js
+1
-1
paraEncodeSpec.spec.js
tests/paraEncodeSpec.spec.js
+18
-12
No files found.
src/paraEncode.js
View file @
51ec9c11
...
...
@@ -69,8 +69,11 @@ export class ParaEncoder {
return
this
.
#
grp
.
isDone
();
}
async
getResult
()
{
return
this
.
#
grp
.
getResult
();
}
close
()
{
this
.
#
grp
.
terminate
();
}
}
tests/ENCH264Group.spec.js
View file @
51ec9c11
import
{
sleep
,
waitCond
}
from
'../src/utils.js'
;
import
{
H264EncWWGroup
,
H264GRP_OPTIONS
}
from
'../src/encGroup.js'
;
describe
(
"H264EncWWGroup Spec"
,
()
=>
{
x
describe
(
"H264EncWWGroup Spec"
,
()
=>
{
it
(
"Instantiation"
,
async
()
=>
{
let
wg
=
new
H264EncWWGroup
(
"h264enc"
,
2
);
await
wg
.
start
();
...
...
tests/paraEncodeSpec.spec.js
View file @
51ec9c11
...
...
@@ -6,8 +6,7 @@ const RGBAFrameSize = 1920*1080*4;
describe
(
"ParaEncoder"
,
()
=>
{
beforeEach
(
async
()
=>
{
let
trNum
=
navigator
.
hardwareConcurrency
;
paraEnc
=
new
ParaEncoder
(
trNum
,
{
paraEnc
=
new
ParaEncoder
(
3
,
{
codec
:
"H264"
,
config
:
{
encchnlsize
:
RGBAFrameSize
*
10
,
...
...
@@ -17,11 +16,15 @@ describe("ParaEncoder", () => {
await
paraEnc
.
init
();
},
20000
);
xit
(
"Encode With ParaEncoder"
,
async
()
=>
{
afterEach
(()
=>
{
paraEnc
.
close
();
});
it
(
"Encode With ParaEncoder"
,
async
()
=>
{
const
data
=
new
Uint8Array
([...
Array
(
RGBAFrameSize
).
keys
()]);
let
st
=
new
Date
();
for
(
let
i
=
0
;
i
<
30
0
;
++
i
)
{
for
(
let
i
=
0
;
i
<
30
;
++
i
)
{
await
paraEnc
.
encode
(
data
);
}
...
...
@@ -35,10 +38,11 @@ describe("ParaEncoder", () => {
},
3000000
);
});
let
paraEnc_
;
describe
(
"ParaEncoder Blockbased"
,
()
=>
{
beforeEach
(
async
()
=>
{
let
trNum
=
navigator
.
hardwareConcurrency
;
paraEnc
=
new
ParaEncoder
(
trNum
,
{
paraEnc_
=
new
ParaEncoder
(
3
,
{
codec
:
"H264"
,
config
:
{
encchnlsize
:
RGBAFrameSize
*
10
,
...
...
@@ -49,18 +53,20 @@ describe("ParaEncoder Blockbased", () => {
fps
:
25
}
});
await
paraEnc
.
init
();
await
paraEnc
_
.
init
();
},
20000
);
afterEach
(()
=>
{
paraEnc_
.
close
()
})
it
(
"Encode With DirectWrite"
,
async
()
=>
{
const
data
=
new
Uint8Array
([...
Array
(
RGBAFrameSize
).
keys
()]);
let
st
=
new
Date
();
for
(
let
i
=
0
;
i
<
30
0
;
++
i
)
{
for
(
let
i
=
0
;
i
<
30
;
++
i
)
{
let
buffers
=
[];
while
(
true
)
{
buffers
=
paraEnc
.
directWPrepare
(
RGBAFrameSize
);
buffers
=
paraEnc
_
.
directWPrepare
(
RGBAFrameSize
);
if
(
buffers
.
length
>
0
)
break
;
else
...
...
@@ -69,11 +75,11 @@ describe("ParaEncoder Blockbased", () => {
expect
(
buffers
.
length
).
toBe
(
1
);
buffers
[
0
].
set
(
data
,
0
);
await
paraEnc
.
directWConfirm
();
await
paraEnc
_
.
directWConfirm
();
}
await
paraEnc
.
encode
(
null
);
await
waitCond
(()
=>
paraEnc
.
isDone
(),
3000000
,
300
);
await
paraEnc
_
.
encode
(
null
);
await
waitCond
(()
=>
paraEnc
_
.
isDone
(),
3000000
,
300
);
let
et
=
new
Date
();
let
diff
=
(
et
-
st
)
/
1000
;
...
...
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