Add methods for tweaking sctp cc to settingending

Relate: https://github.com/pion/sctp/pull/354
This commit is contained in:
cnderrauber
2025-05-19 15:20:58 +08:00
committed by cnderrauber
parent 6fd1344457
commit c5d629f4fc
2 changed files with 22 additions and 0 deletions

View File

@@ -121,6 +121,9 @@ func (r *SCTPTransport) Start(capabilities SCTPCapabilities) error {
BlockWrite: r.api.settingEngine.detach.DataChannels && r.api.settingEngine.dataChannelBlockWrite, BlockWrite: r.api.settingEngine.detach.DataChannels && r.api.settingEngine.dataChannelBlockWrite,
MaxMessageSize: maxMessageSize, MaxMessageSize: maxMessageSize,
MTU: outboundMTU, MTU: outboundMTU,
MinCwnd: r.api.settingEngine.sctp.minCwnd,
FastRtxWnd: r.api.settingEngine.sctp.fastRtxWnd,
CwndCAStep: r.api.settingEngine.sctp.cwndCAStep,
}) })
if err != nil { if err != nil {
return err return err

View File

@@ -84,6 +84,9 @@ type SettingEngine struct {
enableZeroChecksum bool enableZeroChecksum bool
rtoMax time.Duration rtoMax time.Duration
maxMessageSize uint32 maxMessageSize uint32
minCwnd uint32
fastRtxWnd uint32
cwndCAStep uint32
} }
sdpMediaLevelFingerprints bool sdpMediaLevelFingerprints bool
answeringDTLSRole DTLSRole answeringDTLSRole DTLSRole
@@ -525,6 +528,22 @@ func (e *SettingEngine) SetSCTPRTOMax(rtoMax time.Duration) {
e.sctp.rtoMax = rtoMax e.sctp.rtoMax = rtoMax
} }
// SetSCTPMinCwnd sets the minimum congestion window size. The congestion window
// will not be smaller than this value during congestion control.
func (e *SettingEngine) SetSCTPMinCwnd(minCwnd uint32) {
e.sctp.minCwnd = minCwnd
}
// SetSCTPFastRtxWnd sets the fast retransmission window size.
func (e *SettingEngine) SetSCTPFastRtxWnd(fastRtxWnd uint32) {
e.sctp.fastRtxWnd = fastRtxWnd
}
// SetSCTPCwndCAStep sets congestion window adjustment step size during congestion avoidance.
func (e *SettingEngine) SetSCTPCwndCAStep(cwndCAStep uint32) {
e.sctp.cwndCAStep = cwndCAStep
}
// SetICEBindingRequestHandler sets a callback that is fired on a STUN BindingRequest // SetICEBindingRequestHandler sets a callback that is fired on a STUN BindingRequest
// This allows users to do things like // This allows users to do things like
// - Log incoming Binding Requests for debugging // - Log incoming Binding Requests for debugging