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
5c4c8fc3
Commit
5c4c8fc3
authored
May 16, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ed7a15b7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
13 deletions
+39
-13
muxer.c
src/wasms/muxer.c
+26
-0
paraEncodeSpec.spec.js
tests/paraEncodeSpec.spec.js
+13
-13
No files found.
src/wasms/muxer.c
View file @
5c4c8fc3
...
...
@@ -39,6 +39,11 @@ static List *protos;
static
List
*
ctxs
;
static
PktBuffer
*
pktBuffer
;
static
int
framerate
=
30
;
static
int
timescale
=
90000
;
static
int
duration
;
static
AVRational
tb
;
void
protoNodeDestr
(
void
*
v
)
{
destroyMMProto
((
MMProto
**
)
&
v
);
}
...
...
@@ -49,6 +54,9 @@ void ctxNodeDestr(void *v) {
EM_PORT_API
(
int
)
muxInit
(
int
numOfStreams_
)
{
tb
=
av_make_q
(
1
,
timescale
);
duration
=
timescale
/
framerate
;
numOfStreams
=
numOfStreams_
;
protos
=
createList
();
...
...
@@ -180,6 +188,23 @@ int contextInitializes() {
return
OK
;
}
void
pktTimestampSetup
(
AVPacket
*
pkt
)
{
static
int
idx
=
0
;
int
pts
=
idx
*
duration
,
dts
=
(
idx
-
1
)
*
duration
;
pkt
->
pts
=
idx
*
duration
;
pkt
->
dts
=
(
idx
-
1
)
*
duration
;
pkt
->
duration
=
duration
;
pkt
->
stream_index
=
0
;
pkt
->
pos
=
-
1
;
printf
(
"PTS: %ld, DTS: %ld
\n
"
,
pkt
->
pts
,
pkt
->
dts
);
++
idx
;
}
int
writeToOFormat
()
{
int
i
=
inProcContext
;
...
...
@@ -199,6 +224,7 @@ int writeToOFormat() {
goto
NEXT
;
}
pktTimestampSetup
(
pkt
);
streamWriteFrame
(
octx
,
pkt
);
printf
(
"Writed
\n
"
);
...
...
tests/paraEncodeSpec.spec.js
View file @
5c4c8fc3
...
...
@@ -4,25 +4,25 @@ import { sleep, waitCond } from "../src/utils.js";
let
paraEnc
;
const
RGBAFrameSize
=
1920
*
1080
*
4
;
//
beforeEach(async () => {
//
let trNum = navigator.hardwareConcurrency;
//
paraEnc = new ParaEncoder(trNum, {
//
codec: "H264",
//
config: {
//
encchnlsize: RGBAFrameSize * 10,
//
bridgechnlsize: Math.pow(2, 25),
//
}
//
});
//
await paraEnc.init();
//
}, 20000);
beforeEach
(
async
()
=>
{
let
trNum
=
navigator
.
hardwareConcurrency
;
paraEnc
=
new
ParaEncoder
(
trNum
,
{
codec
:
"H264"
,
config
:
{
encchnlsize
:
RGBAFrameSize
*
10
,
bridgechnlsize
:
Math
.
pow
(
2
,
25
),
}
});
await
paraEnc
.
init
();
},
20000
);
describe
(
"ParaEncoder"
,
()
=>
{
x
it
(
"Encode With ParaEncoder"
,
async
()
=>
{
f
it
(
"Encode With ParaEncoder"
,
async
()
=>
{
const
data
=
new
Uint8Array
([...
Array
(
RGBAFrameSize
).
keys
()]);
let
st
=
new
Date
();
for
(
let
i
=
0
;
i
<
300
0
;
++
i
)
{
for
(
let
i
=
0
;
i
<
300
;
++
i
)
{
await
paraEnc
.
encode
(
data
);
}
...
...
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