Commit 69150b38 authored by NzSN's avatar NzSN

Flush encoder in EOFProcessing

parent ae3cc906
...@@ -161,17 +161,14 @@ async function steps() { ...@@ -161,17 +161,14 @@ async function steps() {
async function EOFProcessing() { async function EOFProcessing() {
let ret = 0, size_; let ret = 0, size_;
console.log(ident + " EOF"); encoder._flushEncoder();
while (true) { while (true) {
ret = encoder._getPackets(encBuf, ENC_BUF_SIZE, size); ret = encoder._getPackets(encBuf, ENC_BUF_SIZE, size);
size_ = encoder.getValue(size, 'i32'); size_ = encoder.getValue(size, 'i32');
if (ret == 1) { if (size_ == 0) {
/* No more frames here */
break; break;
} else if (ret > 0) {
throw new Error("Encoder internal error")
} }
sendToMuxerUntilSuccess(size_, 500); sendToMuxerUntilSuccess(size_, 500);
...@@ -214,6 +211,7 @@ async function RGBProcessing(frame) { ...@@ -214,6 +211,7 @@ async function RGBProcessing(frame) {
// Unit of interval is millionsecond // Unit of interval is millionsecond
async function sendToMuxerUntilSuccess(size, interval) { async function sendToMuxerUntilSuccess(size, interval) {
console.log("Send to Muxer");
while (!sendToMuxer(size)) { while (!sendToMuxer(size)) {
await sleep(interval); await sleep(interval);
} }
......
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