stats: collect RTCIceCandidate url
BUG=webrtc:13652 Change-Id: I80eaa11eb9c6ff3523cbd48d47dd68beb39d5188 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250200 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> Cr-Commit-Position: refs/heads/main@{#35900}
This commit is contained in:
parent
65d89e8f31
commit
05b29c7701
@ -225,7 +225,6 @@ class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
|
||||
// TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"?
|
||||
RTCStatsMember<std::string> candidate_type;
|
||||
RTCStatsMember<int32_t> priority;
|
||||
// TODO(hbos): Not collected by `RTCStatsCollector`. crbug.com/632723
|
||||
RTCStatsMember<std::string> url;
|
||||
|
||||
protected:
|
||||
|
||||
@ -733,6 +733,7 @@ const std::string& ProduceIceCandidateStats(int64_t timestamp_us,
|
||||
NetworkAdapterTypeToStatsType(candidate.network_type());
|
||||
const std::string& candidate_type = candidate.type();
|
||||
const std::string& relay_protocol = candidate.relay_protocol();
|
||||
const std::string& url = candidate.url();
|
||||
if (candidate_type == cricket::RELAY_PORT_TYPE ||
|
||||
(candidate_type == cricket::PRFLX_PORT_TYPE &&
|
||||
!relay_protocol.empty())) {
|
||||
@ -740,6 +741,13 @@ const std::string& ProduceIceCandidateStats(int64_t timestamp_us,
|
||||
relay_protocol.compare("tcp") == 0 ||
|
||||
relay_protocol.compare("tls") == 0);
|
||||
candidate_stats->relay_protocol = relay_protocol;
|
||||
if (!url.empty()) {
|
||||
candidate_stats->url = url;
|
||||
}
|
||||
} else if (candidate_type == cricket::STUN_PORT_TYPE) {
|
||||
if (!url.empty()) {
|
||||
candidate_stats->url = url;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We don't expect to know the adapter type of remote candidates.
|
||||
|
||||
@ -1284,6 +1284,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||
"16.17.18.19", 21, "a_local_relay's protocol", rtc::ADAPTER_TYPE_UNKNOWN,
|
||||
cricket::RELAY_PORT_TYPE, 1);
|
||||
a_local_relay->set_relay_protocol("tcp");
|
||||
a_local_relay->set_url("turn:url1");
|
||||
|
||||
RTCLocalIceCandidateStats expected_a_local_relay(
|
||||
"RTCIceCandidate_" + a_local_relay->id(), 0);
|
||||
@ -1296,6 +1297,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||
expected_a_local_relay.relay_protocol = "tcp";
|
||||
expected_a_local_relay.candidate_type = "relay";
|
||||
expected_a_local_relay.priority = 1;
|
||||
expected_a_local_relay.url = "turn:url1";
|
||||
|
||||
std::unique_ptr<cricket::Candidate> a_local_relay_prflx = CreateFakeCandidate(
|
||||
"11.12.13.20", 22, "a_local_relay_prflx's protocol",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user