35 Commits

Author SHA1 Message Date
hbos
09bc128603 RTCMediaStream[Track]Stats added.
Not all members are collected by RTCStatsCollector and detached tracks
are not visible in the returned stats. This needs to be addressed before
closing crbug.com/660827 and crbug.com/659137

BUG=chromium:660827, chromium:659137, chromium:627816

Review-Url: https://codereview.webrtc.org/2467873005
Cr-Commit-Position: refs/heads/master@{#14978}
2016-11-08 14:29:26 +00:00
hbos
eeafe94f28 RTCInboundRTPStreamStats[1] added.
Not all stats are collected in this CL, this must be addressed before
closing the issue.

[1] https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*

  Re-landed after having to be reverted
  https://codereview.webrtc.org/2470683002/ due to depending on a CL
  that was reverted. Now that that has re-landed
  https://codereview.webrtc.org/2470703002/ this is ready to re-land.

BUG=chromium:627816, chromium:657855, chromium:657854
R=hta@webrtc.org
TBR=deadbeef@webrtc.org

Review-Url: https://codereview.webrtc.org/2465173003
Cr-Commit-Position: refs/heads/master@{#14868}
2016-11-01 10:00:24 +00:00
hbos
6ded190864 RTCOutboundRTPStreamStats[1] added.
This also adds RTCRTPStreamStats[2] which it derives from. Not all stats
are supported in this CL, this must be addressed before closing the
issue.

RTCStatsReport also gets a timestamp and ToString.

[1] https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
[2] https://w3c.github.io/webrtc-stats/#streamstats-dict*

  This was previously reverted https://codereview.webrtc.org/2465223002/
  because RTCStatsReport::Create added a new parameter not used by
  Chromium unittests. Temporarily added a default value to the argument
  to be removed after rolling and updating Chromium.

BUG=chromium:627816, chromium:657856, chromium:657854
TBR=deadbeef@webrtc.org

Review-Url: https://codereview.webrtc.org/2470703002
Cr-Commit-Position: refs/heads/master@{#14866}
2016-11-01 08:50:52 +00:00
perkj
7eaa83622b Revert of RTCOutboundRTPStreamStats added. (patchset #3 id:80001 of https://codereview.webrtc.org/2456463002/ )
Reason for revert:
Breaks Chrome FYI.
peerconnection_unittest calls RTCStatsReport::Create without  parameters.

Original issue's description:
> RTCOutboundRTPStreamStats[1] added.
>
> This also adds RTCRTPStreamStats[2] which it derives from. Not all stats
> are supported in this CL, this must be addressed before closing the
> issue.
>
> RTCStatsReport also gets a timestamp and ToString.
>
> [1] https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
> [2] https://w3c.github.io/webrtc-stats/#streamstats-dict*
>
> BUG=chromium:627816, chromium:657856, chromium:657854
>
> Committed: https://crrev.com/69e9cb08285f6cbcab547c7a5e6aa668fa6f2d29
> Cr-Commit-Position: refs/heads/master@{#14860}

TBR=hta@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:627816, chromium:657856, chromium:657854

Review-Url: https://codereview.webrtc.org/2465223002
Cr-Commit-Position: refs/heads/master@{#14863}
2016-11-01 06:52:28 +00:00
perkj
4ed075034a Revert of RTCInboundRTPStreamStats added. (patchset #4 id:100001 of https://codereview.webrtc.org/2452043002/ )
Reason for revert:
Dependend cl Breaks Chrome FYI.
peerconnection_unittest anropar RTCStatsReport::Create without  parameters.

Original issue's description:
> RTCInboundRTPStreamStats[1] added.
>
> Not all stats are collected in this CL, this must be addressed before
> closing the issue.
>
> [1] https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*
>
> BUG=chromium:627816, chromium:657855, chromium:657854
>
> Committed: https://crrev.com/0d7bf169402ea9345d163998f4f7df89229ac470
> Cr-Commit-Position: refs/heads/master@{#14861}

TBR=hta@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:627816, chromium:657855, chromium:657854

Review-Url: https://codereview.webrtc.org/2470683002
Cr-Commit-Position: refs/heads/master@{#14862}
2016-11-01 06:51:00 +00:00
hbos
0d7bf16940 RTCInboundRTPStreamStats[1] added.
Not all stats are collected in this CL, this must be addressed before
closing the issue.

[1] https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*

BUG=chromium:627816, chromium:657855, chromium:657854

Review-Url: https://codereview.webrtc.org/2452043002
Cr-Commit-Position: refs/heads/master@{#14861}
2016-10-31 22:31:09 +00:00
hbos
69e9cb0828 RTCOutboundRTPStreamStats[1] added.
This also adds RTCRTPStreamStats[2] which it derives from. Not all stats
are supported in this CL, this must be addressed before closing the
issue.

RTCStatsReport also gets a timestamp and ToString.

[1] https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
[2] https://w3c.github.io/webrtc-stats/#streamstats-dict*

BUG=chromium:627816, chromium:657856, chromium:657854

Review-Url: https://codereview.webrtc.org/2456463002
Cr-Commit-Position: refs/heads/master@{#14860}
2016-10-31 21:48:44 +00:00
hbos
67c8bc4bf2 RTCStats equality operator added.
This will be helpful in unittests to EXPECT_EQ reports. It should be a
useful operator to have outside of testing as well.

BUG=chromium:627816
NOTRY=True

Review-Url: https://codereview.webrtc.org/2441543002
Cr-Commit-Position: refs/heads/master@{#14767}
2016-10-25 11:31:27 +00:00
hbos
2fa7c67675 RTCTransportStats[1] added, supporting all members.
Address TODO in rtcstatscollector_unittest.cc before closing 653873.

[1] https://w3c.github.io/webrtc-stats/#transportstats-dict*

BUG=chromium:653873, chromium:633550, chromium:627816

Review-Url: https://codereview.webrtc.org/2408363002
Cr-Commit-Position: refs/heads/master@{#14740}
2016-10-24 11:00:12 +00:00
hbos
cc555c5019 RTCDataChannelStats[1] added, supporting all stats members.
Also updates MockDataChannel to also mock id, messages_sent, bytes_sent,
messages_received and bytes_received.

[1] https://w3c.github.io/webrtc-stats/#dcstats-dict*

BUG=chromium:654927, chromium:627816

Review-Url: https://codereview.webrtc.org/2420473002
Cr-Commit-Position: refs/heads/master@{#14670}
2016-10-18 19:48:37 +00:00
kjellander
e40a7ee007 GN: Exclude suppressions of Chromium Clang warnings for Chromium builds.
These suppressions are causing GN errors when Chromium targets are depending
directly on WebRTC targets (needed for https://codereview.chromium.org/2413103004)

BUG=webrtc:4256
NOTRY=True

Review-Url: https://codereview.webrtc.org/2408133008
Cr-Commit-Position: refs/heads/master@{#14644}
2016-10-17 06:56:20 +00:00
hbos
c47a0c3ac4 RTCIceCandidatePairStats[1] added.
Note: In this initial CL most stats members are missing. This needs to
be addressed before closing the RTCIceCandidatePairStats bug
(crbug.com/633550).

[1] https://w3c.github.io/webrtc-stats/#candidatepair-dict*

BUG=chromium:633550, chromium:627816

Review-Url: https://codereview.webrtc.org/2390693003
Cr-Commit-Position: refs/heads/master@{#14604}
2016-10-11 21:54:55 +00:00
hbos
ab9f6e4dea RTCIceCandidateStats[1] added.
The RTCStatsCollector collects candidates from candidate pairs. Note
that there may be other candidates that are not paired with anything,
stats for these should also be produced before closing crbug.com/632723.

[1] https://w3c.github.io/webrtc-stats/#icecandidate-dict*

BUG=chromium:627816, chromium:632723

Review-Url: https://codereview.webrtc.org/2384143002
Cr-Commit-Position: refs/heads/master@{#14565}
2016-10-07 09:18:55 +00:00
hbos
fc5e0504ea rtc_stats: Update code to remove chromium style warnings suppression.
The warning previously suppressed made it possible to define tings like
constructors in the header, and "complex" objects did not need to have
an explicit out-of-line copy constructor, destructor, etc.

To be able to not suppress this warning, the RTCStats macro was split
into a WEBRTC_RTCSTATS_DECL() and WEBRTC_RTCSTATS_IMPL() for .h and .cc
respectively. Some copy constructors are also defined.

BUG=chromium:627816

Review-Url: https://codereview.webrtc.org/2373503002
Cr-Commit-Position: refs/heads/master@{#14545}
2016-10-06 09:06:16 +00:00
hbos
b20f38792e RTCStatsMember<bool> and RTCStatsMember<std::vector<bool>> added.
RTCStatsMemberInterface::Type's kBool and kSequenceBool.

This means that RTCStats-derived classes ("RTCStats-derived
dictionaries"[1]) can contain boolean and sequence of boolean members.

[1] https://w3c.github.io/webrtc-stats/

BUG=chromium:627816
NOTRY=True

Review-Url: https://codereview.webrtc.org/2387343002
Cr-Commit-Position: refs/heads/master@{#14509}
2016-10-04 21:37:15 +00:00
hbos
6ab97ce0b9 RTCCertificateStats[1] added.
[1] https://w3c.github.io/webrtc-stats/#certificatestats-dict*

BUG=chromium:627816, chromium:629436
NOTRY=True

Review-Url: https://codereview.webrtc.org/2243123002
Cr-Commit-Position: refs/heads/master@{#14484}
2016-10-03 21:17:03 +00:00
kjellander
b62dbbe985 GN: Change rtc_source_set targets --> rtc_static_library
This changes most non-test related rtc_source_set targets to be
rtc_static_library instead. Targets without any .cc files are excluded.
This should bring back the build behavior we used to have with GYP
(i.e. same symbols exported in the libjingle_peerconnection.a file, which
are used by some downstream projects).

After doing an Android build with these changes:
$ nm --defined-only -g -C out/Release/lib.unstripped/libjingle_peerconnection_so.so | grep -i createpeerconnectionf
00077c51 T Java_org_webrtc_PeerConnectionFactory_nativeCreatePeerConnectionFactory
$ nm --defined-only -g -C out/Release/obj/webrtc/api/libjingle_peerconnection.a | grep -i createpeerconnectionf
00000001 T webrtc::CreatePeerConnectionFactory(rtc::Thread*, rtc::Thread*, rtc::Thread*, webrtc::AudioDeviceModule*, cricket::WebRtcVideoEncoderFactory*, cricket::WebRtcVideoDecoderFactory*)
00000001 T webrtc::CreatePeerConnectionFactory()

See https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/cookbook.md#Note-on-static-libraries
for more details on this.

NOTICE: This should be further cleaned up in the future, to reduce
binary bloat and unnecessary linking time. Right now it's more
important to restore the desired build output though.

BUG=webrtc:6410, chromium:630755

Review-Url: https://codereview.webrtc.org/2361623004
Cr-Commit-Position: refs/heads/master@{#14364}
2016-09-23 07:38:58 +00:00
hbos
27e177c8d8 RTCTestStats moved into webrtc/stats/test (rtc_stats_test_utils)
BUG=chromium:627816
NOTRY=True

Review-Url: https://codereview.webrtc.org/2354523002
Cr-Commit-Position: refs/heads/master@{#14289}
2016-09-19 13:06:05 +00:00
hbos
74e1a4f96a PeerConnection[Interface]::GetStats(RTCStatsCollectorCallback*) added.
New file structure and targets:

rtc_stats_api
  webrtc/api/stats/rtcstats.h
  webrtc/api/stats/rtcstats_objects.h
  webrtc/api/stats/rtcstatsreport.h

rtc_stats (dep on rtc_stats_api)
  webrtc/stats/rtcstats.cc
  webrtc/stats/rtcstats_objects.cc
  webrtc/stats/rtcstatsreport.cc

libjingle_peerconnection (dep on rtc_stats)
  webrtc/api/rtcstatscollector.cc
  webrtc/api/rtcstatscollector.h

Placing rtc_stats_api headers in this separate target instead of
libjingle_peerconnection avoids a circular dependency
libjingle_peerconnection -> rtc_stats -> libjingle_peerconnection

Code changes:

PeerConnectionInterface::GetStats(RTCStatsCollectorCallback*) added for
the new stats collection API. Implemented by PeerConnection.

BUG=chromium:627816

Review-Url: https://codereview.webrtc.org/2331373004
Cr-Commit-Position: refs/heads/master@{#14246}
2016-09-16 06:33:04 +00:00
hbos
8faf9e047e Removed the const char* (StaticString) type from RTCStatsMember.
std::string is all we need. const char* is an annoying special case
because they can't be compared with ==. Having two different string
types was a premature optimization.

BUG=chromium:627816
NOTRY=True

Review-Url: https://codereview.webrtc.org/2340303002
Cr-Commit-Position: refs/heads/master@{#14235}
2016-09-15 13:52:50 +00:00
kjellander
17f008bf33 GYP: Remove targets inside include_tests==1 that are converted to GN.
Remove a large number of targets that are no longer built, to reduce maintenance.
Only targets that have a GN version were removed.

BUG=webrtc:6323
NOTRY=True
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2340773003
Cr-Commit-Position: refs/heads/master@{#14231}
2016-09-15 11:57:39 +00:00
kjellander
705ecc5dda GN: Change group deps to public_deps.
During GN vs GYP auditing it was discovered that some
GN targets that had public_configs were not exposing them
to dependents where the dependent depended on a group, which
in turn included that target as a dependency. Instead of
changing those public_configs to all_dependent_configs
(which would be a change from GYP), it's better to just change
those group targets to use public_deps instead.

BUG=webrtc:6323
NOTRY=True
TESTED=Generated GYP and GN project files on Mac and ran the
tools/gyp_flag_compare.py script before and after this patch was
applied. The file in question used for inspection was the
webrtc/api/webrtcsessiondescriptionfactory.cc
which is a part of the libjingle_peerconnection target.

Review-Url: https://codereview.webrtc.org/2344623002
Cr-Commit-Position: refs/heads/master@{#14222}
2016-09-15 07:53:34 +00:00
hbos
fdafab84bc Fix issues with rtc_stats_unittests tests so that they can run on bots.
This target is not run on bots so a couple of issues went under the
radar. If we expose the tests and run them on the bots[1] two issues are
surfaced which this CL fixes. After this CL lands we can enable this
target on the bots without it going red.

rtcstats_unittest.cc: Fix const char* string comparison issue by
comparing with strcmp instead of equality check.

rtcstatscollector_unittest.cc: Fix TSAN issue by constructing
ScopedFakeClock before spawning Threads.

[1] https://codereview.webrtc.org/2340443002/

BUG=chromium:627816
NOTRY=True

Review-Url: https://codereview.webrtc.org/2333343002
Cr-Commit-Position: refs/heads/master@{#14215}
2016-09-14 13:02:20 +00:00
nisse
cdf37a9293 Delete Timing class, timing.h, and update all users.
BUG=webrtc:6324

Review-Url: https://codereview.webrtc.org/2290203002
Cr-Commit-Position: refs/heads/master@{#14203}
2016-09-14 06:41:55 +00:00
Henrik Kjellander
a41c13e6a2 OWNERS: Make everyone able to change *.gn,*.gni files.
Project-wide change to make it possible for all team members
to do changes to GN files.

NOTRY=True
R=kwiberg@webrtc.org
TBR=henrika@webrtc.org

Review URL: https://codereview.webrtc.org/2320043002 .

Cr-Commit-Position: refs/heads/master@{#14163}
2016-09-09 12:51:48 +00:00
ehmaldonado
e9cc686293 GN Templates: Move common_inherited_config to the template.
Remove common_inherited_config from the targets and add it to the
template instead.

BUG=webrtc:6187
NOTRY=True

Review-Url: https://codereview.webrtc.org/2311843002
Cr-Commit-Position: refs/heads/master@{#14069}
2016-09-05 13:10:23 +00:00
hbos
c82f2e1613 RTCStatsCollector collecting stats on multiple threads.
Changes GetStatsReport to a callback-based function. Stats collection
is dispatched to three different stats collecting methods, being
invoked asynchronously on the signaling, worker and network threads.
The three resulting stats reports are merged into one before returned.

The only current stats being collected is on the signaling thread, but
a FakeRTCStatsCollector is able to test the multi-threaded and
stats-merging behaviors. Future CLs simply have to put their stats
collecting code in the appropriate ProducePartialResultsOnFooThread
method.

BUG=chromium:627816

Review-Url: https://codereview.webrtc.org/2270033004
Cr-Commit-Position: refs/heads/master@{#14064}
2016-09-05 08:36:54 +00:00
ehmaldonado
7a2ce0b738 GN Templates: Move common_config to the template.
Remove common_config from the targets' config and add
it to the template instead.

BUG=webrtc:6187
NOTRY=True

Review-Url: https://codereview.webrtc.org/2300413002
Cr-Commit-Position: refs/heads/master@{#14063}
2016-09-05 08:35:48 +00:00
ehmaldonado
38a2132b02 GN: Introduce templates.
Defines the rtc_executable, rtc_source_set, rtc_test and
rtc_static_library templates.

These templates provide no functionality yet, but will enable common
configuration to be introduced, avoiding repetition in every target

Changes summary:
- Prepend rtc_ to test, source_set, executable and static_library targets
- Change "configs -= [" to "suppressed_configs += ["
- Include webrtc/build/webrtc.gni where it wasn't included yet
- Delete import("//testing/test.gni"), since rtc_test makes it unnecessary.

BUG=webrtc:6187
TBR=henrik.lundin@webrtc.org,tommi@webrtc.org
NOTRY=True

Review-Url: https://codereview.webrtc.org/2301053002
Cr-Commit-Position: refs/heads/master@{#14043}
2016-09-02 11:10:41 +00:00
hbos
0e6758d7ef RTCStatsCollector: timestamps updated.
Using a timestamp based on a timer that is monotonically increasing for
the cache, so that cache's freshness can be checked regardless of if
system clock is modified.

Using a system clock for the stats' timestamp, which needs to be
relative to UNIX epoch (Jan 1, 1970, UTC).

This CL removes the dependency on faketiming.h.

BUG=chromium:627816
NOTRY=True

Review-Url: https://codereview.webrtc.org/2299643002
Cr-Commit-Position: refs/heads/master@{#13997}
2016-08-31 14:57:44 +00:00
hbos
d565b73121 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}
2016-08-30 21:04:40 +00:00
hbos
6d183ac27a RTCStatsReport: Take ownership of other's stats with TakeMembersFrom
This would make it possible to gather stats on multiple threads, store
the results in multiple reports and to merge the results.

Added rtcstatsreport_unittest.cc, moving a RTCStatsReport-related test
from rtcstats_unittest.cc. Added more unittests covering the order of
stats and TakeMembersFrom.

Also changed RTCStatsReport[] to RTCStatsReport::Get to avoid
confusion with other usages of the [] operator.

BUG=chromium:627816
NOTRY=True

Review-Url: https://codereview.webrtc.org/2278433003
Cr-Commit-Position: refs/heads/master@{#13957}
2016-08-29 14:20:39 +00:00
ehmaldonado
d02fe4b53b GN: Fix windows clang errors. Attempt 2.
BUG=webrtc:6255
NOTRY=True

Review-Url: https://codereview.webrtc.org/2281513002
Cr-Commit-Position: refs/heads/master@{#13942}
2016-08-26 20:31:34 +00:00
Henrik Kjellander
b4677de9b0 Adding GYP/GN owners to stats/ aligning with all other dirs.
TBR=hbos@webrtc.org

Review URL: https://codereview.webrtc.org/2279313004 .

Cr-Commit-Position: refs/heads/master@{#13941}
2016-08-26 20:22:17 +00:00
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