Commit graph

153 commits

Author SHA1 Message Date
Henrik Boström
ac58a334f7 [Stats] Migrate from the RTCStatsMember type alias to absl::optional.
With this CL, the only usage of RTCStatsMember within WebRTC is the
actual type alias declaration. It's not referenced anywhere anymore.

This allows us to deleting the type alias, but let's do that in a
standalone CL in case it gets reverted.

Bug: webrtc:15164
Change-Id: I766d07abb62b5ddd524859b8ed749394fc439e52
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/335621
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41612}
2024-01-25 21:56:08 +00:00
Henrik Boström
c0ac4df7a5 Reland "[Stats] Move metric names to Attribute, constructed via AttributeInit."
This is a reland of commit 84c48ae751

Original change's description:
> [Stats] Move metric names to Attribute, constructed via AttributeInit.
>
> As of this CL, Attribute no longer implements RTCStatsMemberInterface
> and a member no longer owns knowing its own name. The attribute knows
> the name because we pass it down at construction time.
>
> To achieve this, the WEBRTC_RTCSTATS_IMPL() macro is updated to take
> AttributeInits instead of raw member pointers, i.e. (name, ptr) pairs.
>
> By constructing RTCStatsMember<T> without a name parameter, it does the
> same thing as the absl::optional<T> constructor. So RTCStatsMember<T>'s
> days are numbered!
>
> Bug: webrtc:15164
> Change-Id: I560c0134bae1c2d7218426a1576425ecc1b677a7
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334203
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Evan Shrubsole <eshr@google.com>
> Cr-Commit-Position: refs/heads/main@{#41540}

Bug: webrtc:15164
Change-Id: I28f3d588004ff185e5820347ad9513f2f7a6cc66
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/335020
Auto-Submit: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41556}
2024-01-18 10:10:57 +00:00
Mirko Bonadei
df3b3bd06f Revert "[Stats] Move metric names to Attribute, constructed via AttributeInit."
This reverts commit 84c48ae751.

Reason for revert: Breaks downstream project

Original change's description:
> [Stats] Move metric names to Attribute, constructed via AttributeInit.
>
> As of this CL, Attribute no longer implements RTCStatsMemberInterface
> and a member no longer owns knowing its own name. The attribute knows
> the name because we pass it down at construction time.
>
> To achieve this, the WEBRTC_RTCSTATS_IMPL() macro is updated to take
> AttributeInits instead of raw member pointers, i.e. (name, ptr) pairs.
>
> By constructing RTCStatsMember<T> without a name parameter, it does the
> same thing as the absl::optional<T> constructor. So RTCStatsMember<T>'s
> days are numbered!
>
> Bug: webrtc:15164
> Change-Id: I560c0134bae1c2d7218426a1576425ecc1b677a7
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334203
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Evan Shrubsole <eshr@google.com>
> Cr-Commit-Position: refs/heads/main@{#41540}

Bug: webrtc:15164
Change-Id: I9f416838153b26d4560ae98c37fb18a803d0295d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334901
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41550}
2024-01-17 17:00:22 +00:00
Henrik Boström
84c48ae751 [Stats] Move metric names to Attribute, constructed via AttributeInit.
As of this CL, Attribute no longer implements RTCStatsMemberInterface
and a member no longer owns knowing its own name. The attribute knows
the name because we pass it down at construction time.

To achieve this, the WEBRTC_RTCSTATS_IMPL() macro is updated to take
AttributeInits instead of raw member pointers, i.e. (name, ptr) pairs.

By constructing RTCStatsMember<T> without a name parameter, it does the
same thing as the absl::optional<T> constructor. So RTCStatsMember<T>'s
days are numbered!

Bug: webrtc:15164
Change-Id: I560c0134bae1c2d7218426a1576425ecc1b677a7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334203
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/main@{#41540}
2024-01-17 09:10:10 +00:00
Henrik Boström
8005d5613e Add stats-related TODOs with crbugs.
Someone wondered why framesRendered has not been implemented. I had a
look, and discovered that a) we need to implement it, and b) our entire
inter-frame, pause, and freeze metrics are measured at the wrong time
because what WebRTC considered "OnRenderedFrame()" is not actually when
the frame was rendered.

