-
Notifications
You must be signed in to change notification settings - Fork 43
/
sctp_parameters.go
74 lines (62 loc) · 2.97 KB
/
sctp_parameters.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package mediasoup
type SctpCapabilities struct {
NumStreams NumSctpStreams `json:"numStreams"`
}
// NumSctpStreams defines the SCTP streams configuration.
//
// Both OS and MIS are part of the SCTP INIT+ACK handshake. OS refers to the
// initial int of outgoing SCTP streams that the server side transport creates
// (to be used by DataConsumers), while MIS refers to the maximum int of
// incoming SCTP streams that the server side transport can receive (to be used
// by DataProducers). So, if the server side transport will just be used to
// create data producers (but no data consumers), OS can be low (~1). However,
// if data consumers are desired on the server side transport, OS must have a
// proper value and such a proper value depends on whether the remote endpoint
// supports SCTP_ADD_STREAMS extension or not.
//
// libwebrtc (Chrome, Safari, etc) does not enable SCTP_ADD_STREAMS so, if data
// consumers are required, OS should be 1024 (the maximum int of DataChannels
// that libwebrtc enables).
//
// Firefox does enable SCTP_ADD_STREAMS so, if data consumers are required, OS
// can be lower (16 for instance). The mediasoup transport will allocate and
// announce more outgoing SCTM streams when needed.
//
// mediasoup-client provides specific per browser/version OS and MIS values via
// the device.sctpCapabilities getter.
type NumSctpStreams struct {
// OS defines initially requested int of outgoing SCTP streams.
OS uint16 `json:"OS"`
// MIS defines maximum int of incoming SCTP streams.
MIS uint16 `json:"MIS"`
}
type SctpParameters struct {
// Port must always equal 5000.
Port uint16 `json:"port"`
// OS defines initially requested int of outgoing SCTP streams.
OS uint16 `json:"os"`
// MIS defines maximum int of incoming SCTP streams.
MIS uint16 `json:"mis"`
// MaxMessageSize defines maximum allowed size for SCTP messages.
MaxMessageSize uint32 `json:"maxMessageSize"`
// Set by worker.
IsDataChannel bool `json:"isDataChannel,omitempty"`
SctpBufferedAmount int `json:"sctpBufferedAmount,omitempty"`
SendBufferSize int `json:"sendBufferSize,omitempty"`
}
// SctpStreamParameters describe the reliability of a certain SCTP stream.
// If ordered is true then maxPacketLifeTime and maxRetransmits must be false.
// If ordered if false, only one of maxPacketLifeTime or maxRetransmits can be true.
type SctpStreamParameters struct {
// StreamId defines SCTP stream id.
StreamId uint16 `json:"streamId"`
// Ordered defines whether data messages must be received in order. If true the messages will
// be sent reliably. Default true.
Ordered *bool `json:"ordered,omitempty"`
// MaxPacketLifeTime defines when ordered is false indicates the time (in milliseconds) after
// which a SCTP packet will stop being retransmitted.
MaxPacketLifeTime uint16 `json:"maxPacketLifeTime,omitempty"`
// MaxRetransmits defines when ordered is false indicates the maximum number of times a packet
// will be retransmitted.
MaxRetransmits uint16 `json:"maxRetransmits,omitempty"`
}