mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Merge pull request #414 from paullouisageneau/sctp-max-burst
Add SCTP max burst setting
This commit is contained in:
@ -46,11 +46,13 @@ RTC_EXPORT void Preload();
|
|||||||
RTC_EXPORT void Cleanup();
|
RTC_EXPORT void Cleanup();
|
||||||
|
|
||||||
struct SctpSettings {
|
struct SctpSettings {
|
||||||
optional<size_t> recvBufferSize;
|
// For the following settings, not set means optimized default
|
||||||
optional<size_t> sendBufferSize;
|
optional<size_t> recvBufferSize; // in bytes
|
||||||
optional<size_t> maxChunksOnQueue;
|
optional<size_t> sendBufferSize; // in bytes
|
||||||
optional<size_t> initialCongestionWindow;
|
optional<size_t> maxChunksOnQueue; // in chunks
|
||||||
optional<unsigned int> congestionControlModule;
|
optional<size_t> initialCongestionWindow; // in MTUs
|
||||||
|
optional<size_t> maxBurst; // in MTUs
|
||||||
|
optional<unsigned int> congestionControlModule; // 0: RFC2581, 1: HSTCP, 2: H-TCP, 3: RTCC
|
||||||
optional<std::chrono::milliseconds> delayedSackTime;
|
optional<std::chrono::milliseconds> delayedSackTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -222,12 +222,13 @@ RTC_EXPORT int rtcGetTrackDescription(int tr, char *buffer, int size);
|
|||||||
|
|
||||||
// SCTP settings
|
// SCTP settings
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int recvBufferSize; // <= 0 means optimized default
|
int recvBufferSize; // in bytes, <= 0 means optimized default
|
||||||
int sendBufferSize; // <= 0 means optimized default
|
int sendBufferSize; // in bytes, <= 0 means optimized default
|
||||||
int maxChunksOnQueue; // <= 0 means optimized default
|
int maxChunksOnQueue; // in chunks, <= 0 means optimized default
|
||||||
int initialCongestionWindow; // <= 0 means optimized default
|
int initialCongestionWindow; // in MTUs, <= 0 means optimized default
|
||||||
int congestionControlModule; // <= 0 means default (0: RFC2581, 1: HSTCP, 2: H-TCP, 3: RTCC)
|
int maxBurst; // in MTUs, 0 means optimized default, < 0 means disabled
|
||||||
int delayedSackTimeMs; // <= 0 means optimized default
|
int congestionControlModule; // 0: RFC2581 (default), 1: HSTCP, 2: H-TCP, 3: RTCC
|
||||||
|
int delayedSackTimeMs; // in msecs, <= 0 means optimized default
|
||||||
} rtcSctpSettings;
|
} rtcSctpSettings;
|
||||||
|
|
||||||
// Note: SCTP settings apply to newly-created PeerConnections only
|
// Note: SCTP settings apply to newly-created PeerConnections only
|
||||||
|
@ -683,6 +683,11 @@ int rtcSetSctpSettings(const rtcSctpSettings *settings) {
|
|||||||
if (settings->initialCongestionWindow > 0)
|
if (settings->initialCongestionWindow > 0)
|
||||||
s.initialCongestionWindow = size_t(settings->initialCongestionWindow);
|
s.initialCongestionWindow = size_t(settings->initialCongestionWindow);
|
||||||
|
|
||||||
|
if (settings->maxBurst > 0)
|
||||||
|
s.maxBurst = size_t(settings->maxBurst);
|
||||||
|
else if (settings->maxBurst < 0)
|
||||||
|
s.maxBurst = size_t(0); // setting to 0 disables, not setting chooses optimized default
|
||||||
|
|
||||||
if (settings->congestionControlModule >= 0)
|
if (settings->congestionControlModule >= 0)
|
||||||
s.congestionControlModule = unsigned(settings->congestionControlModule);
|
s.congestionControlModule = unsigned(settings->congestionControlModule);
|
||||||
|
|
||||||
|
@ -115,6 +115,9 @@ void SctpTransport::SetSettings(const SctpSettings &s) {
|
|||||||
// Increase initial congestion window size to 10 MTUs (RFC 6928) by default
|
// Increase initial congestion window size to 10 MTUs (RFC 6928) by default
|
||||||
usrsctp_sysctl_set_sctp_initial_cwnd(to_uint32(s.initialCongestionWindow.value_or(10)));
|
usrsctp_sysctl_set_sctp_initial_cwnd(to_uint32(s.initialCongestionWindow.value_or(10)));
|
||||||
|
|
||||||
|
// Set max burst to 10 MTUs by default (max burst is initially 0, meaning disabled)
|
||||||
|
usrsctp_sysctl_set_sctp_max_burst_default(to_uint32(s.maxBurst.value_or(10)));
|
||||||
|
|
||||||
// Use standard SCTP congestion control (RFC 4960) by default
|
// Use standard SCTP congestion control (RFC 4960) by default
|
||||||
// See https://github.com/paullouisageneau/libdatachannel/issues/354
|
// See https://github.com/paullouisageneau/libdatachannel/issues/354
|
||||||
usrsctp_sysctl_set_sctp_default_cc_module(to_uint32(s.congestionControlModule.value_or(0)));
|
usrsctp_sysctl_set_sctp_default_cc_module(to_uint32(s.congestionControlModule.value_or(0)));
|
||||||
|
Reference in New Issue
Block a user