So that we don't forget this again, I filed two crbugs and added TODOs
in the code for future reference to anyone interested in these metrics.

Bug: webrtc:15600, webrtc:15601
Change-Id: Id38df7874df715e9b9c0410efa4a9bc2af5d6232
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324306
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40987}
2023-10-23 09:53:11 +00:00
Philipp Hancke
e2e04513e7 stats: implement fecSsrc on inbound-rtp
which is present if a fec mechanism like FlexFEC is negotiated

spec change:
  https://github.com/w3c/webrtc-stats/pull/765

BUG=webrtc:15250

Change-Id: I7d71d49fab0153d734f22831e6684d2acfc647fb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/314981
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40514}
2023-08-04 12:54:48 +00:00
Philipp Hancke
9b82b2f8d6 stats: implement RTX ssrc on inbound-rtp/outbound-rtp
spec change:
  https://github.com/w3c/webrtc-stats/pull/765

BUG=webrtc:15096

Change-Id: I7c72193c23460330b6bb612a9568641d187ee638
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/312362
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40510}
2023-08-04 08:41:52 +00:00
Philipp Hancke
17e8a5cc7d stats: implement flexfec fecBytesReceived stats for FlexFEC
specified in https://github.com/w3c/webrtc-stats/pull/762
and take FlexFEC into account for receive statistics.

BUG=webrtc:15250

Change-Id: Id85775ab1f29487d5b8bf478da6e22071005901a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/294881
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#40325}
2023-06-21 13:04:31 +00:00
Henrik Boström
c929ab49b9 Reland "[Stats] Remove enum-like structs in favor of strings."
This is a reland of commit ccc87ea3c6

Downstream project has been updated.

