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
ec7e8502
Commit
ec7e8502
authored
Apr 23, 2022
by
NzSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Channel
parent
01e1ab88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
15 deletions
+11
-15
encGroup.js
src/encGroup.js
+1
-3
WW.spec.js
tests/WW.spec.js
+0
-1
WWGroup.spec.js
tests/WWGroup.spec.js
+10
-11
No files found.
src/encGroup.js
View file @
ec7e8502
...
...
@@ -66,7 +66,7 @@ export class Channel {
// size's unit is byte
// bufferType parameter is mainly for testability.
constructor
(
WW
,
size
,
bufferType
=
SharedArrayBuffer
)
{
constructor
(
size
,
bufferType
=
SharedArrayBuffer
)
{
assert
(
size
>=
2
,
`Channel require its data area has at least 2 Bytes.`
)
...
...
@@ -86,8 +86,6 @@ export class Channel {
this
.
#
view
.
setUint32
(
0
,
this
.
#
metaSize
);
this
.
#
view
.
setUint32
(
4
,
this
.
#
metaSize
);
// FIXME: Need to transfer channel itself to worker.
}
#
readPos
()
{
...
...
tests/WW.spec.js
View file @
ec7e8502
import
{
firstValueFrom
}
from
'rxjs'
;
import
{
WW
}
from
'../src/WW.js'
;
...
...
tests/WWGroup.spec.js
View file @
ec7e8502
import
{
WW
}
from
'../src/WW.js'
;
import
{
H264EncWWGroup
,
Channel
}
from
'../src/encGroup.js'
;
import
{
H264EncWWGroup
,
Channel
,
CpySchedule
}
from
'../src/encGroup.js'
;
const
areEqual
=
(
first
,
second
)
=>
first
.
length
===
second
.
length
&&
...
...
@@ -11,8 +11,9 @@ function getRandomInt(max) {
}
describe
(
"Channel Spec"
,
()
=>
{
it
(
"Write datas bigger than channel"
,
()
=>
{
let
channel
=
new
Channel
(
WW
,
10
,
ArrayBuffer
);
let
channel
=
new
Channel
(
10
,
ArrayBuffer
);
// A buffer with length 11
let
buffer
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
0
,
1
]);
...
...
@@ -22,17 +23,17 @@ describe("Channel Spec", () => {
});
it
(
"Read Empty channel"
,
()
=>
{
let
channel
=
new
Channel
(
WW
,
10
,
ArrayBuffer
);
let
channel
=
new
Channel
(
10
,
ArrayBuffer
);
let
buffer
=
channel
.
readData
(
5
);
expect
(
buffer
.
byteLength
==
0
).
toBe
(
true
);
});
it
(
"Write Until Full"
,
()
=>
{
let
channel
=
new
Channel
(
WW
,
16
,
ArrayBuffer
);
let
channel
=
new
Channel
(
16
,
ArrayBuffer
);
});
it
(
"Write datas"
,
()
=>
{
let
channel
=
new
Channel
(
WW
,
10
,
ArrayBuffer
);
let
channel
=
new
Channel
(
10
,
ArrayBuffer
);
let
buffer
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
]);
let
ret
=
channel
.
push
(
buffer
);
...
...
@@ -44,7 +45,7 @@ describe("Channel Spec", () => {
});
it
(
"Write More Datas"
,
()
=>
{
let
channel
=
new
Channel
(
WW
,
10
,
ArrayBuffer
),
ret
=
true
,
let
channel
=
new
Channel
(
10
,
ArrayBuffer
),
ret
=
true
,
data
=
undefined
;
// Let read pointer move forward 5 bytes
...
...
@@ -63,7 +64,7 @@ describe("Channel Spec", () => {
});
it
(
"Write Until Full"
,
()
=>
{
let
channel
=
new
Channel
(
WW
,
1024
,
ArrayBuffer
);
let
channel
=
new
Channel
(
1024
,
ArrayBuffer
);
let
buffer
=
new
Uint8Array
([...
Array
(
1023
).
keys
()]);
let
ret
=
channel
.
push
(
buffer
);
...
...
@@ -85,7 +86,7 @@ describe("Channel Spec", () => {
let
ret
=
false
;
let
remainToWrite
=
Math
.
pow
(
2
,
15
),
readData
=
null
;
let
channel
=
new
Channel
(
WW
,
Math
.
pow
(
2
,
10
),
ArrayBuffer
);
let
channel
=
new
Channel
(
Math
.
pow
(
2
,
10
),
ArrayBuffer
);
while
(
remainToWrite
>
0
)
{
let
dataToWrite
=
new
Uint8Array
([...
Array
(
getRandomInt
(
Math
.
pow
(
2
,
10
)))]);
...
...
@@ -104,7 +105,7 @@ describe("Channel Spec", () => {
})
it
(
"2 Bytes Channel"
,
()
=>
{
let
channel
=
new
Channel
(
WW
,
2
,
ArrayBuffer
);
let
channel
=
new
Channel
(
2
,
ArrayBuffer
);
let
buffer
=
new
Uint8Array
([
3
]);
let
ret
=
channel
.
push
(
buffer
);
...
...
@@ -119,11 +120,9 @@ describe("Channel Spec", () => {
expect
(
areEqual
(
buffer
,
data
)).
toBe
(
true
);
expect
(
channel
.
isEmpty
()).
toBe
(
true
);
});
});
describe
(
"H264EncWWGroup Spec"
,
()
=>
{
it
(
"Instantiation"
,
async
()
=>
{
let
wg
=
new
H264EncWWGroup
(
"h264enc"
,
{
numOfWW
:
3
});
await
wg
.
start
();
...
...
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