Skip to content

Commit

Permalink
Merge pull request #9 from wwllww/master
Browse files Browse the repository at this point in the history
add sctp map
  • Loading branch information
notedit authored May 12, 2022
2 parents e4233c6 + cff6a6a commit 504dbb3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions sdpinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,11 @@ func (s *SDPInfo) String() string {
}

if strings.ToLower(media.mtype) == "application" {
mediaMap.SctpMap = &transform.SctpMapStuct{
5000,
"webrtc-datachannel",
1024,
}
mediaMap.Payloads = media.Payloads
mediaMap.SctpPort = 5000
mediaMap.SctpMaxSize = 256 * 1024
Expand Down
4 changes: 2 additions & 2 deletions transform/grammer.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,9 @@ var rulesMap map[byte][]*Rule = map[byte][]*Rule{
Format: "",
FormatFunc: func(obj *gabs.Container) string {
if hasValue(obj, "maxMessageSize") {
return "sctpmap:%s %s %s"
return "sctpmap:%d %s %d"
} else {
return "sctpmap:%s %s"
return "sctpmap:%d %s"
}
},
},
Expand Down
7 changes: 7 additions & 0 deletions transform/sdpstruct.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ type MediaStruct struct {
Simulcast *SimulcastStruct `json:"simulcast,omitempty"`
SctpPort int `json:"sctp-port,omitempty"`
SctpMaxSize int `json:"sctp-max-message-size,omitempty"`
SctpMap *SctpMapStuct `json:"sctpmap,omitempty"`
}

type SdpStruct struct {
Expand All @@ -159,3 +160,9 @@ type SdpStruct struct {
Connection *ConnectionStruct `json:"connection,omitempty"`
Icelite string `json:"icelite,omitempty"`
}

type SctpMapStuct struct {
Port int `json:"sctpmapNumber"`
App string `json:"app"`
MessageSize int `json:"maxMessageSize"`
}

0 comments on commit 504dbb3

Please sign in to comment.