Remove RTCRemoteInboundRtpStreamStats duplicate members. The RTCReceivedRtpStreamStats hierarchy, which inherit from RTCRtpStreamStats, already contain members ssrc, kind, codec_id and transport_id so there's no need to list them inside RTCRemoteInboundrtpStreamStats. This CL removes duplicates so that we don't DCHECK-crash on Android, and adds a unit test ensuring we never accidentally list the same member twice. Bug: webrtc:12658 Change-Id: I27925eadddc6224bf6d6a91784ed7cafd7a4cfb3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214343 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33649}
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc index 01409ed..2bf026e 100644 --- a/pc/rtc_stats_integrationtest.cc +++ b/pc/rtc_stats_integrationtest.cc
@@ -1285,6 +1285,20 @@ } } } + +TEST_F(RTCStatsIntegrationTest, GetStatsContainsNoDuplicateMembers) { + StartCall(); + + rtc::scoped_refptr<const RTCStatsReport> report = GetStatsFromCallee(); + for (const RTCStats& stats : *report) { + std::set<std::string> member_names; + for (const auto* member : stats.Members()) { + EXPECT_TRUE(member_names.find(member->name()) == member_names.end()) + << member->name() << " is a duplicate!"; + member_names.insert(member->name()); + } + } +} #endif // WEBRTC_HAVE_SCTP } // namespace
diff --git a/stats/rtcstats_objects.cc b/stats/rtcstats_objects.cc index 6b811ba..dcd2aeb 100644 --- a/stats/rtcstats_objects.cc +++ b/stats/rtcstats_objects.cc
@@ -894,10 +894,6 @@ WEBRTC_RTCSTATS_IMPL( RTCRemoteInboundRtpStreamStats, RTCReceivedRtpStreamStats, "remote-inbound-rtp", - &ssrc, - &kind, - &transport_id, - &codec_id, &local_id, &round_trip_time, &fraction_lost,