Original change's description:
> [Stats] Remove enum-like structs in favor of strings.
>
> Due to a limitation of RTCStatsMember<T> not supporting enums, as well
> as the fact that in JavaScript enums are represented as basic strings,
> the stats enums have always been represented by T=std::string.
>
> Now that we have WebIDL-ified[1] all RTCStats dictionaries and enum
> values are simply string-copied (example: [2]) it seems safe to assume
> that "stats enums are just strings" is here to stay.
>
> Therefore there is little value in having C++ structs that look like
> enums so I'm deleting those in favor of std::string operator==()
> comparisons, e.g. `if (rtp_stream.kind == "audio")`. This removes some
> lines of code from our code base.
>
> I mostly want to get rid of these because they were taking up about 20%
> of the rtcstats_objects.h real estate...
>
> [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/peerconnection/rtc_stats_report.idl
> [2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/peerconnection/rtc_stats_report.cc;l=667;drc=cf34e84c9df94256abfb1716ba075ed203975755
>
> Bug: webrtc:15245
> Change-Id: Iaf0827d7aecebc1cc02976a61663d5298d684f07
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308680
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#40295}

Bug: webrtc:15245
Change-Id: Ibc7aeb518ed0bd7f1d725f140132c99e5a89bcf3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308880
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40305}
2023-06-17 15:41:44 +00:00
Christoffer Jansson
45666d4b01 Revert "[Stats] Remove enum-like structs in favor of strings."
This reverts commit ccc87ea3c6.

Reason for revert: Breaks downstream project

Original change's description:
> [Stats] Remove enum-like structs in favor of strings.
>
> Due to a limitation of RTCStatsMember<T> not supporting enums, as well
> as the fact that in JavaScript enums are represented as basic strings,
> the stats enums have always been represented by T=std::string.
>
> Now that we have WebIDL-ified[1] all RTCStats dictionaries and enum
> values are simply string-copied (example: [2]) it seems safe to assume
> that "stats enums are just strings" is here to stay.
>
> Therefore there is little value in having C++ structs that look like
> enums so I'm deleting those in favor of std::string operator==()
> comparisons, e.g. `if (rtp_stream.kind == "audio")`. This removes some
> lines of code from our code base.
>
> I mostly want to get rid of these because they were taking up about 20%
> of the rtcstats_objects.h real estate...
>
> [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/peerconnection/rtc_stats_report.idl
> [2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/peerconnection/rtc_stats_report.cc;l=667;drc=cf34e84c9df94256abfb1716ba075ed203975755
>
> Bug: webrtc:15245
> Change-Id: Iaf0827d7aecebc1cc02976a61663d5298d684f07
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308680
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#40295}

Bug: webrtc:15245
Change-Id: I05db80ba9f29460239de82cea9d95136e4c708e4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308860
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Christoffer Jansson <jansson@webrtc.org>
Owners-Override: Christoffer Jansson <jansson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40298}
2023-06-16 06:29:26 +00:00
Henrik Boström
ccc87ea3c6 [Stats] Remove enum-like structs in favor of strings.
Due to a limitation of RTCStatsMember<T> not supporting enums, as well
as the fact that in JavaScript enums are represented as basic strings,
the stats enums have always been represented by T=std::string.

Now that we have WebIDL-ified[1] all RTCStats dictionaries and enum
values are simply string-copied (example: [2]) it seems safe to assume
that "stats enums are just strings" is here to stay.

Therefore there is little value in having C++ structs that look like
enums so I'm deleting those in favor of std::string operator==()
comparisons, e.g. `if (rtp_stream.kind == "audio")`. This removes some
lines of code from our code base.

I mostly want to get rid of these because they were taking up about 20%
of the rtcstats_objects.h real estate...

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/peerconnection/rtc_stats_report.idl
[2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/peerconnection/rtc_stats_report.cc;l=667;drc=cf34e84c9df94256abfb1716ba075ed203975755

Bug: webrtc:15245
Change-Id: Iaf0827d7aecebc1cc02976a61663d5298d684f07
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308680
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40295}
2023-06-15 16:11:27 +00:00
Henrik Boström
0f1376529a Delete RTC[NonStandard/Restricted]StatsMember.
Whether a metric is to be exposed to JavaScript or not is a blink
implementation detail that the WebRTC repository does not need to be
concerned with.

This CL removes unused code and paves the way for the possibility of
making the one and only RTCStatsMember class be absl::optional<>-based
in the future.

Bug: webrtc:15162
Change-Id: I578715f48b8fcc3534b72b4c700fd6567f8d553e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304722
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40139}
2023-05-25 08:39:48 +00:00
Henrik Boström
979b0479a1 Revert "Temporarily add dummy trackId to unblock roll."
This reverts commit 3df4178d59.

Reason for revert: This dummy variable is no longer needed to make
importer happy

Original change's description:
> Temporarily add dummy trackId to unblock roll.
>
> NOTRY=True
>
> Bug: webrtc:15198
> Change-Id: I3090b90c549da3f2368001f2049bbf1d66042af4
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306400
> Reviewed-by: Markus Handell <handellm@webrtc.org>
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#40130}

Bug: webrtc:15198
Change-Id: Ib47471259de72771292887050d1576707a473eec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306401
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40135}
2023-05-24 15:50:44 +00:00
Henrik Boström
3df4178d59 Temporarily add dummy trackId to unblock roll.
NOTRY=True

Bug: webrtc:15198
Change-Id: I3090b90c549da3f2368001f2049bbf1d66042af4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306400
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40130}
2023-05-24 12:54:43 +00:00
Henrik Boström
4e231eedbd Delete deprecated 'track' and 'stream' metrics from WebRTC.
Track stats are roughly equal in size as the RTP stream stats which
are the largest objects making up the majority of the RTCStatsReport
size and scales with meeting size. Deleting track/stream reduces the
size in approximately half which should reduce performance overhead
and unblock code simplifications.

Blocked on:
- https://chromium-review.googlesource.com/c/chromium/src/+/4517530

# Relevant bots already passed
NOTRY=True

Bug: webrtc:14175, webrtc:14419
Change-Id: Ib7bdb84c10459b42b829228d11876498e5227312
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/289043
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40129}
2023-05-24 12:26:56 +00:00
Philipp Hancke
e0034a800e stats: remove media_type which was an alias for kind
The web compat requirement that was the reason for keeping
is now solved in Chromium and its stats bindings.

BUG=webrtc:9674

