RTCStatsReport::AddStats DCHECKs that the ID is unique.
Previously it was allowed to call AddStats with stats of the same ID
multiple times.
This revealed a few things:
- Local and remote streams can have the same label.
RTCMediaStreamStats's ID is updated to include "local"/"remote".
- The same certificate can show up multiple times (e.g. for local and
remote in a loopback), so we skip creating RTCCertificateStats for the
same certificate multiple times
BUG=chromium:627816
Review-Url: https://codereview.webrtc.org/2593503003
Cr-Commit-Position: refs/heads/master@{#15730}
diff --git a/webrtc/api/rtcstatscollector_unittest.cc b/webrtc/api/rtcstatscollector_unittest.cc
index 4be7491..8941818 100644
--- a/webrtc/api/rtcstatscollector_unittest.cc
+++ b/webrtc/api/rtcstatscollector_unittest.cc
@@ -969,6 +969,7 @@
*a_local_prflx.get();
a_transport_channel_stats.connection_infos[1].remote_candidate =
*a_remote_relay.get();
+ session_stats.transport_stats["a"].transport_name = "a";
session_stats.transport_stats["a"].channel_stats.push_back(
a_transport_channel_stats);
@@ -979,6 +980,7 @@
*b_local.get();
b_transport_channel_stats.connection_infos[0].remote_candidate =
*b_remote.get();
+ session_stats.transport_stats["b"].transport_name = "b";
session_stats.transport_stats["b"].channel_stats.push_back(
b_transport_channel_stats);
@@ -1164,7 +1166,7 @@
rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport();
RTCMediaStreamStats expected_local_stream(
- "RTCMediaStream_LocalStreamLabel", report->timestamp_us());
+ "RTCMediaStream_local_LocalStreamLabel", report->timestamp_us());
expected_local_stream.stream_identifier = local_stream->label();
expected_local_stream.track_ids = std::vector<std::string>();
expected_local_stream.track_ids->push_back(
@@ -1175,7 +1177,7 @@
RTCMediaStreamStats>());
RTCMediaStreamStats expected_remote_stream(
- "RTCMediaStream_RemoteStreamLabel", report->timestamp_us());
+ "RTCMediaStream_remote_RemoteStreamLabel", report->timestamp_us());
expected_remote_stream.stream_identifier = remote_stream->label();
expected_remote_stream.track_ids = std::vector<std::string>();
expected_remote_stream.track_ids->push_back(
@@ -1301,7 +1303,7 @@
rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport();
RTCMediaStreamStats expected_local_stream(
- "RTCMediaStream_LocalStreamLabel", report->timestamp_us());
+ "RTCMediaStream_local_LocalStreamLabel", report->timestamp_us());
expected_local_stream.stream_identifier = local_stream->label();
expected_local_stream.track_ids = std::vector<std::string>();
expected_local_stream.track_ids->push_back(
@@ -1312,7 +1314,7 @@
RTCMediaStreamStats>());
RTCMediaStreamStats expected_remote_stream(
- "RTCMediaStream_RemoteStreamLabel", report->timestamp_us());
+ "RTCMediaStream_remote_RemoteStreamLabel", report->timestamp_us());
expected_remote_stream.stream_identifier = remote_stream->label();
expected_remote_stream.track_ids = std::vector<std::string>();
expected_remote_stream.track_ids->push_back(