webrtc-java icon indicating copy to clipboard operation
webrtc-java copied to clipboard

How to solve the problem of bufferedAmount being full

Open kingtonlee opened this issue 9 months ago • 0 comments

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();

kingtonlee avatar May 11 '24 01:05 kingtonlee