forked from pion/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtcrtcpmuxpolicy.go
46 lines (40 loc) · 1.32 KB
/
rtcrtcpmuxpolicy.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
package webrtc
// RTCRtcpMuxPolicy affects what ICE candidates are gathered to support
// non-multiplexed RTCP.
type RTCRtcpMuxPolicy int
const (
// RTCRtcpMuxPolicyNegotiate indicates to gather ICE candidates for both
// RTP and RTCP candidates. If the remote-endpoint is capable of
// multiplexing RTCP, multiplex RTCP on the RTP candidates. If it is not,
// use both the RTP and RTCP candidates separately.
RTCRtcpMuxPolicyNegotiate RTCRtcpMuxPolicy = iota + 1
// RTCRtcpMuxPolicyRequire indicates to gather ICE candidates only for
// RTP and multiplex RTCP on the RTP candidates. If the remote endpoint is
// not capable of rtcp-mux, session negotiation will fail.
RTCRtcpMuxPolicyRequire
)
// This is done this way because of a linter.
const (
rtcRtcpMuxPolicyNegotiateStr = "negotiate"
rtcRtcpMuxPolicyRequireStr = "require"
)
func newRTCRtcpMuxPolicy(raw string) RTCRtcpMuxPolicy {
switch raw {
case rtcRtcpMuxPolicyNegotiateStr:
return RTCRtcpMuxPolicyNegotiate
case rtcRtcpMuxPolicyRequireStr:
return RTCRtcpMuxPolicyRequire
default:
return RTCRtcpMuxPolicy(Unknown)
}
}
func (t RTCRtcpMuxPolicy) String() string {
switch t {
case RTCRtcpMuxPolicyNegotiate:
return rtcRtcpMuxPolicyNegotiateStr
case RTCRtcpMuxPolicyRequire:
return rtcRtcpMuxPolicyRequireStr
default:
return ErrUnknownType.Error()
}
}