Closed henbos closed 7 months ago
Shall I create a PR for...? @padenot @jan-ivar
interface MediaStreamTrackAudioStats {
...
// Added in https://github.com/w3c/mediacapture-extensions/pull/124
readonly attribute DOMHighResTimeStamp? latency;
// New PR:
readonly attribute DOMHighResTimeStamp? averageLatency;
readonly attribute DOMHighResTimeStamp? minLatency;
readonly attribute DOMHighResTimeStamp? maxLatency;
// Resets min/max/average so that the next time `track.stats´ is called these values represent the
// min/max/average since `resetLatency()` was called.
void resetLatency();
};
Nullable because if we've just reset the latencies we don't have any latency measure to min/max/avg over.
Do we need nullable? Why not just set averageLatency = minLatency = maxLatency = latency at that point?
That would work, except that latency is not known until the first time that a measurement is made. So if you just called getUserMedia I don't think you necessarily know what the latency is yet. Unless you think the user agent could have some sensible default there
We could default it to 0 just to avoid nullables, the app could still check if deliveredFrames > 0 for this edge case
I think we can remove nullable, when it is reset min/max/avg = current latency. Since we removed nullable from current latency.
As previously discussed in meetings, an app wants to know average latency over an interval that the app decides on, but as @padenot pointed out, for these averages not to hide extremes, we should also have min and max.
During our meeting the proposal that I believe everyone would be happy with is exposing min/max/avg since the last time
track.stats.resetLatency()
was called (feel free to have opinions about attribute and method names we did not decide anything).