[Stats] Cleanup obsolete stats - isRemote & deleted

Deleting obsolete stats. Spec: https://www.w3.org/TR/webrtc-stats/

1. RTCInbound/OutboundRtpStats.isRemote: No longer useful with remote stream stats
2. RTCIceCandidateStats.deleted: This field was obsoleted because if the ICE candidate is deleted it no longer appears in getStats()

I also marked as many other obsoleted stats possible according to spec. I am not as confident to delete them but feel free to comment to let me know if anything is off / can be deleted.

Bug: webrtc:12583
Change-Id: I688d0076270f85caa86256349753e5f0e0a44931
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211781
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33549}
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index 43f4be9..60ff8c2 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -161,6 +161,7 @@
   // TODO(hbos): Support enum types?
   // "RTCStatsMember<RTCStatsIceCandidatePairState>"?
   RTCStatsMember<std::string> state;
+  // Obsolete: priority
   RTCStatsMember<uint64_t> priority;
   RTCStatsMember<bool> nominated;
   // TODO(hbos): Collect this the way the spec describes it. We have a value for
@@ -208,6 +209,7 @@
   ~RTCIceCandidateStats() override;
 
   RTCStatsMember<std::string> transport_id;
+  // Obsolete: is_remote
   RTCStatsMember<bool> is_remote;
   RTCStatsMember<std::string> network_type;
   RTCStatsMember<std::string> ip;
@@ -220,9 +222,6 @@
   RTCStatsMember<int32_t> priority;
   // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723
   RTCStatsMember<std::string> url;
-  // TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|.
-  // crbug.com/632723
-  RTCStatsMember<bool> deleted;  // = false
 
  protected:
   RTCIceCandidateStats(const std::string& id,
@@ -376,6 +375,7 @@
 
   RTCStatsMember<uint32_t> ssrc;
   RTCStatsMember<std::string> kind;
+  // Obsolete: track_id
   RTCStatsMember<std::string> track_id;
   RTCStatsMember<std::string> transport_id;
   RTCStatsMember<std::string> codec_id;
@@ -505,9 +505,6 @@
   // audio and video but is only defined in the "video" case. crbug.com/657856
   RTCStatsMember<uint32_t> nack_count;
   RTCStatsMember<uint64_t> qp_sum;
-
-  // Obsolete
-  RTCStatsMember<bool> is_remote;  // = false
 };
 
 // https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
@@ -563,9 +560,6 @@
   // audio and video but is only defined in the "video" case. crbug.com/657856
   RTCStatsMember<uint32_t> nack_count;
   RTCStatsMember<uint64_t> qp_sum;
