w3c / mediacapture-extensions

Extensions to Media Capture and Streams by the WebRTC Working Group
https://w3c.github.io/mediacapture-extensions/
Other
19 stars 14 forks source link

[Track Stats API] When to initialize frame counting #116

Closed henbos closed 6 months ago

henbos commented 9 months ago

In issue #112, @youennf expressed a desire to asynchronously expose the MediaStreamTrackVIdeoStats, or to have a ready promise, in order to allow optimizations for use cases that don't care about track stats. This would only be the init steps, and does not challenge the TPAC decision that the frame counter attributes are synchronous getters.

@jan-ivar commented that instead of initializing, we could let the user agent give a less accurate value the first time the getters are called.

henbos commented 9 months ago

Personally I think it would be fine to let the user agent optimize for accuracy depending on how often the getters are called, and I'm not sure the spec even needs to say anything about this, but we could add a note.

henbos commented 8 months ago

I sensed no WG interest or technical reason for delaying frame counting and the API has now been implemented and shipped in Chromium browsers without delaying initialization. For this reason I would like to close this issue (WontFix).

henbos commented 8 months ago

On the performance side, the lockless ring buffer can even be set up cross-process, so beyond sending a couple of pointers of shared memory over initially, this is a zero-overhead API. And on the ergonomics side it's pretty clear that it's nicer to use an API without having to say up front that you want to use it later.