getStats: add relayProtocol
adds relayProtocol stats member. BUG=webrtc:7063 Change-Id: Iedef61506cac1ab2e3e38c836881748965eeda3d Reviewed-on: https://webrtc-review.googlesource.com/97780 Reviewed-by: Henrik Boström <hbos@webrtc.org> Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> Cr-Commit-Position: refs/heads/master@{#24923}
This commit is contained in:
committed by
Commit Bot
parent
93e5750a92
commit
9551375c02
@ -199,6 +199,7 @@ class RTCIceCandidateStats : public RTCStats {
|
||||
RTCStatsMember<std::string> ip;
|
||||
RTCStatsMember<int32_t> port;
|
||||
RTCStatsMember<std::string> protocol;
|
||||
RTCStatsMember<std::string> relay_protocol;
|
||||
// TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"?
|
||||
RTCStatsMember<std::string> candidate_type;
|
||||
RTCStatsMember<int32_t> priority;
|
||||
|
||||
@ -497,6 +497,7 @@ class RTCStatsReportVerifier {
|
||||
verifier.TestMemberIsNonNegative<int32_t>(candidate.priority);
|
||||
verifier.TestMemberIsUndefined(candidate.url);
|
||||
verifier.TestMemberIsDefined(candidate.deleted);
|
||||
verifier.TestMemberIsUndefined(candidate.relay_protocol);
|
||||
return verifier.ExpectAllMembersSuccessfullyTested();
|
||||
}
|
||||
|
||||
|
||||
@ -363,6 +363,13 @@ const std::string& ProduceIceCandidateStats(
|
||||
if (is_local) {
|
||||
candidate_stats->network_type =
|
||||
NetworkAdapterTypeToStatsType(candidate.network_type());
|
||||
if (candidate.type() == cricket::RELAY_PORT_TYPE) {
|
||||
std::string relay_protocol = candidate.relay_protocol();
|
||||
RTC_DCHECK(relay_protocol.compare("udp") == 0 ||
|
||||
relay_protocol.compare("tcp") == 0 ||
|
||||
relay_protocol.compare("tls") == 0);
|
||||
candidate_stats->relay_protocol = relay_protocol;
|
||||
}
|
||||
} else {
|
||||
// We don't expect to know the adapter type of remote candidates.
|
||||
RTC_DCHECK_EQ(rtc::ADAPTER_TYPE_UNKNOWN, candidate.network_type());
|
||||
|
||||
@ -993,6 +993,23 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||
expected_a_remote_relay.deleted = false;
|
||||
EXPECT_TRUE(*expected_a_remote_relay.is_remote);
|
||||
|
||||
std::unique_ptr<cricket::Candidate> a_local_relay = CreateFakeCandidate(
|
||||
"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");
|
||||
|
||||
RTCRemoteIceCandidateStats expected_a_local_relay(
|
||||
"RTCIceCandidate_" + a_local_relay->id(), 0);
|
||||
expected_a_local_relay.transport_id = "RTCTransport_a_0";
|
||||
expected_a_local_relay.ip = "16.17.18.19";
|
||||
expected_a_local_relay.port = 21;
|
||||
expected_a_local_relay.protocol = "a_local_relay's protocol";
|
||||
expected_a_local_relay.relay_protocol = "tcp";
|
||||
expected_a_local_relay.candidate_type = "relay";
|
||||
expected_a_local_relay.priority = 1;
|
||||
expected_a_local_relay.deleted = false;
|
||||
EXPECT_TRUE(*expected_a_local_relay.is_remote);
|
||||
|
||||
// Candidates in the second transport stats.
|
||||
std::unique_ptr<cricket::Candidate> b_local =
|
||||
CreateFakeCandidate("42.42.42.42", 42, "b_local's protocol",
|
||||
@ -1023,6 +1040,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||
expected_b_remote.deleted = false;
|
||||
EXPECT_TRUE(*expected_b_remote.is_remote);
|
||||
|
||||
// Add candidate pairs to connection.
|
||||
cricket::TransportChannelStats a_transport_channel_stats;
|
||||
a_transport_channel_stats.connection_infos.push_back(
|
||||
cricket::ConnectionInfo());
|
||||
@ -1036,6 +1054,12 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||
*a_local_prflx.get();
|
||||
a_transport_channel_stats.connection_infos[1].remote_candidate =
|
||||
*a_remote_relay.get();
|
||||
a_transport_channel_stats.connection_infos.push_back(
|
||||
cricket::ConnectionInfo());
|
||||
a_transport_channel_stats.connection_infos[2].local_candidate =
|
||||
*a_local_relay.get();
|
||||
a_transport_channel_stats.connection_infos[2].remote_candidate =
|
||||
*a_remote_relay.get();
|
||||
|
||||
pc_->AddVoiceChannel("audio", "a");
|
||||
pc_->SetTransportStats("a", a_transport_channel_stats);
|
||||
|
||||
@ -246,6 +246,7 @@ WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "abstract-ice-candidate",
|
||||
&ip,
|
||||
&port,
|
||||
&protocol,
|
||||
&relay_protocol,
|
||||
&candidate_type,
|
||||
&priority,
|
||||
&url,
|
||||
@ -267,6 +268,7 @@ RTCIceCandidateStats::RTCIceCandidateStats(std::string&& id,
|
||||
ip("ip"),
|
||||
port("port"),
|
||||
protocol("protocol"),
|
||||
relay_protocol("relayProtocol"),
|
||||
candidate_type("candidateType"),
|
||||
priority("priority"),
|
||||
url("url"),
|
||||
@ -280,6 +282,7 @@ RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
|
||||
ip(other.ip),
|
||||
port(other.port),
|
||||
protocol(other.protocol),
|
||||
relay_protocol(other.relay_protocol),
|
||||
candidate_type(other.candidate_type),
|
||||
priority(other.priority),
|
||||
url(other.url),
|
||||
|
||||
Reference in New Issue
Block a user