-
-  // Obsolete
-  RTCStatsMember<bool> is_remote;  // = false
 };
 
 // https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index 4c9dfa4..3f00a9c 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -314,8 +314,6 @@
     RTCInboundRTPStreamStats* inbound_stats) {
   RTC_DCHECK(inbound_stats);
   inbound_stats->ssrc = media_receiver_info.ssrc();
-  // TODO(hbos): Support the remote case. https://crbug.com/657855
-  inbound_stats->is_remote = false;
   inbound_stats->packets_received =
       static_cast<uint32_t>(media_receiver_info.packets_rcvd);
   inbound_stats->bytes_received =
@@ -496,8 +494,6 @@
     RTCOutboundRTPStreamStats* outbound_stats) {
   RTC_DCHECK(outbound_stats);
   outbound_stats->ssrc = media_sender_info.ssrc();
-  // TODO(hbos): Support the remote case. https://crbug.com/657856
-  outbound_stats->is_remote = false;
   outbound_stats->packets_sent =
       static_cast<uint32_t>(media_sender_info.packets_sent);
   outbound_stats->retransmitted_packets_sent =
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 655f7e6..3ccdde0 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -1235,7 +1235,6 @@
   expected_a_remote_srflx.protocol = "remote_srflx's protocol";
   expected_a_remote_srflx.candidate_type = "srflx";
   expected_a_remote_srflx.priority = 1;
-  expected_a_remote_srflx.deleted = false;
   EXPECT_TRUE(*expected_a_remote_srflx.is_remote);
 
   std::unique_ptr<cricket::Candidate> a_local_prflx = CreateFakeCandidate(
@@ -1251,7 +1250,6 @@
   expected_a_local_prflx.protocol = "a_local_prflx's protocol";
   expected_a_local_prflx.candidate_type = "prflx";
   expected_a_local_prflx.priority = 2;
-  expected_a_local_prflx.deleted = false;
   EXPECT_FALSE(*expected_a_local_prflx.is_remote);
 
   std::unique_ptr<cricket::Candidate> a_remote_relay = CreateFakeCandidate(
@@ -1266,7 +1264,6 @@
   expected_a_remote_relay.protocol = "a_remote_relay's protocol";
   expected_a_remote_relay.candidate_type = "relay";
   expected_a_remote_relay.priority = 3;
-  expected_a_remote_relay.deleted = false;
   EXPECT_TRUE(*expected_a_remote_relay.is_remote);
 
   std::unique_ptr<cricket::Candidate> a_local_relay = CreateFakeCandidate(
@@ -1284,7 +1281,6 @@
   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.
@@ -1301,7 +1297,6 @@
   expected_b_local.protocol = "b_local's protocol";
   expected_b_local.candidate_type = "host";
   expected_b_local.priority = 42;
-  expected_b_local.deleted = false;
   EXPECT_FALSE(*expected_b_local.is_remote);
 
   std::unique_ptr<cricket::Candidate> b_remote = CreateFakeCandidate(
@@ -1316,7 +1311,6 @@
   expected_b_remote.protocol = "b_remote's protocol";
   expected_b_remote.candidate_type = "host";
   expected_b_remote.priority = 42;
-  expected_b_remote.deleted = false;
   EXPECT_TRUE(*expected_b_remote.is_remote);
 
   // Add candidate pairs to connection.
@@ -1518,7 +1512,6 @@
   expected_local_candidate.protocol = "protocol";
   expected_local_candidate.candidate_type = "host";
   expected_local_candidate.priority = 42;
-  expected_local_candidate.deleted = false;
   EXPECT_FALSE(*expected_local_candidate.is_remote);
   ASSERT_TRUE(report->Get(expected_local_candidate.id()));
   EXPECT_EQ(expected_local_candidate,
@@ -1534,7 +1527,6 @@
   expected_remote_candidate.protocol = "protocol";
   expected_remote_candidate.candidate_type = "host";
   expected_remote_candidate.priority = 42;
-  expected_remote_candidate.deleted = false;
   EXPECT_TRUE(*expected_remote_candidate.is_remote);
   ASSERT_TRUE(report->Get(expected_remote_candidate.id()));
   EXPECT_EQ(expected_remote_candidate,
@@ -1973,7 +1965,6 @@
   RTCInboundRTPStreamStats expected_audio("RTCInboundRTPAudioStream_1",
                                           report->timestamp_us());
   expected_audio.ssrc = 1;
-  expected_audio.is_remote = false;
   expected_audio.media_type = "audio";
   expected_audio.kind = "audio";
   expected_audio.track_id = stats_of_track_type[0]->id();
@@ -2072,7 +2063,6 @@
   RTCInboundRTPStreamStats expected_video("RTCInboundRTPVideoStream_1",
                                           report->timestamp_us());
   expected_video.ssrc = 1;
-  expected_video.is_remote = false;
   expected_video.media_type = "video";
   expected_video.kind = "video";
   expected_video.track_id = IdForType<RTCMediaStreamTrackStats>(report);
@@ -2161,7 +2151,6 @@
   expected_audio.media_source_id = "RTCAudioSource_50";
   // |expected_audio.remote_id| should be undefined.
   expected_audio.ssrc = 1;
-  expected_audio.is_remote = false;
   expected_audio.media_type = "audio";
   expected_audio.kind = "audio";
   expected_audio.track_id = IdForType<RTCMediaStreamTrackStats>(report);
@@ -2245,7 +2234,6 @@
   expected_video.media_source_id = "RTCVideoSource_50";
   // |expected_video.remote_id| should be undefined.
   expected_video.ssrc = 1;
-  expected_video.is_remote = false;
   expected_video.media_type = "video";
   expected_video.kind = "video";
   expected_video.track_id = stats_of_track_type[0]->id();
@@ -2555,7 +2543,6 @@
                                            report->timestamp_us());
   expected_audio.media_source_id = "RTCAudioSource_50";
   expected_audio.ssrc = 1;
-  expected_audio.is_remote = false;
   expected_audio.media_type = "audio";
   expected_audio.kind = "audio";
   expected_audio.track_id = IdForType<RTCMediaStreamTrackStats>(report);
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc
index 8b12c67..4dd75a8 100644
--- a/pc/rtc_stats_integrationtest.cc
+++ b/pc/rtc_stats_integrationtest.cc
@@ -537,7 +537,6 @@
     verifier.TestMemberIsDefined(candidate.candidate_type);
     verifier.TestMemberIsNonNegative<int32_t>(candidate.priority);
     verifier.TestMemberIsUndefined(candidate.url);
-    verifier.TestMemberIsDefined(candidate.deleted);
     verifier.TestMemberIsUndefined(candidate.relay_protocol);
     return verifier.ExpectAllMembersSuccessfullyTested();
   }
@@ -830,7 +829,6 @@
     // this test. See RFC 3550.
     verifier.TestMemberIsNonNegative<int32_t>(inbound_stream.packets_lost);
     verifier.TestMemberIsDefined(inbound_stream.last_packet_received_timestamp);
-    verifier.TestMemberIsDefined(inbound_stream.is_remote);
     if (inbound_stream.frames_received.ValueOrDefault(0) > 0) {
       verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.frame_width);
       verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.frame_height);
@@ -961,7 +959,6 @@
                                        RTCAudioSourceStats::kType);
       verifier.TestMemberIsUndefined(outbound_stream.qp_sum);
     }
-    verifier.TestMemberIsDefined(outbound_stream.is_remote);
     verifier.TestMemberIsOptionalIDReference(
         outbound_stream.remote_id, RTCRemoteInboundRtpStreamStats::kType);
     verifier.TestMemberIsNonNegative<uint32_t>(outbound_stream.packets_sent);
diff --git a/stats/rtcstats_objects.cc b/stats/rtcstats_objects.cc
index 656cb4a..6b811ba 100644
--- a/stats/rtcstats_objects.cc
+++ b/stats/rtcstats_objects.cc
@@ -265,8 +265,7 @@
     &relay_protocol,
     &candidate_type,
     &priority,
-    &url,
-    &deleted)
+    &url)
 // clang-format on
 
 RTCIceCandidateStats::RTCIceCandidateStats(const std::string& id,
@@ -288,8 +287,7 @@
       relay_protocol("relayProtocol"),
       candidate_type("candidateType"),
       priority("priority"),
-      url("url"),
-      deleted("deleted", false) {}
+      url("url") {}
 
 RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
     : RTCStats(other.id(), other.timestamp_us()),
@@ -303,8 +301,7 @@
       relay_protocol(other.relay_protocol),
       candidate_type(other.candidate_type),
       priority(other.priority),
-      url(other.url),
-      deleted(other.deleted) {}
+      url(other.url) {}
 
 RTCIceCandidateStats::~RTCIceCandidateStats() {}
 
@@ -679,8 +676,7 @@
     &fir_count,
     &pli_count,
     &nack_count,
-    &qp_sum,
-    &is_remote)
+    &qp_sum)
 // clang-format on
 
 RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
@@ -736,8 +732,7 @@
       fir_count("firCount"),
       pli_count("pliCount"),
       nack_count("nackCount"),
-      qp_sum("qpSum"),
-      is_remote("isRemote") {}
+      qp_sum("qpSum") {}
 
 RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
     const RTCInboundRTPStreamStats& other)
@@ -789,8 +784,7 @@
       fir_count(other.fir_count),
       pli_count(other.pli_count),
       nack_count(other.nack_count),
-      qp_sum(other.qp_sum),
-      is_remote(other.is_remote) {}
+      qp_sum(other.qp_sum) {}
 
 RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {}
 
@@ -823,8 +817,7 @@
     &fir_count,
     &pli_count,
     &nack_count,
-    &qp_sum,
-    &is_remote)
+    &qp_sum)
 // clang-format on
 
 RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(const std::string& id,
@@ -861,8 +854,7 @@
       fir_count("firCount"),
       pli_count("pliCount"),
       nack_count("nackCount"),
-      qp_sum("qpSum"),
-      is_remote("isRemote") {}
+      qp_sum("qpSum") {}
 
 RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
     const RTCOutboundRTPStreamStats& other)
@@ -894,8 +886,7 @@
       fir_count(other.fir_count),
       pli_count(other.pli_count),
       nack_count(other.nack_count),
-      qp_sum(other.qp_sum),
-      is_remote(other.is_remote) {}
+      qp_sum(other.qp_sum) {}
 
 RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}