fix(stream): bound FFmpeg memory buffers and propagate Blob backpressure

This commit is contained in:
Levi committed 2026-09-13 18:24:32 +08:00
1 parent 637004c8a8
commit 5d83e91ce5
10 files changed
+142 -125

No files matched your search

+8 -5
View File
@@ -764,11 +764,14 @@
return;
}
const chunk = value instanceof Uint8Array ? value : new Uint8Array(value);
const buffer = chunk.buffer.slice(chunk.byteOffset, chunk.byteOffset + chunk.byteLength);
if (!globalThis.__gopeed_blob_pipe_chunk(pipeId, buffer)) {
state.cancelRequested = true;
state.cancelReason = "blob pipe closed";
return;
for (let offset = 0; offset < chunk.byteLength; offset += 256 * 1024) {
const part = chunk.subarray(offset, offset + 256 * 1024);
const buffer = part.buffer.slice(part.byteOffset, part.byteOffset + part.byteLength);
if (!await globalThis.__gopeed_blob_pipe_chunk(pipeId, buffer)) {
state.cancelRequested = true;
state.cancelReason = "blob pipe closed";
return;
}
}
await yieldBlobPipeTask();
}