Skip to content

How to solve the problem of bufferedAmount being full #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kingtonlee opened this issue May 11, 2024 · 0 comments
Open

How to solve the problem of bufferedAmount being full #143

kingtonlee opened this issue May 11, 2024 · 0 comments

Comments

@kingtonlee
Copy link

How to implement the following code using Java. When the bufferedAmount changes, onBufferedAmountChange is not executed, and the bufferedAmount cannot be reduced. It always remains at the critical value of 16M.

const send = () => {
while (buffer.byteLength) {
if (dataChannel.bufferedAmount > dataChannel.bufferedAmountLowThreshold) {
dataChannel.onbufferedamountlow = () => {
dataChannel.onbufferedamountlow = null;
send();
};
return;
}
const chunk = buffer.slice(0, chunkSize);
buffer = buffer.slice(chunkSize, buffer.byteLength);
dataChannel.send(chunk);
}
};
send();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant