Commit 3b9f2fe9 authored by Linshizhi's avatar Linshizhi

Shorter loop sleep interval

parent 42a3c80a
......@@ -9,12 +9,14 @@ let wasmMem = null;
let size = null;
let eof = false;
let elapsed = 0;
// Number of bytes for each read
// from channel
const RGBFrameSize = 1920*1080*4;
let READ_SIZE = RGBFrameSize;
const SLEEP_INTERVAL = 100;
const SPIN_TIMEOUT = 500;
const SPIN_TIMEOUT = 30;
const ENC_BUF_SIZE = RGBFrameSize * 10
let encBuf = null;
......@@ -171,7 +173,7 @@ async function EOFProcessing() {
break;
}
sendToMuxerUntilSuccess(size_, 500);
sendToMuxerUntilSuccess(size_, 30);
}
// Notify muxer this stream is all transfered.
......@@ -195,7 +197,10 @@ async function RGBProcessing(frame) {
size_ = encoder.getValue(size, 'i32');
et = new Date();
console.log("Encode with elapsed: " + (et - st));
let timeDiff = (et -st) / 1000;
elapsed += timeDiff;
console.log("Encode with elapsed: " + timeDiff);
console.log("Encode Total: " + elapsed);
if (size_ == 0)
return true;
......@@ -206,7 +211,7 @@ async function RGBProcessing(frame) {
throw new Error("Unknown error");
}
await sendToMuxerUntilSuccess(size_, 300);
await sendToMuxerUntilSuccess(size_, 30);
return true;
}
......
......@@ -16,7 +16,7 @@ let done = false;
let inExec = false;
// Constants
const SLEEP_INTERVAL = 100;
const SLEEP_INTERVAL = 30;
const SPIN_TIMEOUT = 100000;
// WASM Objects
......
......@@ -160,7 +160,7 @@ export class H264EncWWGroup extends WWGroup {
}
while (this.#channels[this.#curProcWW].push(rgbFrame) == false) {
await sleep(300);
await sleep(50);
}
if (!this.#channels[this.#curProcWW].isSetPriv(PRIV_FLAGS.EXECUTING)) {
......
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