Change-Id: Ifb722769414b2bcc5f4d36d7dff87a875336e039
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/303860
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40024}
2023-05-09 11:46:52 +00:00
Philipp Hancke
f78d1f211a stats: Implement receive RTX stats
* retransmittedBytesReceived
* retransmittedPacketsReceived
added to the specification in
  https://github.com/w3c/webrtc-stats/pull/735

BUG=webrtc:15096

Change-Id: I6770e5d8d09ac1c2693c918fd943b0ab257ec7ba
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295260
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#39959}
2023-04-27 09:53:00 +00:00
Philipp Hancke
2b72d84733 stats: fix type of inbound-rtp frames_received
which gets assigned from a uint32_t VideoReceiverInfo::frames_received so should remain an unsigned type

BUG=None

Change-Id: I1db6a3f96c4ff49eee72dcce54eb6fff346c128c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/302342
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#39958}
2023-04-26 15:57:46 +00:00
Philipp Hancke
b3e5969658 stats: use uint64_t for RTCSentRtpStreamStats.packetsSent
spec update from https://github.com/w3c/webrtc-stats/pull/744

BUG=webrtc:14989

Change-Id: I9d0adcf951501bc281054c77bb6bc03e47192523
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295505
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#39575}
2023-03-16 06:46:19 +00:00
Philipp Hancke
d3289d2ec0 Reland "stats: remove RTCRtpInboundRTPStream and RTCRtpoutboundRTPStream aliases"
This is a reland of commit 9671d60925
after fixing more downstream dependencies

Original change's description:
> stats: remove RTCRtpInboundRTPStream and RTCRtpoutboundRTPStream aliases
>
> after upgrading downstream projects
>
> BUG=webrtc:14973
>
> Change-Id: I5df8e95a1c70b1d6078e255166c36ed01f868b6a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296820
> Reviewed-by: Christoffer Jansson <jansson@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#39526}

No-Try: True
Bug: webrtc:14973
Change-Id: I33bd99ca211a82ed77e3e8676e00256915fde168
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296881
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39533}
2023-03-10 15:22:01 +00:00
Henrik Boström
4463ff0296 Revert "stats: remove RTCRtpInboundRTPStream and RTCRtpoutboundRTPStream aliases"
This reverts commit 9671d60925.

Reason for revert: Breaks dependencies, will re-land after fixes

Original change's description:
> stats: remove RTCRtpInboundRTPStream and RTCRtpoutboundRTPStream aliases
>
> after upgrading downstream projects
>
> BUG=webrtc:14973
>
> Change-Id: I5df8e95a1c70b1d6078e255166c36ed01f868b6a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296820
> Reviewed-by: Christoffer Jansson <jansson@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#39526}

Bug: webrtc:14973
Change-Id: I50878526566660d9772f7c8664970eec8bd86341
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296940
Reviewed-by: Philipp Hancke <phancke@microsoft.com>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39530}
2023-03-10 13:24:32 +00:00
Philipp Hancke
9671d60925 stats: remove RTCRtpInboundRTPStream and RTCRtpoutboundRTPStream aliases
after upgrading downstream projects

BUG=webrtc:14973

Change-Id: I5df8e95a1c70b1d6078e255166c36ed01f868b6a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296820
Reviewed-by: Christoffer Jansson <jansson@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#39526}
2023-03-10 12:12:41 +00:00
Philipp Hancke
1f98b466b8 stats: rename RTCInboundRTPStreamStats and RTCOutboundRTPStreamStats
to RTCInboundRtpStreamStats and RTCOutboundRtpStreamStats respectively
which follows the camel-casing convention used elsewhere.

The old name is kept around as an alias for a limited amount of time
to allow upgrading dependencies.

BUG=webrtc:14973

Change-Id: Ibf4e65933fd6cc2e7e89955042f6f8fb0f6c7853
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296261
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#39497}
2023-03-07 14:27:47 +00:00
Philipp Hancke
1f80451932 Fix stats inheritance and rename RTP to Rtp
making RTCOutboundRtpStreamStats inherit from RTCSentRtpStreamStats
as defined in
  https://www.w3.org/TR/webrtc-stats/#outboundrtpstats-dict*

This removes the duplicated definitions of packetsSent and bytesSent.

BUG=webrtc:14948

