datachannel: Add a MaxSendQueueSize() accessor in the API
Previous limits was only in a comment and users had no way to query it
from the API.
Bug: webrtc:13289
Change-Id: I6187dd9f9482bc3e457909c5e703ef1553d8ef15
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235378
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35224}
diff --git a/api/data_channel_interface.h b/api/data_channel_interface.h
index 99ea551..a02bc5e 100644
--- a/api/data_channel_interface.h
+++ b/api/data_channel_interface.h
@@ -174,6 +174,7 @@
// Returns the number of bytes of application data (UTF-8 text and binary
// data) that have been queued using Send but have not yet been processed at
// the SCTP level. See comment above Send below.
+ // Values are less or equal to MaxSendQueueSize().
virtual uint64_t buffered_amount() const = 0;
// Begins the graceful data channel closing procedure. See:
@@ -182,14 +183,18 @@
// Sends `data` to the remote peer. If the data can't be sent at the SCTP
// level (due to congestion control), it's buffered at the data channel level,
- // up to a maximum of 16MB. If Send is called while this buffer is full, the
- // data channel will be closed abruptly.
+ // up to a maximum of MaxSendQueueSize(). If Send is called while this buffer
+ // is full, the data channel will be closed abruptly.
//
// So, it's important to use buffered_amount() and OnBufferedAmountChange to
// ensure the data channel is used efficiently but without filling this
// buffer.
virtual bool Send(const DataBuffer& buffer) = 0;
+ // Amount of bytes that can be queued for sending on the data channel.
+ // Those are bytes that have not yet been processed at the SCTP level.
+ static uint64_t MaxSendQueueSize();
+
protected:
~DataChannelInterface() override = default;
};