diff --git a/sctptransport.go b/sctptransport.go index 27e02ea65de..a379a96b1e1 100644 --- a/sctptransport.go +++ b/sctptransport.go @@ -103,8 +103,9 @@ func (r *SCTPTransport) Start(remoteCaps SCTPCapabilities) error { } sctpAssociation, err := sctp.Client(sctp.Config{ - NetConn: dtlsTransport.conn, - LoggerFactory: r.api.settingEngine.LoggerFactory, + NetConn: dtlsTransport.conn, + MaxReceiveBufferSize: r.api.settingEngine.sctp.maxReceiveBufferSize, + LoggerFactory: r.api.settingEngine.LoggerFactory, }) if err != nil { return err diff --git a/settingengine.go b/settingengine.go index a2f5ef41882..7cd0bb30881 100644 --- a/settingengine.go +++ b/settingengine.go @@ -54,6 +54,9 @@ type SettingEngine struct { dtls struct { retransmissionInterval time.Duration } + sctp struct { + maxReceiveBufferSize uint32 + } sdpMediaLevelFingerprints bool answeringDTLSRole DTLSRole disableCertificateFingerprintVerification bool @@ -304,3 +307,9 @@ func (e *SettingEngine) SetReceiveMTU(receiveMTU uint) { func (e *SettingEngine) SetDTLSRetransmissionInterval(interval time.Duration) { e.dtls.retransmissionInterval = interval } + +// SetSCTPMaxReceiveBufferSize sets the maximum receive buffer size. +// Leave this 0 for the default maxReceiveBufferSize. +func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32) { + e.sctp.maxReceiveBufferSize = maxReceiveBufferSize +}