RTCStatsCollector and RTCPeerConnectionStats added. This is the stats collector for the new stats types, RTCStats[1] and RTCStatsReport[2]. It so far only produces RTCPeerConnectionStats[3] as an example of how it would collect stats. Each RTCStats subclass will get a corresponding RTCStatsCollector::ProduceFooStats(). Stats reports are cached and returned as const references (ref counting). This allows stats to be inspected by multiple observers and across multiple threads. No copies will have to be made when surfacing this to Blink or other places. The current implementation of ProducePeerConnectionStats() only look at existing DataChannels. This might be incorret if data channels can be removed? Will investigate in a follow-up, crbug.com/636818. [1] https://www.w3.org/TR/2016/WD-webrtc-20160531/#idl-def-rtcstats [2] https://www.w3.org/TR/2016/WD-webrtc-20160531/#rtcstatsreport-object [3] https://w3c.github.io/webrtc-stats/archives/20160526/webrtc-stats.html#pcstats-dict* BUG=chromium:627816, chromium:636818 Review-Url: https://codereview.webrtc.org/2242043002 Cr-Commit-Position: refs/heads/master@{#13979}
diff --git a/webrtc/stats/BUILD.gn b/webrtc/stats/BUILD.gn index 2f69216..d1c08bd 100644 --- a/webrtc/stats/BUILD.gn +++ b/webrtc/stats/BUILD.gn
@@ -20,12 +20,20 @@ cflags = [] sources = [ "rtcstats.cc", + "rtcstats_objects.cc", + "rtcstatscollector.cc", + "rtcstatscollector.h", "rtcstatsreport.cc", ] configs += [ "..:common_config" ] public_configs = [ "..:common_inherited_config" ] + if (is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } + deps = [ "../api:libjingle_peerconnection", ] @@ -37,12 +45,18 @@ testonly = true sources = [ "rtcstats_unittest.cc", + "rtcstatscollector_unittest.cc", "rtcstatsreport_unittest.cc", ] configs += [ "..:common_config" ] public_configs = [ "..:common_inherited_config" ] + if (is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } + deps = [ ":rtc_stats", "../base:rtc_base_tests_utils", @@ -53,11 +67,5 @@ if (is_android) { deps += [ "//testing/android/native_test:native_test_native_code" ] } - - if (is_clang) { - # Suppress warnings from Chrome's Clang plugins. - # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. - configs -= [ "//build/config/clang:find_bad_constructs" ] - } } }