Skip to content

Commit

Permalink
Put SCTP Zero Checksum behind SettingEngine
Browse files Browse the repository at this point in the history
Old versions of Pion break against it
  • Loading branch information
Sean-Der committed Mar 18, 2024
1 parent 39919d7 commit de2e7b7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/pion/randutil v0.1.0
github.com/pion/rtcp v1.2.12
github.com/pion/rtp v1.8.3
github.com/pion/sctp v1.8.12
github.com/pion/sctp v1.8.13
github.com/pion/sdp/v3 v3.0.8
github.com/pion/srtp/v2 v2.0.18
github.com/pion/stun v0.6.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/pion/rtp v1.8.2/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU
github.com/pion/rtp v1.8.3 h1:VEHxqzSVQxCkKDSHro5/4IUUG1ea+MFdqR2R3xSpNU8=
github.com/pion/rtp v1.8.3/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU=
github.com/pion/sctp v1.8.5/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0=
github.com/pion/sctp v1.8.12 h1:2VX50pedElH+is6FI+OKyRTeN5oy4mrk2HjnGa3UCmY=
github.com/pion/sctp v1.8.12/go.mod h1:cMLT45jqw3+jiJCrtHVwfQLnfR0MGZ4rgOJwUOIqLkI=
github.com/pion/sctp v1.8.13 h1:YUJR44pWM2FPUhkl8l+vDyF2EDE3aTWtr3c+LDhCRcQ=
github.com/pion/sctp v1.8.13/go.mod h1:YKSgO/bO/6aOMP9LCie1DuD7m+GamiK2yIiPM6vH+GA=
github.com/pion/sdp/v3 v3.0.8 h1:yd/wkrS0nzXEAb+uwv1TL3SG/gzsTiXHVOtXtD7EKl0=
github.com/pion/sdp/v3 v3.0.8/go.mod h1:B5xmvENq5IXJimIO4zfp6LAe1fD9N+kFv+V/1lOdz8M=
github.com/pion/srtp/v2 v2.0.18 h1:vKpAXfawO9RtTRKZJbG4y0v1b11NZxQnxRl85kGuUlo=
Expand Down
2 changes: 1 addition & 1 deletion sctptransport.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (r *SCTPTransport) Start(SCTPCapabilities) error {
sctpAssociation, err := sctp.Client(sctp.Config{
NetConn: dtlsTransport.conn,
MaxReceiveBufferSize: r.api.settingEngine.sctp.maxReceiveBufferSize,
EnableZeroChecksum: true,
EnableZeroChecksum: r.api.settingEngine.sctp.enableZeroChecksum,
LoggerFactory: r.api.settingEngine.LoggerFactory,
})
if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions settingengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type SettingEngine struct {
}
sctp struct {
maxReceiveBufferSize uint32
enableZeroChecksum bool
}
sdpMediaLevelFingerprints bool
answeringDTLSRole DTLSRole
Expand Down Expand Up @@ -434,3 +435,10 @@ func (e *SettingEngine) SetDTLSKeyLogWriter(writer io.Writer) {
func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32) {
e.sctp.maxReceiveBufferSize = maxReceiveBufferSize
}

// SetSCTPZeroChecksum enables the zero checksum feature in SCTP.
// This removes the need to checksum every incoming/outgoing packet and will reduce
// latency and CPU usage. This feature is not backwards compatible so is disabled by default
func (e *SettingEngine) EnableSCTPZeroChecksum(isEnabled bool) {
e.sctp.enableZeroChecksum = isEnabled
}

0 comments on commit de2e7b7

Please sign in to comment.