[webrtc-stats] Relax the way framesPerSecond is calculated. (#612)

bc-lee has just created a new issue for https://github.com/w3c/webrtc-stats:

== Relax the way framesPerSecond is calculated. ==
Currently, `framesPerSecond` ([RTCInboundRtpStreamStats](https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-framespersecond), [RTCOutboundRtpStreamStats](https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-framespersecond) , [RTCVideoSourceStats](https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats-framespersecond)) is defined as the number of encoded frames during the last second.

The problem with the current definition is that it is too restrictive to calculate `framesPerSecond` **exactly within the last second**. To conform to the spec, the implementation needs to bookkeep the last 1-second amount of the frame's timestamp since it doesn't know when `getStats()` is called.
In my opinion, the implementation may want to choose how framesPerSecond is calculated, like `RTCAudioSourceStats.audioLevel`, to simplify its logic while reducing the complexity of implementation.

Also, except for `RTCVideoSourceStats.framesPerSecond`, these values are informative. Users of webrtc-stats easily calculate exact FPS from consecutive two `getStats()` calls by using `framesDecoded` / `framesEncoded`

Please view or discuss this issue at https://github.com/w3c/webrtc-stats/issues/612 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 8 November 2021 13:40:22 UTC