Git Product home page Git Product logo

Comments (7)

henbos avatar henbos commented on July 23, 2024

@fippo

from webrtc-stats.

henbos avatar henbos commented on July 23, 2024

I don't think this is controversial so using labels "Editorial" and "Ready for PR"

from webrtc-stats.

fippo avatar fippo commented on July 23, 2024

Yeah, this is mostly wordsmithing. But behold, this is a can of worms.

IMO encoderImplementation/decoderImplementation fall under this

When a counted feature hasn't been used yet, but may happen in the future, report a count of zero.

but for strings. For these it may make sense to include the empty string despite guidance against this in the sentence before.
I think it is the only two cases? Easy... but behold...

"may happen in the future" is vague. What this means is you:

  • should include packetsLost (even though you may never loose a packet)
    since it means that you can safely subtract stats from two times T_a and T_b without worrying about a value being undefined a T_a.

This applies to some things that are not "counted" but should be covered like STUN RTT. This should be 0 initially and be present. It is clear that this has not happened yet because responsesReceived is still 0.

STUN currentRoundTripTime however should not be present before a response has been received.
Neither should audioLevel before you decode or send a packet.
Both values are instantaneous. Following that logic, decoderImplementation should not be set either.

For RTCP we have conflicting guidance in here to only include when a RR with a non-zero DLSR field was received (and yep, that takes some time, say hello to flaky tests). This seems slightly off, the intention is to count valid round trip times and only increment for those.

Now trying to summarize that I would say the guidance should be

  • When a cumulative feature hasn't been used yet report a count of zero so stats values from two points in time can be safely subtracted.
  • When an momentary feature hasn't been used yet, omit the dictionary member

from webrtc-stats.

henbos avatar henbos commented on July 23, 2024

If there is no current (e.g. currentRoundTripTime), then it is not applicable. Not applicable => undefined.
Same reasoning applies to encoderImplementation. If there is no current encoder, then enoderImplementation is not applicable, so its undefined.

A counted feature starting at 0 is separate, if something has happened no times then the counter is 0, its a superflous sentence in the spec

from webrtc-stats.

jan-ivar avatar jan-ivar commented on July 23, 2024

"4.2 Guidelines for implementing stats objects" already says to use undefined if "a feature is not applicable"

It doesn't say that. It says: "When a feature is not applicable to an instance of an object (for example audioLevel on a video stream), omit the dictionary member. Do NOT report a count of zero, -1 or "empty string"."

It says to "omit" the member, which is different from a value of undefined. audioLevel: "Only exists for audio."

E.g. here audioLevel exists:

{audioLevel: undefined}

...and here it is omitted:

{}

AFAIK WebIDL bindings coerce the former into the latter on input (e.g. dictionaries as arguments to a method), but not output.

from webrtc-stats.

jan-ivar avatar jan-ivar commented on July 23, 2024

(I'm interpreting defined/undefined in this thread to mean missing/present/exists. See #737. LMK if that's not right)

While there might be some value today in knowing immediately whether a browser supports a stat or not, such value should diminish over time, so omitting members until they can be accurately reported seems superior to me to the alternatives.

There's probably some precedence here with stats objects of type remote-inbound-rtp and remote-outbound-rtp which don't appear until rtcp packets have been received (e.g. comment out the await wait(5000) in this fiddle).

from webrtc-stats.

henbos avatar henbos commented on July 23, 2024

You're right I meant missing when I said undefined. We should fix #737.

from webrtc-stats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.