从枚举和枚举类来看,PeerConnection有四个不同纬度的状态机:
- 信令状态机:枚举
- ice收集状态机:枚举
- PeerConnection状态机:枚举类
- ice连接状态机:枚举
class PeerConnectionInterface : public rtc::RefCountInterface {
public:
// See https://w3c.github.io/webrtc-pc/#dom-rtcsignalingstate
enum SignalingState {
kStable,
kHaveLocalOffer,
kHaveLocalPrAnswer,
kHaveRemoteOffer,
kHaveRemotePrAnswer,
kClosed,
};
// See https://w3c.github.io/webrtc-pc/#dom-rtcicegatheringstate
enum IceGatheringState {
kIceGatheringNew,
kIceGatheringGathering,
kIceGatheringComplete
};
// See https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectionstate
// 这是个枚举类!!!!!!
enum class PeerConnectionState {
kNew,
kConnecting,
kConnected,
kDisconnected,
kFailed,
kClosed,
};
// See https://w3c.github.io/webrtc-pc/#dom-rtciceconnectionstate
enum IceConnectionState {
kIceConnectionNew,
kIceConnectionChecking,
kIceConnectionConnected,
kIceConnectionCompleted,
kIceConnectionFailed,
kIceConnectionDisconnected,
kIceConnectionClosed,
kIceConnectionMax,
};
};