Change-Id: I184998b65d59dbd0d1288733d55d8a884e6de970
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295660
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39481}
2023-03-06 13:43:27 +00:00
Philipp Hancke
e5ab6c3bb0 stats: remove deprecated timestamp_us constructor variant
BUG=webrtc:14813

Change-Id: I56d28385f679b399cb2059f4c4c3d43e84a89b8e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/293580
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39346}
2023-02-20 12:18:42 +00:00
Fredrik Hernqvist
5adc2b6969 Correct RTCAudioPlayoutStats type and add kind field.
Bug: webrtc:14653
Change-Id: Idb85ce440620fc5b818a3b23a63ac062a443cc81
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291330
Commit-Queue: Fredrik Hernqvist <fhernqvist@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39196}
2023-01-25 14:30:41 +00:00
Fredrik Hernqvist
828de8036d Populate RTCInboundRtpStreamStats::playoutId when appropriate
Bug: webrtc:14653
Change-Id: I0c59604b218d0839a126c02914626b8ed2bee76c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291040
Commit-Queue: Fredrik Hernqvist <fhernqvist@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39149}
2023-01-19 15:44:36 +00:00
Fredrik Hernqvist
efbe753617 Add RTCAudioPlayoutStats to GetStats().
This is done by allowing implementations of AudioDeviceModule to
implement the GetStats() method. The default implementation returns
nullopt, in which case RTCAudioPlayoutStats will not be visible in the
stats.

Bug: webrtc:14653
Change-Id: I8e4aa6f1b8fcfa47a30f633d28a4013191752e20
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290563
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Fredrik Hernqvist <fhernqvist@google.com>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Olga Sharonova <olka@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39115}
2023-01-16 13:19:45 +00:00
Philipp Hancke
e137c4592e stats: deprecate timestamp_us constructor and method
in favor of the Timestamp constructor and method.
The constructor is most likely not used outside libWebRTC,
the call to
  .timestamp_us()
can be replaced with
  .timestamp().us()

BUG=webrtc:14813

Change-Id: Id166b4f85b2425ecec1c7ebb81406f82ff9d95c9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290727
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#39066}
2023-01-11 11:40:05 +00:00
Philipp Hancke
b81823a5f0 stats: use Timestamp instead of uint64_t
making it clear what unit is being used.

BUG=webrtc:13756

Change-Id: I6354d35a8e02bb93a905ccf32cb0b294b4813e41
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/289460
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39008}
2023-01-05 08:37:31 +00:00
Philipp Hancke
7a5de44455 api: use std::string in stats constructor
instead of const reference or rvalues. This follows the style guide:
  https://google.github.io/styleguide/cppguide.html#Rvalue_references

BUG=webrtc:14807

Change-Id: I936b99146520815ae8105806409d46565fa83546
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/289985
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#38996}
2023-01-04 10:44:24 +00:00
Evan Shrubsole
9b235cd93b Add scalability mode to RTCOutboundRtpStreamStats stats
This is in the webrtc-stats spec at
https://www.w3.org/TR/webrtc-stats/#dom-rtcoutboundrtpstreamstats-scalabilitymode.

This adds the scalability mode to CodecSpecificInfo which is used to
plumb the modes for each simulcast layer.

TBR=orphis@webrtc.org

Tested: Compiled into Chrome and confirmed the scalability mode set for AV1, VP9, VP8 and H264 software encoders in chrome://webrtc-internals.
Bug: webrtc:14730
Change-Id: I71ceba8f6485a4f4a73e0856031b8d5f16f913f2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285085
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38847}
2022-12-08 11:46:06 +00:00
Evan Shrubsole
f4abcc0bbb [stats] Mark codec implementation stats as exposing hardware capability
This means that these stats will be filtered out by JavaScript unless
the conditions for exposing hardware capabilities are met. These
conditions are described in the webrtc-stats spec at
https://w3c.github.io/webrtc-stats/#limiting-exposure-of-hardware-capabilities.

R=hbos@webrtc.org

