Prevent full datachannel buffer on file end

This commit is contained in:
schlagmichdoch 2024-02-05 04:03:12 +01:00
parent 91fc2b7bf5
commit cfe5b4afda

View file

@ -1564,7 +1564,7 @@ class FileChunker {
}
_readChunk() {
if (this._currentlySending) return;
if (this._currentlySending || this._isFileEnd()) return;
this._currentlySending = true;
const chunk = this._file.slice(this._bytesSent, this._bytesSent + this._chunkSize);
@ -1606,6 +1606,8 @@ class FileChunkerRTC extends FileChunker {
}
_onChunkRead(chunk) {
if (!chunk.byteLength) return;
this._currentlySending = false;
this._onChunk(chunk);