RTCIceCandidatePairStats.[state/priority] added, ConnectionInfo updated.
State and priority added to ConnectionInfo. The Connection::State enum
is replaced by IceCandidatePairState enum class.
At P2PTransportChannel::GetStats, Connection::stats is called, producing
ConnectionInfo for the connection that is then filled in with additional
values from the Connection. This is refactored so that all values are
set by Connection::stats.
RTCStatsCollector is updated to surface the ConnectionInfo stats.
BUG=webrtc:6755, chromium:633550, chromium:627816
Review-Url: https://codereview.webrtc.org/2597423003
Cr-Commit-Position: refs/heads/master@{#15870}
diff --git a/webrtc/api/rtcstatscollector.cc b/webrtc/api/rtcstatscollector.cc
index 85113e6..4e5e8d9 100644
--- a/webrtc/api/rtcstatscollector.cc
+++ b/webrtc/api/rtcstatscollector.cc
@@ -114,6 +114,23 @@
}
}
+const char* IceCandidatePairStateToRTCStatsIceCandidatePairState(
+ cricket::IceCandidatePairState state) {
+ switch (state) {
+ case cricket::IceCandidatePairState::WAITING:
+ return RTCStatsIceCandidatePairState::kWaiting;
+ case cricket::IceCandidatePairState::IN_PROGRESS:
+ return RTCStatsIceCandidatePairState::kInProgress;
+ case cricket::IceCandidatePairState::SUCCEEDED:
+ return RTCStatsIceCandidatePairState::kSucceeded;
+ case cricket::IceCandidatePairState::FAILED:
+ return RTCStatsIceCandidatePairState::kFailed;
+ default:
+ RTC_NOTREACHED();
+ return nullptr;
+ }
+}
+
std::unique_ptr<RTCCodecStats> CodecStatsFromRtpCodecParameters(
uint64_t timestamp_us, bool inbound, bool audio,
const RtpCodecParameters& codec_params) {
@@ -646,6 +663,9 @@
timestamp_us, info.local_candidate, true, report);
candidate_pair_stats->remote_candidate_id = ProduceIceCandidateStats(
timestamp_us, info.remote_candidate, false, report);
+ candidate_pair_stats->state =
+ IceCandidatePairStateToRTCStatsIceCandidatePairState(info.state);
+ candidate_pair_stats->priority = info.priority;
// TODO(hbos): This writable is different than the spec. It goes to
// false after a certain amount of time without a response passes.
// crbug.com/633550