hbos 615d3013de RTCStats and RTCStatsReport added (webrtc/stats).
The old and new getStats are very different. This CL proposes rewriting
the new getStats from scratch with a bottom-up approach, starting with
the fundamental stats classes. This will allow cleaner and more
efficient code that is more aligned with the spec.

RTCStats and subclasses are the equivalent to RTCStats and RTCStats-
-derived dictionaries from the specs[1][2]. The dictionary members are
public member variables of type RTCStatsMember<T>, where T is one of the
supported types. All members derive from RTCStatsMemberInterface and
iteration of members is possible with RTCStats::Members().
The members are not stored in a map for performance and readability.
Type checking is supported with static class variables, kType.

Only the supported member types T are specialized and may be
instantiated, and sequences are supported with std::vector<...>. Type
checking is again supported with static class variables, kType.

RTCStatsReport is the equivalent from the spec[3], and maps RTCStats::id
to RTCStats-objects. RTCStatsReport is reference counted. It and its
contained stats may be destroyed on any thread. When the
RTCStatsCollector is added in a follow-up CL, it will return const
references to the RTCStatsReports. This means copies don't have to be
made for multiple stats observers or when jumping threads. In fact, no
copies of any stats will have to be made in surfacing stats to Blink.

[1] https://www.w3.org/TR/2016/WD-webrtc-20160531/#rtcstats-dictionary
[2] https://w3c.github.io/webrtc-stats/archives/20160526/webrtc-stats.html
[3] https://www.w3.org/TR/2016/WD-webrtc-20160531/#rtcstatsreport-object

This adds the new folder webrtc/stats/, with target rtc_stats and binary
rtc_stats_unittests. Public api headers are placed in webrtc/api/ and
.cc files are placed in webrtc/stats/.

BUG=chromium:627816