Bug: chromium:1369050,chromium:1369049
Change-Id: I05bdb72ef6789417488c7e786e8713ce99a91f8a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279960
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38594}
2022-11-09 13:55:18 +00:00
Evan Shrubsole
13c0be44b3 Add power efficient stats to RTC stats
As the exposure of power efficient stats to JavaScript are limited as
to reduce the fingerprinting surface to getStats, a new RTCStatsMember
derivation, RTCLimitedStatsMember, was added in this change. This sets
the exposure criteria of the stat on the type, which keeps the size of
the RTCStatsMember class the same and allows for extension in the future
for new types of stat restrictions.

Bug: webrtc:14483
Change-Id: Ib0303050a112441ba2416fd5f004dd8be26b47ca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279021
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38576}
2022-11-08 08:35:47 +00:00
Philipp Hancke
0487c5797a stats: implement candidate-pair lastPacket(Sent|Received)Timestamp
https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-lastpacketsenttimestamp
https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-lastpacketreceivedtimestamp

which are useful together with the ice-restart-necessary logic mentioned
in
  https://w3c.github.io/webrtc-pc/#dictionary-rtcofferoptions-members

BUG=webrtc:14619

Change-Id: I4a8ab00a37fbd4af8b948720c83787cbdfc6b9a3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281281
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#38534}
2022-11-02 12:16:21 +00:00
Henrik Boström
adbcbf73fa [Stats] Delete 'track' metrics that have previously been moved.
These have all been moved to "inbound-rtp" and now that upstream
projects have migrated we can delete the old location.

Unblocks https://crbug.com/webrtc/14175

Bug: webrtc:14521, webrtc:14524
Change-Id: Ia2bfa399d62304cc0ead0e65c340dfad20acc530
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281183
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38532}
2022-11-02 09:21:04 +00:00
Henrik Boström
45b35d442d Unship track.totalFramesDuration/sumSquaredFrameDurations.
These metrics were not only non-standard, but residing in the
non-standard "track" stats object that we want to delete. As per
https://github.com/w3c/webrtc-stats/issues/695#issuecomment-1259611462
these metrics are no longer needed because we already have
inbound-rtp.totalInterFrameDelay/totalSquaredInterFrameDelay which is
basically the same thing.

// mac_rel infra failures are unrelated
NOTRY=True

Bug: webrtc:14522
Change-Id: I565da42514a93f15532ba8357dd006547a5296ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278100
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38509}
2022-10-31 15:09:10 +00:00
Henrik Boström
aebba7b468 [Stats] Expose totalPacketSendDelay for audio as well.
This information is now readily available. Let's expose it.

In practise we don't pace audio by default and the delay is ~0, however
we can tell that this metric is working as intended by setting
PacingController's pace_audio_ to true via the "WebRTC-Pacer-BlockAudio"
field trial. In this case chrome://webrtc-internals/ plots neats graphs
for audio send delay.

Bug: webrtc:10635
Change-Id: Iecfd93bb84ec61e5d54232769a9e7a500601b199
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280523
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38483}
2022-10-27 10:33:16 +00:00
Henrik Boström
c5f8f800a2 [Stats] Add googTimingFrameInfo to the modern API.
This is exposing something that is already exposed in the legacy
getStats() API and is only available if the "video-timing" header
extension is used. Adding this metric here should unblock legacy
getStats() API deprecation. The follow-up to unship or standardize this
metric is tracked by https://crbug.com/webrtc/14586.

Bug: webrtc:14587
Change-Id: Ic3d45b0558d7caf4be2856a4cd95b88db312f85e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279860
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38444}
2022-10-19 17:02:18 +00:00
Henrik Boström
15166b2fa4 [ModernStats] Mark obsolete stats as [[deprecated]].
This includes the stats dictionaries that have been made obsolete in
the spec and whose IDs are prefixed "DEPRECATED_":
- RTCMediaStreamTrackStats
- RTCMediaStreamStats

There is an ongoing experiment to unship these stats dictionaries in
Chrome (https://crbug.com/1374215). Marking then as [[deprecated]] helps
alert other dependencies that these classes are deprecated.

In the meantime, the "DEPRECATED_RTCMediaStreamTrackStats" prefix makes
it possible to use the deprecated classes.

# Unrelated infra failures
NOTRY=True

Bug: webrtc:14175, webrtc:14419
Change-Id: I498d370294058a628278e1e5b027cd12e24ad31a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279700
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38439}
2022-10-19 09:58:37 +00:00
Philipp Hancke
95d880291f stats: make inbound-rtp frame assembly time standard
standardized in
  https://github.com/w3c/webrtc-stats/pull/694

