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
ebfae502
Commit
ebfae502
authored
May 13, 2022
by
NzSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redo ParaEncoder and EncGroup.
parent
9d20a86f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
11 deletions
+14
-11
WW.js
src/WW.js
+1
-1
encGroup.js
src/encGroup.js
+2
-0
paraEncode.js
src/paraEncode.js
+10
-9
paraEncodeSpec.spec.js
tests/paraEncodeSpec.spec.js
+1
-1
No files found.
src/WW.js
View file @
ebfae502
import
{
makeMsg
,
MESSAGE_TYPE
,
typeOfMsg
}
from
'./encGrooupMsg'
;
import
{
makeMsg
,
MESSAGE_TYPE
,
typeOfMsg
}
from
'./encGrooupMsg'
;
import
{
Observable
,
filter
}
from
'
./
rxjs'
;
import
{
Observable
,
filter
}
from
'rxjs'
;
export
class
WWInitError
extends
Error
{
export
class
WWInitError
extends
Error
{
...
...
src/encGroup.js
View file @
ebfae502
...
@@ -77,6 +77,8 @@ export class H264EncWWGroup extends WWGroup {
...
@@ -77,6 +77,8 @@ export class H264EncWWGroup extends WWGroup {
this
.
#
numOfWorkers
=
numOfWW
;
this
.
#
numOfWorkers
=
numOfWW
;
this
.
#
numOfEncWorker
=
this
.
#
numOfWorkers
-
1
;
this
.
#
numOfEncWorker
=
this
.
#
numOfWorkers
-
1
;
console
.
log
(
this
.
#
numOfEncWorker
);
}
}
// H264EncWWGroup has two types of workers:
// H264EncWWGroup has two types of workers:
...
...
src/paraEncode.js
View file @
ebfae502
...
@@ -16,11 +16,12 @@ export class ParaEncoder {
...
@@ -16,11 +16,12 @@ export class ParaEncoder {
#
mode
=
undefined
#
mode
=
undefined
#
grp
=
null
;
#
grp
=
null
;
#
options
constructor
(
numOfWW
,
codec
,
mode
)
{
constructor
(
numOfWW
,
options
)
{
if
(
typeof
(
numOfWW
)
!=
'number'
||
if
(
typeof
(
numOfWW
)
!=
'number'
||
!
(
codec
in
ENC_GRPS
)
||
(
!
(
'codec'
in
options
)
||
!
(
options
[
'codec'
]
in
ENC_GRPS
)
)
||
!
isInObj
(
ENCODE_MODE
,
mode
))
{
!
(
'config'
in
options
))
{
throw
new
TypeError
(
throw
new
TypeError
(
"Mismatch types parameter"
,
"paraEncode.js"
);
"Mismatch types parameter"
,
"paraEncode.js"
);
...
@@ -28,12 +29,12 @@ export class ParaEncoder {
...
@@ -28,12 +29,12 @@ export class ParaEncoder {
this
.
#
numOfWW
=
numOfWW
;
this
.
#
numOfWW
=
numOfWW
;
this
.
#
codec
=
codec
;
this
.
#
codec
=
options
.
codec
;
this
.
#
mode
=
mode
;
this
.
#
options
=
options
;
}
}
async
init
()
{
async
init
()
{
this
.
#
grp
=
new
ENC_GRPS
[
codec
](
"ENCs"
,
{}
);
this
.
#
grp
=
new
ENC_GRPS
[
this
.
#
codec
](
"ENCs"
,
this
.
#
numOfWW
,
this
.
#
options
.
config
);
await
this
.
#
grp
.
start
();
await
this
.
#
grp
.
start
();
}
}
...
@@ -56,15 +57,15 @@ export class ParaEncoder {
...
@@ -56,15 +57,15 @@ export class ParaEncoder {
* pixels can be null which means there are no more frames to encode,
* pixels can be null which means there are no more frames to encode,
* after that encoder will rejected any pixels.
* after that encoder will rejected any pixels.
* */
* */
encode
(
pixels
)
{
async
encode
(
pixels
)
{
NEED_TO_IMPLEMENT
(
);
await
this
.
#
grp
.
dispatch
(
pixels
);
}
}
/* Does all frames provide to Encoder be encoded.
/* Does all frames provide to Encoder be encoded.
*
*
* Note: isDone() alwasy return false before eof. */
* Note: isDone() alwasy return false before eof. */
isDone
()
{
isDone
()
{
NEED_TO_IMPLEMENT
();
return
this
.
#
grp
.
isDone
();
}
}
}
}
tests/paraEncodeSpec.spec.js
View file @
ebfae502
...
@@ -7,7 +7,7 @@ const RGBAFrameSize = 1920*1080*4;
...
@@ -7,7 +7,7 @@ const RGBAFrameSize = 1920*1080*4;
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
paraEnc
=
new
ParaEncoder
(
11
,
{
paraEnc
=
new
ParaEncoder
(
11
,
{
codec
:
"H264"
,
codec
:
"H264"
,
grpcf
g
:
{
confi
g
:
{
encchnlsize
:
RGBAFrameSize
*
10
,
encchnlsize
:
RGBAFrameSize
*
10
,
bridgechnlsize
:
Math
.
pow
(
2
,
25
),
bridgechnlsize
:
Math
.
pow
(
2
,
25
),
}
}
...
...
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