W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > April 2018

Re: [webrtc-pc] RTCDataChannel.bufferedAmount value

From: Taylor Brandstetter via GitHub <sysbot+gh@w3.org>
Date: Mon, 02 Apr 2018 23:53:00 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-378083997-1522713179-sysbot+gh@w3.org>
> But I want to know whether there's a particular reason why it needs to be that way

Because then you can reliably check `bufferedAmount` to avoid calling `send` when the buffered amount is above some threshold. It guarantees that `bufferedAmount` is always greater than or equal to the actual buffered amount.

For example:

```
while (haveDataToSend()) {
  if (dc.bufferedAmount > bufferFullThreshold) {
    // bufferedamountlow event will cause us to resume sending.
    break;
  } else {
    dc.send(getChunkToSend());
  }
}
```

-- 
GitHub Notification of comment by taylor-b
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1823#issuecomment-378083997 using your GitHub account
Received on Monday, 2 April 2018 23:53:07 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:19:44 UTC