Review-Url: https://codereview.webrtc.org/2241093002
Cr-Commit-Position: refs/heads/master@{#13879}
2016-08-24 08:33:19 +00:00

208 lines
6.7 KiB
Python

# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
{
'includes': [ '../build/common.gypi', ],
'conditions': [
['os_posix == 1 and OS != "mac" and OS != "ios"', {
'conditions': [
['sysroot!=""', {
'variables': {
'pkg-config': '../../../build/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)"',
},
}, {
'variables': {
'pkg-config': 'pkg-config'
},
}],
],
}],
# Excluded from the Chromium build since they cannot be built due to
# incompability with Chromium's logging implementation.
['OS=="android" and build_with_chromium==0', {
'targets': [
{
'target_name': 'libjingle_peerconnection_jni',
'type': 'static_library',
'dependencies': [
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:metrics_default',
'libjingle_peerconnection',
],
'sources': [
'android/jni/androidmediacodeccommon.h',
'android/jni/androidmediadecoder_jni.cc',
'android/jni/androidmediadecoder_jni.h',
'android/jni/androidmediaencoder_jni.cc',
'android/jni/androidmediaencoder_jni.h',
'android/jni/androidmetrics_jni.cc',
'android/jni/androidnetworkmonitor_jni.cc',
'android/jni/androidnetworkmonitor_jni.h',
'android/jni/androidvideocapturer_jni.cc',
'android/jni/androidvideocapturer_jni.h',
'android/jni/androidvideotracksource_jni.cc',
'android/jni/classreferenceholder.cc',
'android/jni/classreferenceholder.h',
'android/jni/jni_helpers.cc',
'android/jni/jni_helpers.h',
'android/jni/native_handle_impl.cc',
'android/jni/native_handle_impl.h',
'android/jni/peerconnection_jni.cc',
'android/jni/surfacetexturehelper_jni.cc',
'android/jni/surfacetexturehelper_jni.h',
'androidvideocapturer.cc',
'androidvideocapturer.h',
'androidvideotracksource.cc',
'androidvideotracksource.h',
],
'include_dirs': [
'<(libyuv_dir)/include',
],
# TODO(kjellander): Make the code compile without disabling these flags.
# See https://bugs.chromium.org/p/webrtc/issues/detail?id=3307
'cflags': [
'-Wno-sign-compare',
'-Wno-unused-variable',
],
'cflags!': [
'-Wextra',
],
'msvs_disabled_warnings': [
4245, # conversion from 'int' to 'size_t', signed/unsigned mismatch.
4267, # conversion from 'size_t' to 'int', possible loss of data.
4389, # signed/unsigned mismatch.
],
},
{
'target_name': 'libjingle_peerconnection_so',
'type': 'shared_library',
'dependencies': [
'libjingle_peerconnection',
'libjingle_peerconnection_jni',
],
'sources': [
'android/jni/jni_onload.cc',
],
'variables': {
# This library uses native JNI exports; tell GYP so that the
# required symbols will be kept.
'use_native_jni_exports': 1,
},
},
]
}],
], # conditions
'targets': [
{
'target_name': 'libjingle_peerconnection',
'type': 'static_library',
'dependencies': [
'<(webrtc_root)/media/media.gyp:rtc_media',
'<(webrtc_root)/pc/pc.gyp:rtc_pc',
],
'sources': [
'audiotrack.cc',
'audiotrack.h',
'datachannel.cc',
'datachannel.h',
'datachannelinterface.h',
'dtmfsender.cc',
'dtmfsender.h',
'dtmfsenderinterface.h',
'jsep.h',
'jsepicecandidate.cc',
'jsepicecandidate.h',
'jsepsessiondescription.cc',
'jsepsessiondescription.h',
'localaudiosource.cc',
'localaudiosource.h',
'mediaconstraintsinterface.cc',
'mediaconstraintsinterface.h',
'mediacontroller.cc',
'mediacontroller.h',
'mediastream.cc',
'mediastream.h',
'mediastreaminterface.h',
'mediastreamobserver.cc',
'mediastreamobserver.h',
'mediastreamproxy.h',
'mediastreamtrack.h',
'mediastreamtrackproxy.h',
'notifier.h',
'peerconnection.cc',
'peerconnection.h',
'peerconnectionfactory.cc',
'peerconnectionfactory.h',
'peerconnectionfactoryproxy.h',
'peerconnectioninterface.h',
'peerconnectionproxy.h',
'proxy.h',
'remoteaudiosource.cc',
'remoteaudiosource.h',
'rtcstats.h',
'rtcstatsreport.h',
'rtpparameters.h',
'rtpreceiver.cc',
'rtpreceiver.h',
'rtpreceiverinterface.h',
'rtpsender.cc',
'rtpsender.h',
'rtpsenderinterface.h',
'sctputils.cc',
'sctputils.h',
'statscollector.cc',
'statscollector.h',
'statstypes.cc',
'statstypes.h',
'streamcollection.h',
'videocapturertracksource.cc',
'videocapturertracksource.h',
'videosourceproxy.h',
'videotrack.cc',
'videotrack.h',
'videotracksource.cc',
'videotracksource.h',
'webrtcsdp.cc',
'webrtcsdp.h',
'webrtcsession.cc',
'webrtcsession.h',
'webrtcsessiondescriptionfactory.cc',
'webrtcsessiondescriptionfactory.h',
],
'conditions': [
['clang==1', {
'cflags!': [
'-Wextra',
],
'xcode_settings': {
'WARNING_CFLAGS!': ['-Wextra'],
},
}, {
'cflags': [
'-Wno-maybe-uninitialized', # Only exists for GCC.
],
}],
['use_quic==1', {
'dependencies': [
'<(DEPTH)/third_party/libquic/libquic.gyp:libquic',
],
'sources': [
'quicdatachannel.cc',
'quicdatachannel.h',
'quicdatatransport.cc',
'quicdatatransport.h',
],
'export_dependent_settings': [
'<(DEPTH)/third_party/libquic/libquic.gyp:libquic',
],
}],
],
}, # target libjingle_peerconnection
], # targets
}