[webrtc-stats] Need some way of getting an averaged audio level stat

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

== Need some way of getting an averaged audio level stat ==
`RTCMediaStreamTrackStats.audioLevel` only represents the level of the last encoded/decoded chunk of audio, or so I assume (may need to be clarified, see https://github.com/w3c/webrtc-stats/issues/193). So it's not useful for all use cases. If `getStats` is called at the wrong time, it may see an `audioLevel` of 0, just because it happened to be called during a blip of silence. The application may really be more interested in an average level over a certain time period.

The guideline for "averaged" stats is to provide "sum" and "count" fields, such that the application can compute an average over any time interval by dividing "sum/count" for that interval. This is a bit more complicated for audioLevel, since it's based on the root mean square (RMS) of audio samples. So we would have to do something like provide a sum of "mean square X sample duration" (say, "totalAudioEnergy"), and a "totalDuration", and let the application compute the average audio level as "sqrt(totalAudioEnergy)/totalDuration".

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

Received on Thursday, 11 May 2017 17:43:20 UTC