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
fc687dec
Commit
fc687dec
authored
May 09, 2022
by
NzSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
69150b38
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
71 deletions
+65
-71
karma.conf.js
karma.conf.js
+2
-0
muxWW.js
resources/workers/muxWW.js
+9
-2
encGroup.js
src/encGroup.js
+2
-2
interfaces.cc
src/wasms/interfaces.cc
+40
-56
ENCH264Group.spec.js
tests/ENCH264Group.spec.js
+3
-2
wasm-build.sh
wasm-build.sh
+9
-9
No files found.
karma.conf.js
View file @
fc687dec
...
@@ -22,6 +22,7 @@ module.exports = function(config) {
...
@@ -22,6 +22,7 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
// list of files / patterns to load in the browser
files
:
[
files
:
[
{
pattern
:
'./temp.debug.wasm'
,
included
:
false
,
served
:
true
},
{
pattern
:
'src/**/*.js'
,
included
:
false
,
served
:
true
},
{
pattern
:
'src/**/*.js'
,
included
:
false
,
served
:
true
},
{
pattern
:
'tests/**/*.js'
,
included
:
true
},
{
pattern
:
'tests/**/*.js'
,
included
:
true
},
{
pattern
:
'resources/**/*.js'
,
included
:
false
,
served
:
true
},
{
pattern
:
'resources/**/*.js'
,
included
:
false
,
served
:
true
},
...
@@ -35,6 +36,7 @@ module.exports = function(config) {
...
@@ -35,6 +36,7 @@ module.exports = function(config) {
'/src'
:
'/base/src/'
,
'/src'
:
'/base/src/'
,
'/resources'
:
'/base/resources/'
,
'/resources'
:
'/base/resources/'
,
'/workers'
:
'/base/tests/workers/'
,
'/workers'
:
'/base/tests/workers/'
,
'/temp.debug.wasm'
:
'/base/temp.debug.wasm'
},
},
// preprocess matching files before serving them to the browser
// preprocess matching files before serving them to the browser
...
...
resources/workers/muxWW.js
View file @
fc687dec
...
@@ -13,6 +13,8 @@ let eof = [];
...
@@ -13,6 +13,8 @@ let eof = [];
let
eofCount
=
0
;
let
eofCount
=
0
;
let
done
=
false
;
let
done
=
false
;
let
inExec
=
false
;
// Constants
// Constants
const
SLEEP_INTERVAL
=
100
;
const
SLEEP_INTERVAL
=
100
;
const
SPIN_TIMEOUT
=
100000
;
const
SPIN_TIMEOUT
=
100000
;
...
@@ -51,7 +53,7 @@ async function main(msg) {
...
@@ -51,7 +53,7 @@ async function main(msg) {
if
(
isBridged
)
await
deBridging
();
if
(
isBridged
)
await
deBridging
();
break
;
break
;
case
MESSAGE_TYPE
.
DATA
:
case
MESSAGE_TYPE
.
DATA
:
await
steps
();
if
(
!
inExec
)
await
steps
();
break
;
break
;
case
MESSAGE_TYPE
.
DESTROY
:
case
MESSAGE_TYPE
.
DESTROY
:
if
(
isInited
)
await
destroy
();
if
(
isInited
)
await
destroy
();
...
@@ -136,7 +138,7 @@ async function step() {
...
@@ -136,7 +138,7 @@ async function step() {
continue
;
continue
;
}
}
console
.
log
(
"MUXWW Push to "
+
i
);
console
.
log
(
"MUXWW Push to "
+
i
+
" with length "
+
data
.
byteLength
);
/* Write data into wasm */
/* Write data into wasm */
muxBuffer
=
muxer
.
_malloc
(
data
.
byteLength
);
muxBuffer
=
muxer
.
_malloc
(
data
.
byteLength
);
...
@@ -152,6 +154,9 @@ async function step() {
...
@@ -152,6 +154,9 @@ async function step() {
}
}
async
function
steps
()
{
async
function
steps
()
{
inExec
=
true
;
while
(
await
step
())
{
while
(
await
step
())
{
console
.
log
(
"Done: "
+
done
);
console
.
log
(
"Done: "
+
done
);
if
(
done
)
if
(
done
)
...
@@ -162,4 +167,6 @@ async function steps() {
...
@@ -162,4 +167,6 @@ async function steps() {
// Notify to main thread that all frames
// Notify to main thread that all frames
// has been written into format.
// has been written into format.
postMessage
(
makeMsg
(
MESSAGE_TYPE
.
DONE
,
{}));
postMessage
(
makeMsg
(
MESSAGE_TYPE
.
DONE
,
{}));
inExec
=
false
;
}
}
src/encGroup.js
View file @
fc687dec
...
@@ -160,9 +160,9 @@ export class H264EncWWGroup extends WWGroup {
...
@@ -160,9 +160,9 @@ export class H264EncWWGroup extends WWGroup {
console
.
log
(
"Proc WW is "
+
this
.
#
encWorkers
[
this
.
#
curProcWW
].
ident
());
console
.
log
(
"Proc WW is "
+
this
.
#
encWorkers
[
this
.
#
curProcWW
].
ident
());
// Null is treated as terminated
// Null is treated as terminated frame.
// frame.
if
(
rgbFrame
==
null
)
{
if
(
rgbFrame
==
null
)
{
console
.
log
(
"EOF"
);
for
(
let
i
=
0
;
i
<
this
.
#
numOfEncWorker
;
++
i
)
{
for
(
let
i
=
0
;
i
<
this
.
#
numOfEncWorker
;
++
i
)
{
this
.
#
channels
[
i
].
setPriv
(
PRIV_FLAGS
.
EOF
);
this
.
#
channels
[
i
].
setPriv
(
PRIV_FLAGS
.
EOF
);
}
}
...
...
src/wasms/interfaces.cc
View file @
fc687dec
...
@@ -250,6 +250,8 @@ using IOEndpoint = IOProto::MovMemProto::MovMemProto;
...
@@ -250,6 +250,8 @@ using IOEndpoint = IOProto::MovMemProto::MovMemProto;
namespace
MuxEnv
{
namespace
MuxEnv
{
size_t
numOfPackets_
;
class
PacketBuffer
{
class
PacketBuffer
{
public
:
public
:
using
PacketChain
=
std
::
queue
<
AVPacket
*>
;
using
PacketChain
=
std
::
queue
<
AVPacket
*>
;
...
@@ -264,7 +266,7 @@ public:
...
@@ -264,7 +266,7 @@ public:
void
push
(
int
idx
,
AVPacket
*
packet
)
{
void
push
(
int
idx
,
AVPacket
*
packet
)
{
printf
(
"PacketBuffer: Push
\n
"
);
printf
(
"PacketBuffer: Push
\n
"
);
packets
[
idx
].
push
(
packet
);
packets
[
idx
].
push
(
packet
);
printf
(
"size of packet in %d is %lu
\n
"
,
idx
,
packets
[
idx
].
size
())
;
++
numOfPackets_
;
}
}
AVPacket
*
pop
(
int
idx
)
{
AVPacket
*
pop
(
int
idx
)
{
...
@@ -276,6 +278,7 @@ public:
...
@@ -276,6 +278,7 @@ public:
auto
pkt
=
chain
.
front
();
auto
pkt
=
chain
.
front
();
chain
.
pop
();
chain
.
pop
();
numOfPackets_
--
;
return
pkt
;
return
pkt
;
}
}
...
@@ -283,18 +286,23 @@ public:
...
@@ -283,18 +286,23 @@ public:
return
packets
[
idx
].
size
();
return
packets
[
idx
].
size
();
}
}
int
numOfPkts
()
{
return
numOfPackets_
;
}
private
:
private
:
std
::
vector
<
PacketChain
>
packets
;
std
::
vector
<
PacketChain
>
packets
;
};
};
bool
ioCtxInited
=
false
;
bool
ioCtxInited
=
false
;
int
numOfStreams
=
0
;
int
numOfStreams
=
0
;
int
numOfStreams1
=
0
;
PacketBuffer
pktBuffer
;
PacketBuffer
pktBuffer
;
int
finishedCount
=
0
;
int
finishedCount
=
0
;
int
initedCount
=
0
;
int
initedCount
=
0
;
std
::
shared_ptr
<
bool
[]
>
finished
;
bool
*
finished
;
std
::
shared_ptr
<
bool
[]
>
inited
;
bool
*
inited
;
std
::
shared_ptr
<
bool
[]
>
failed
;
bool
*
failed
;
bool
oCtxInited
=
false
;
bool
oCtxInited
=
false
;
std
::
vector
<
IOEndpoint
>
protos
;
std
::
vector
<
IOEndpoint
>
protos
;
IOCtx
::
InCtx
**
ctxs
=
nullptr
;
IOCtx
::
InCtx
**
ctxs
=
nullptr
;
...
@@ -317,13 +325,15 @@ EM_PORT_API(int) muxInit(int numOfStreams) {
...
@@ -317,13 +325,15 @@ EM_PORT_API(int) muxInit(int numOfStreams) {
// Setup MuxEnv Status
// Setup MuxEnv Status
MuxEnv
::
numOfStreams
=
numOfStreams
;
MuxEnv
::
numOfStreams
=
numOfStreams
;
MuxEnv
::
pktBuffer
=
MuxEnv
::
PacketBuffer
(
numOfStreams
);
MuxEnv
::
numOfStreams1
=
numOfStreams
;
MuxEnv
::
finished
=
std
::
shared_ptr
<
bool
[]
>
(
new
bool
[
numOfStreams
]{
false
});
printf
(
"Numb of Streams %d
\n
"
,
MuxEnv
::
numOfStreams
);
MuxEnv
::
inited
=
std
::
shared_ptr
<
bool
[]
>
(
new
bool
[
numOfStreams
]{
false
});
MuxEnv
::
failed
=
std
::
shared_ptr
<
bool
[]
>
(
new
bool
[
numOfStreams
]{
false
});
MuxEnv
::
pktBuffer
=
MuxEnv
::
PacketBuffer
(
MuxEnv
::
numOfStreams
);
MuxEnv
::
finished
=
new
bool
[
MuxEnv
::
numOfStreams
]{
false
};
MuxEnv
::
inited
=
new
bool
[
MuxEnv
::
numOfStreams
]{
false
};
MuxEnv
::
failed
=
new
bool
[
MuxEnv
::
numOfStreams
]{
false
};
MuxEnv
::
ctxs
=
(
IOCtx
::
InCtx
**
)
malloc
(
sizeof
(
IOCtx
::
InCtx
*
));
MuxEnv
::
ctxs
=
(
IOCtx
::
InCtx
**
)
malloc
(
sizeof
(
IOCtx
::
InCtx
*
));
printf
(
"Numb of Streams %d
\n
"
,
numOfStreams
);
for
(
int
i
=
0
;
i
<
numOfStreams
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numOfStreams
;
++
i
)
{
...
@@ -335,8 +345,8 @@ EM_PORT_API(int) muxInit(int numOfStreams) {
...
@@ -335,8 +345,8 @@ EM_PORT_API(int) muxInit(int numOfStreams) {
}
}
EM_PORT_API
(
int
)
muxPush
(
int
sIdx
,
uint8_t
*
data
,
size_t
size
)
{
EM_PORT_API
(
int
)
muxPush
(
int
sIdx
,
uint8_t
*
data
,
size_t
size
)
{
printf
(
"
Push to %d in wasm
\n
"
,
sIdx
);
printf
(
"
MUX WASM: Push to proto %d: %p,%ld
\n
"
,
sIdx
,
data
,
size
);
MuxEnv
::
protos
[
sIdx
].
push
(
data
,
size
);
MuxEnv
::
protos
[
sIdx
%
MuxEnv
::
numOfStreams1
].
push
(
data
,
size
);
return
0
;
return
0
;
}
}
...
@@ -352,18 +362,14 @@ int bufferPackets() {
...
@@ -352,18 +362,14 @@ int bufferPackets() {
for
(
int
i
=
0
;
i
<
MuxEnv
::
numOfStreams
;
++
i
)
{
for
(
int
i
=
0
;
i
<
MuxEnv
::
numOfStreams
;
++
i
)
{
if
(
MuxEnv
::
failed
[
i
]
||
MuxEnv
::
finished
[
i
]
||
!
MuxEnv
::
inited
[
i
])
{
if
(
MuxEnv
::
failed
[
i
]
||
MuxEnv
::
finished
[
i
]
||
!
MuxEnv
::
inited
[
i
])
{
printf
(
"SKIP %d
\n
"
,
i
);
printf
(
"
WASM:
SKIP %d
\n
"
,
i
);
continue
;
continue
;
}
}
printf
(
"IOCTX %d in processing...
\n
"
,
i
);
IOCtx
::
InCtx
*
c
=
MuxEnv
::
ctxs
[
i
];
IOCtx
::
InCtx
*
c
=
MuxEnv
::
ctxs
[
i
];
pkt
=
pkt
==
nullptr
?
av_packet_alloc
()
:
pkt
;
pkt
=
pkt
==
nullptr
?
av_packet_alloc
()
:
pkt
;
printf
(
"Read Frame...
\n
"
);
ret
=
c
->
readFrame_
(
pkt
);
ret
=
c
->
readFrame_
(
pkt
);
printf
(
"Read Frame...Done
\n
"
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
if
(
ret
==
AVERROR_EOF
)
{
if
(
ret
==
AVERROR_EOF
)
{
MuxEnv
::
finishedCount
++
;
MuxEnv
::
finishedCount
++
;
...
@@ -372,31 +378,25 @@ int bufferPackets() {
...
@@ -372,31 +378,25 @@ int bufferPackets() {
printf
(
"WASM: EOF %d
\n
"
,
i
);
printf
(
"WASM: EOF %d
\n
"
,
i
);
if
(
MuxEnv
::
finishedCount
==
MuxEnv
::
numOfStreams
)
{
if
(
MuxEnv
::
finishedCount
==
MuxEnv
::
numOfStreams
)
{
printf
(
"ALL STREAM EOF DONE
\n
"
);
AVPacket
*
nullpkt
=
av_packet_alloc
();
AVPacket
*
nullpkt
=
av_packet_alloc
();
nullpkt
->
data
=
nullptr
;
nullpkt
->
data
=
nullptr
;
nullpkt
->
size
=
0
;
nullpkt
->
size
=
0
;
MuxEnv
::
finished
[
i
]
=
false
;
MuxEnv
::
finished
[
i
]
=
false
;
MuxEnv
::
pktBuffer
.
push
(
i
,
nullpkt
);
//
MuxEnv::pktBuffer.push(i, nullpkt);
}
}
goto
END_LOOP
;
goto
END_LOOP
;
}
else
if
(
ret
==
AVERROR
(
EAGAIN
))
{
}
else
if
(
ret
!=
AVERROR
(
EAGAIN
))
{
printf
(
"READ AGAIN
\n
"
);
}
else
{
MuxEnv
::
failed
[
i
]
=
true
;
MuxEnv
::
failed
[
i
]
=
true
;
printf
(
"Failed
\n
"
);
}
}
continue
;
continue
;
}
}
printf
(
"PKT SIZE %d
\n
"
,
pkt
->
size
);
printf
(
"BUFFER PACKET
\n
"
);
printf
(
"Buffer into buffer %d
\n
"
,
i
);
MuxEnv
::
pktBuffer
.
push
(
i
,
pkt
);
MuxEnv
::
pktBuffer
.
push
(
i
,
pkt
);
printf
(
"Buffer into buffer %d Done
\n
"
,
i
);
pkt
=
nullptr
;
pkt
=
nullptr
;
++
readed
;
++
readed
;
...
@@ -424,7 +424,6 @@ void ioCtxInitialize() {
...
@@ -424,7 +424,6 @@ void ioCtxInitialize() {
for
(
int
i
=
0
;
i
<
MuxEnv
::
numOfStreams
;
++
i
)
{
for
(
int
i
=
0
;
i
<
MuxEnv
::
numOfStreams
;
++
i
)
{
printf
(
"Size of Buffer %d: %ld
\n
"
,
i
,
MuxEnv
::
protos
[
i
].
size
());
// IOProto require 20KB to probe stream informations.
// IOProto require 20KB to probe stream informations.
if
(
!
MuxEnv
::
inited
[
i
]
&&
MuxEnv
::
protos
[
i
].
size
()
>
25000
)
{
if
(
!
MuxEnv
::
inited
[
i
]
&&
MuxEnv
::
protos
[
i
].
size
()
>
25000
)
{
...
@@ -432,27 +431,15 @@ void ioCtxInitialize() {
...
@@ -432,27 +431,15 @@ void ioCtxInitialize() {
MuxEnv
::
inited
[
i
]
=
true
;
MuxEnv
::
inited
[
i
]
=
true
;
if
(
!
MuxEnv
::
oCtxInited
)
{
if
(
!
MuxEnv
::
oCtxInited
)
{
printf
(
"Inited Output
\n
"
);
AVStream
*
s
=
MuxEnv
::
ctxs
[
i
]
->
getStream
([](
AVStream
*
s
)
{
AVStream
*
s
=
MuxEnv
::
ctxs
[
i
]
->
getStream
([](
AVStream
*
s
)
{
return
s
->
codecpar
->
codec_type
==
AVMEDIA_TYPE_VIDEO
;
return
s
->
codecpar
->
codec_type
==
AVMEDIA_TYPE_VIDEO
;
});
});
if
(
s
==
nullptr
)
{
printf
(
"Failed to got stream
\n
"
);
}
printf
(
"Stream got
\n
"
);
printf
(
"New Stream...
\n
"
);
MuxEnv
::
oCtx
.
newStream
(
s
->
codecpar
);
MuxEnv
::
oCtx
.
newStream
(
s
->
codecpar
);
printf
(
"New Stream...Done
\n
"
);
printf
(
"Write Header....
\n
"
);
MuxEnv
::
oCtx
.
writeHeader
();
MuxEnv
::
oCtx
.
writeHeader
();
printf
(
"Write Header....Done
\n
"
);
}
}
printf
(
"INIT
DONE:
%d
\n
"
,
i
);
printf
(
"INIT %d
\n
"
,
i
);
++
MuxEnv
::
initedCount
;
++
MuxEnv
::
initedCount
;
}
}
}
}
...
@@ -488,12 +475,16 @@ int writeToOutput() {
...
@@ -488,12 +475,16 @@ int writeToOutput() {
while
(
true
)
{
while
(
true
)
{
AVPacket
*
p
=
MuxEnv
::
pktBuffer
.
pop
(
i
);
AVPacket
*
p
=
MuxEnv
::
pktBuffer
.
pop
(
i
);
return
0
;
printf
(
"WriteToOutput(): Index %d
\n
"
,
i
);
if
(
p
==
nullptr
)
if
(
p
==
nullptr
)
if
(
MuxEnv
::
finished
[
i
])
{
if
(
MuxEnv
::
finished
[
i
])
{
printf
(
"
SKIP Cause of FIN %d
\n
"
,
i
);
printf
(
"
WriteToOutput(): Fin
\n
"
);
goto
NEXT
;
goto
NEXT
;
}
else
{
}
else
{
printf
(
"
P is nullptr in %d
\n
"
,
i
);
printf
(
"
WriteToOutput(): END LOOP
\n
"
);
goto
END_LOOP
;
goto
END_LOOP
;
}
}
else
if
(
p
->
data
==
nullptr
&&
p
->
size
==
0
)
{
else
if
(
p
->
data
==
nullptr
&&
p
->
size
==
0
)
{
...
@@ -504,8 +495,8 @@ int writeToOutput() {
...
@@ -504,8 +495,8 @@ int writeToOutput() {
timestampSetup
(
p
);
timestampSetup
(
p
);
// Write to output context
// Write to output context
MuxEnv
::
oCtx
.
writeFrame
(
p
);
//
MuxEnv::oCtx.writeFrame(p);
printf
(
"Write
Done %d
\n
"
,
i
);
printf
(
"Write
ToOutput(): Index %d...Done
\n
"
,
i
);
// Cleaning
// Cleaning
av_packet_free
(
&
p
);
av_packet_free
(
&
p
);
...
@@ -515,16 +506,10 @@ int writeToOutput() {
...
@@ -515,16 +506,10 @@ int writeToOutput() {
}
}
END_LOOP
:
END_LOOP
:
printf
(
"SKIP %d
\n
"
,
i
);
MuxEnv
::
currentChannel
=
i
;
MuxEnv
::
currentChannel
=
i
;
return
0
;
return
0
;
MUX_DONE
:
MUX_DONE
:
printf
(
"WASM MUXER DONE
\n
"
);
for
(
int
i
=
0
;
i
<
MuxEnv
::
numOfStreams
;
++
i
)
{
printf
(
"Remain in Proto %d is %zu
\n
"
,
i
,
MuxEnv
::
protos
[
i
].
size
());
printf
(
"Remain in packet buffer %d is %d
\n\n
"
,
i
,
MuxEnv
::
pktBuffer
.
size
(
i
));
}
MuxEnv
::
done
=
true
;
MuxEnv
::
done
=
true
;
MuxEnv
::
oCtx
.
writeTrailer
();
MuxEnv
::
oCtx
.
writeTrailer
();
...
@@ -533,22 +518,21 @@ int writeToOutput() {
...
@@ -533,22 +518,21 @@ int writeToOutput() {
EM_PORT_API
(
int
)
muxStep
()
{
EM_PORT_API
(
int
)
muxStep
()
{
printf
(
"Step Buffer
\n
"
);
// Buffer Encoded frames from
// Buffer Encoded frames from
// Encoder into 'MuxEnv::pktBuffer'
// Encoder into 'MuxEnv::pktBuffer'
bufferPackets
();
bufferPackets
();
printf
(
"
Init
\n
"
);
printf
(
"
%d packets are buffered
\n
"
,
MuxEnv
::
pktBuffer
.
numOfPkts
()
);
// Initialize IOCtx
// Initialize IOCtx
if
(
MuxEnv
::
initedCount
<
MuxEnv
::
numOfStreams
)
if
(
MuxEnv
::
initedCount
<
MuxEnv
::
numOfStreams
)
ioCtxInitialize
();
ioCtxInitialize
();
printf
(
"WriteOut
\n
"
);
if
(
MuxEnv
::
initedCount
==
MuxEnv
::
numOfStreams
)
// Try to write to output file
// Try to write to output file
return
writeToOutput
();
return
writeToOutput
();
else
return
0
;
}
}
EM_PORT_API
(
int
)
isDone
()
{
EM_PORT_API
(
int
)
isDone
()
{
...
...
tests/ENCH264Group.spec.js
View file @
fc687dec
...
@@ -9,14 +9,13 @@ describe("H264EncWWGroup Spec", () => {
...
@@ -9,14 +9,13 @@ describe("H264EncWWGroup Spec", () => {
await
sleep
(
1000
);
await
sleep
(
1000
);
expect
(
wg
.
numOfWorker
()).
toBe
(
2
);
expect
(
wg
.
numOfWorker
()).
toBe
(
2
);
});
});
fit
(
"Encode by H264EncWWGroup Spec"
,
async
()
=>
{
fit
(
"Encode by H264EncWWGroup Spec"
,
async
()
=>
{
const
RGBAFrameSize
=
1920
*
1080
*
4
;
const
RGBAFrameSize
=
1920
*
1080
*
4
;
let
grp
=
new
H264EncWWGroup
(
"h264enc"
,
{
let
grp
=
new
H264EncWWGroup
(
"h264enc"
,
{
numOfWW
:
2
,
numOfWW
:
8
,
encchnlsize
:
RGBAFrameSize
*
10
,
encchnlsize
:
RGBAFrameSize
*
10
,
bridgechnlsize
:
Math
.
pow
(
2
,
25
)
bridgechnlsize
:
Math
.
pow
(
2
,
25
)
});
});
...
@@ -29,6 +28,8 @@ describe("H264EncWWGroup Spec", () => {
...
@@ -29,6 +28,8 @@ describe("H264EncWWGroup Spec", () => {
await
grp
.
dispatch
(
data
);
await
grp
.
dispatch
(
data
);
}
}
console
.
log
(
"Main Done"
);
// Terminated
// Terminated
await
grp
.
dispatch
(
null
);
await
grp
.
dispatch
(
null
);
...
...
wasm-build.sh
View file @
fc687dec
...
@@ -17,8 +17,8 @@ THIRD_DIR=${WORKPATH}/lib/third/build
...
@@ -17,8 +17,8 @@ THIRD_DIR=${WORKPATH}/lib/third/build
FFMPEG_PROTO
=
${
WORKPATH
}
/src/protos/src
FFMPEG_PROTO
=
${
WORKPATH
}
/src/protos/src
WASM_DIR
=
${
WORKPATH
}
/src/wasms
WASM_DIR
=
${
WORKPATH
}
/src/wasms
DEBUG
=
"-O2"
#
DEBUG="-O2"
#DEBUG="-O1 -g -fno-inline -gseparate-dwarf=./temp.debug.wasm -s SEPARATE_DWARF_URL=http://localhost:9678
/temp.debug.wasm"
DEBUG
=
"-g2 -gseparate-dwarf=./temp.debug.wasm -s SEPARATE_DWARF_URL=http://localhost:9876
/temp.debug.wasm"
BUILD_DIR
=
${
WORKPATH
}
/Build
BUILD_DIR
=
${
WORKPATH
}
/Build
...
@@ -81,12 +81,15 @@ else
...
@@ -81,12 +81,15 @@ else
fi
fi
FLAGS
=(
FLAGS
=(
-I
$BUILD_DIR
/include
-L
$BUILD_DIR
/lib
-I
$LIB_DIR
/ffmpeg.wasm-core
-
Wno-deprecated-declarations
-I
$BUILD_DIR
/include
-L
$BUILD_DIR
/lib
-I
$LIB_DIR
/ffmpeg.wasm-core
-
I
$LIB_DIR
/ffmpeg.protos/src
-Wno-pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-Wno-
deprecated-declarations
-Wno-
pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lx264
-lz
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lx264
-lz
-lshmproto
$WASM_DIR
/interfaces.cc
$WASM_DIR
/interfaces.cc
$LIB_DIR
/ffmpeg.protos/src/ioctx.cc
$LIB_DIR
/ffmpeg.protos/src/utils.cc
$LIB_DIR
/ffmpeg.protos/src/proto/movMemProto.cc
$LIB_DIR
/ffmpeg.protos/src/proto/proto.cc
-std
=
c++2a
-std
=
c++2a
-s
FORCE_FILESYSTEM
=
1
-s
FORCE_FILESYSTEM
=
1
...
@@ -98,10 +101,7 @@ FLAGS=(
...
@@ -98,10 +101,7 @@ FLAGS=(
-s
EXPORT_NAME
=
"createParaEncoder"
# assign export name for browser
-s
EXPORT_NAME
=
"createParaEncoder"
# assign export name for browser
-s
EXPORTED_FUNCTIONS
=
"[_main,_malloc,_free]"
# export main and proxy_main funcs
-s
EXPORTED_FUNCTIONS
=
"[_main,_malloc,_free]"
# export main and proxy_main funcs
-s
EXPORTED_RUNTIME_METHODS
=
"[FS, cwrap, ccall, setValue, writeAsciiToMemory, getValue]"
# export preamble funcs
-s
EXPORTED_RUNTIME_METHODS
=
"[FS, cwrap, ccall, setValue, writeAsciiToMemory, getValue]"
# export preamble funcs
-s
INITIAL_MEMORY
=
268435456
# 64 KB * 1024 * 16 * 2047 = 2146435072 bytes ~= 2 GB, 268435456 =256M, 134,217,728 =128M
-s
INITIAL_MEMORY
=
536870912
# 64 KB * 1024 * 16 * 2047 = 2146435072 bytes ~= 2 GB, 268435456 =256M, 134,217,728 =128M
-s
ASSERTIONS
=
2
-s
DEMANGLE_SUPPORT
=
1
-s
WARN_UNALIGNED
=
1
-s
SAFE_HEAP
=
1
-s
SAFE_HEAP
=
1
--pre-js
$WORKPATH
/pre.js
--pre-js
$WORKPATH
/pre.js
--post-js
$WORKPATH
/post.js
--post-js
$WORKPATH
/post.js
...
...
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