BUG=webrtc:13986

Change-Id: Ia24e7fa64a48ad6c88882c90fd03bd1d89408ea4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278789
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38390}
2022-10-13 15:14:38 +00:00
Henrik Boström
2fb83072db Move more non-standard metrics to inbound-rtp.
They may be non-standard, but they shouldn't be on a stats dictionary
that is deprecated (track is going away soon-ish). By moving them to
inbound-rtp they can continue to exist beyond track deprecation and
live in the right place in case we decide to standardize them later.

To help downstream projects transitions, the metrics are temporarily
available in both old and new locations. Delete of old location will
happen in a follow-up CL. TODOs added.

Bug: webrtc:14524
Change-Id: I2008060fa4ba76cde859d9144d2bb9648c7ff9af
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278200
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38315}
2022-10-07 07:22:04 +00:00
Henrik Boström
c57a28c46b Move pause and freeze metrics to standardized location.
These metrics were recently standardized. Part of the standardization
effort was to move them from obsolete "track" stats (on track for
deprecation and removal: https://crbug.com/webrtc/14175) into the
"inbound-rtp" stats which are not deprecated.

To ease transition for downstream projects, the metrics are temporarily
duplicated in both the old and new locations. In a follow-up CL, they
will be deleted from "track".

Bug: webrtc:14521
Change-Id: I0d9036472607a8c717ec823a458a79a49ddb80c7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278080
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38308}
2022-10-06 10:52:22 +00:00
Henrik Boström
a494e4b517 Move packetsDiscarded to inbound-rtp.
packetsDiscarded was previously moved to RTCInboundRtpStreamStats:
https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*

Bug: webrtc:14514
Change-Id: I322b64ede4e64cef1c8234e9626121d96d945355
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/277820
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38297}
2022-10-05 09:00:18 +00:00
Philipp Hancke
0e3cd63062 stats: add missing ice candidate stats
added in https://github.com/w3c/webrtc-stats/pull/611
* foundation
* relatedAddress
* relatedPort
* usernameFragment
* tcpType

BUG=webrtc:14480

Change-Id: I5f43373fbbc7c780b8dafb6e2ace2c27f5e22970
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276780
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38292}
2022-10-04 18:02:28 +00:00
Byoungchan Lee
636dc3d208 Implement RTCOutboundRtpStreamStats.targetBitrate for video
Spec: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-targetbitrate

Bug: webrtc:13394
Change-Id: I4749b38088a24d1a775137d5fe2c65f96effd185
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276380
Auto-Submit: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38170}
2022-09-22 12:37:30 +00:00
Philipp Hancke
684e241323 stats: implement outbound-rtp.active
implementing
  https://github.com/w3c/webrtc-stats/pull/649

BUG=webrtc:14291

Change-Id: Ib8453d4d7c335834cd8dd2aa29111aef26211dff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269520
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#37639}
2022-07-28 13:35:40 +00:00
Ivo Creusen
1a84b565ac Implement RTCInboundRTPStreamStats.JitterBufferMinimumDelay
This metric was recently added to the standard (see https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-jitterbufferminimumdelay). This CL implements it for audio streams.

Bug: webrtc:14141
Change-Id: I79d918639cd12361ebbc28c2be41549e33fa7e2a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262770
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37567}
2022-07-20 09:14:03 +00:00
Ivo Creusen
11fdb08282 Implement RTCInboundRTPStreamStats.JitterBufferTargetDelay
This CL also removes the existing non-standard implementation of the metric.

Bug: webrtc:14147, webrtc:11789
Change-Id: I70fd1c451dfd59380fe5ce959086f37b31697c16
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265360
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37441}
2022-07-05 11:34:53 +00:00
Henrik Boström
1ab61886a9 Implement Outbound/InboundRtpStreamStats.mid.
This is what allowed us to remove "transceiver" stats from the spec.

Bug: webrtc:14191
Change-Id: I687a2dd97de016832005cb4271f6e1a0e0560cd3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266022
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/main@{#37247}
2022-06-17 08:44:09 +00:00