Compute RTCConnectionState and RTCIceConnectionState.
Compute these states in jseptransportController and store them. Eventually they should be passed on to the peer connection observer and exposed in the blink layer.
Bug: webrtc:9308
Change-Id: Ifdec39c24a607fcb8211c4acf6b9704eaff371b1
Reviewed-on: https://webrtc-review.googlesource.com/c/103506
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25288}
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
index d0f96a0..a8063b10 100644
--- a/api/peerconnectioninterface.h
+++ b/api/peerconnectioninterface.h
@@ -160,7 +160,7 @@
class PeerConnectionInterface : public rtc::RefCountInterface {
public:
- // See https://w3c.github.io/webrtc-pc/#state-definitions
+ // See https://w3c.github.io/webrtc-pc/#dom-rtcsignalingstate
enum SignalingState {
kStable,
kHaveLocalOffer,
@@ -170,12 +170,24 @@
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,
@@ -978,11 +990,13 @@
virtual SignalingState signaling_state() = 0;
// Returns the aggregate state of all ICE *and* DTLS transports.
- // TODO(deadbeef): Implement "PeerConnectionState" according to the standard,
- // to aggregate ICE+DTLS state, and change the scope of IceConnectionState to
- // be just the ICE layer. See: crbug.com/webrtc/6145
+ // TODO(jonasolsson): Replace with standardized_ice_connection_state once it
+ // is ready, see crbug.com/webrtc/6145
virtual IceConnectionState ice_connection_state() = 0;
+ // Returns the aggregated state of all ICE and DTLS transports.
+ virtual PeerConnectionState peer_connection_state();
+
virtual IceGatheringState ice_gathering_state() = 0;
// Starts RtcEventLog using existing file. Takes ownership of |file| and
@@ -1051,6 +1065,10 @@
virtual void OnIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) = 0;
+ // Called any time the PeerConnectionState changes.
+ virtual void OnConnectionChange(
+ PeerConnectionInterface::PeerConnectionState new_state) {}
+
// Called any time the IceGatheringState changes.
virtual void OnIceGatheringChange(
PeerConnectionInterface::IceGatheringState new_state) = 0;