forked from calebdoxsey/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtcicegatheringstate.go
52 lines (45 loc) · 1.56 KB
/
rtcicegatheringstate.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
package webrtc
// RTCIceGatheringState describes the state of the candidate gathering process.
type RTCIceGatheringState int
const (
// RTCIceGatheringStateNew indicates that any of the RTCIceTransports are
// in the "new" gathering state and none of the transports are in the
// "gathering" state, or there are no transports.
RTCIceGatheringStateNew RTCIceGatheringState = iota + 1
// RTCIceGatheringStateGathering indicates that any of the RTCIceTransports
// are in the "gathering" state.
RTCIceGatheringStateGathering
// RTCIceGatheringStateComplete indicates that at least one RTCIceTransport
// exists, and all RTCIceTransports are in the "completed" gathering state.
RTCIceGatheringStateComplete
)
// This is done this way because of a linter.
const (
rtcIceGatheringStateNewStr = "new"
rtcIceGatheringStateGatheringStr = "gathering"
rtcIceGatheringStateCompleteStr = "complete"
)
func newRTCIceGatheringState(raw string) RTCIceGatheringState {
switch raw {
case rtcIceGatheringStateNewStr:
return RTCIceGatheringStateNew
case rtcIceGatheringStateGatheringStr:
return RTCIceGatheringStateGathering
case rtcIceGatheringStateCompleteStr:
return RTCIceGatheringStateComplete
default:
return RTCIceGatheringState(Unknown)
}
}
func (t RTCIceGatheringState) String() string {
switch t {
case RTCIceGatheringStateNew:
return rtcIceGatheringStateNewStr
case RTCIceGatheringStateGathering:
return rtcIceGatheringStateGatheringStr
case RTCIceGatheringStateComplete:
return rtcIceGatheringStateCompleteStr
default:
return ErrUnknownType.Error()
}
}