Commit dbd3435c authored by Linshizhi's avatar Linshizhi

update

parent e599e52c
import { assert, NEED_TO_IMPLEMENT } from './utils.js'; import { assert, NEED_TO_IMPLEMENT } from './utils.js';
class ChnlStepConflictError extends Error { export class ChnlStepConflictError extends Error {
constructor() { constructor() {
super("Channel Step error"); super("Channel Step error");
} }
......
...@@ -38,4 +38,36 @@ describe("H264EncWWGroup Spec", () => { ...@@ -38,4 +38,36 @@ describe("H264EncWWGroup Spec", () => {
grp.terminate(); grp.terminate();
}, 3000000) }, 3000000)
fit("Encode By H264EncWWGroup with direct write", async () => {
const RGBAFrameSize = 1920*1080*4;
let grp = new H264EncWWGroup("h264enc", 2, {
encchnlsize: RGBAFrameSize * 10,
bridgechnlsize: Math.pow(2, 25),
blockbased: true,
blocksize: RGBAFrameSize,
});
await grp.start();
const data = new Uint8Array([...Array(RGBAFrameSize).keys()]);
for (let i = 0; i < 30; ++i) {
let buffers = [];
while (true) {
buffers = grp.directWPrepare(RGBAFrameSize);
if (buffers > 0)
break;
else {
console.log("Sleep");
await sleep(30);
}
}
expect(buffers.length).toBe(1);
buffers[0].set(data, 0);
grp.directWConfirm();
}
grp.terminate();
}, 30000);
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment