Git Product home page Git Product logo

webrtc-stats's Introduction

WebRTC Stats

Build Status

This is the webrtc-stats document, a working document of the W3C WebRTC Working Group.

The editors' work-in-progress version of the document is at https://w3c.github.io/webrtc-stats/

To run the tests defined for the repo, do the following:

  • nvm use 8 (node 8 is required to run the following steps)
  • make clean
  • make setup
  • make update
  • make check

To produce a consistently formatted file:

  • make tidy

webrtc-stats's People

Contributors

aboba avatar alvestrand avatar balazskreith avatar bdrtc avatar dontcallmedom avatar drkron avatar eshrubs avatar fippo avatar foolip avatar henbos avatar hernqvist avatar ilyanikolaevskiy avatar ivocreusen avatar jan-ivar avatar jonasore avatar kaptenjansson avatar lennart-csio avatar minyuel avatar plehegar avatar rasmusbrandt avatar redopop avatar shacharz avatar soareschen avatar taylor-b avatar tidoust avatar tjwudi avatar vivienlacourba avatar vr000m avatar youennf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webrtc-stats's Issues

Consider putting roundTripTime on RTCInboundStreamStats

Per mailing list discussion: For a local RTCOutboundRTPStreamStats, the RTT is calculated based on received RTCP RR reports. The rest of the RTCP-derived data is placed in the remote RTCInboundRTPStreamStats, with an appropriate timestamp. RTT should go there too.

Consideration: Can RTT be calculated at all on local RTCInboundStreamStats?

"detached" needs more description

The text about "detached" for a MediaStreamTrack is not completely clear. The text needs to say that it MUST continue to appear, with the counters frozen at the values at the time of detaching, and the timestamp set to the detach time. If it is reattached, counters will increment again.

Discrepancies between RTCRtpCodecParameters and RTCCodecStats naming

RTCCodecStats has "codec" and "parameters" whereas RTCRtpCodecParameters has "mimeType" and "sdpFmtpLine" which seem to mean the same things.

If these are indeed expected to contain the same information, it would be nice if the names aligned. I slightly prefer the RTCRtpCodecParameters names; they seem more descriptive.

Implementing the Circuit Breaker based on StatsAPI

Information for calculating the Circuit breaker with the information in the Stats.

CB Trigger 1. latest timestamp of a packet for each SSRC. Covers both sent and received streams
CB Trigger 2. latest timestamp of the RTCP packet for each SSRC. I believe this is covered with the timestamp in the remote stats.
CB Trigger 3. TFRC can be computed with the information, although one piece of information that is missing is the average RTCP interval.

Unpaired candidates need to be marked as local or remote

At the moment, one is supposed to figure out whether a candidate is local or remote based on its position in a candidate pair.

This doesn't cover the case where you have candidates that aren't paired with anything - for instance IPv6 local candidates when talking to an IPv4-only remote system.

There should be an "isRemote = false" field on RTCIceCandidateStats, just like we have on RTCRTPStreamStats.

Need definition for RTCTransportStats.activeConnection

The definition for RTCTransportStats.activeConnection is "Set to true when transport is active."

But there's no definition of what "active" means. It might be that the RTCIceTransport that it corresponds to has its state in {connecting, completed}, or it might mean something else. Clarification needed.

RTCMediaStreamTrackStats does not have mediaType member.

The "RTC[In/Out]boundRTPStreamStats : RTCRTPStreamStats" dictionaries are valid for both audio and video. RTCRTPStreamStats has a DOMString mediaType that is either "audio" or "video" to distinguish the two cases.

RTCMediaStreamTrackStats is also valid for both audio and video, but it has no mediaType member. You'd have to examine the other members (some of which are only valid for audio or video) to deduce if its for audio or video.

We should add "DOMString mediaType" to RTCMediaStreamTrackStats.

  • Side-question: Why is this a DOMString and not an enum? Should we change it to enum for both dictionaries?

Alternatively we could split it up into "RTCMediaStream[Audio/Video]TrackStats : RTCMediaStreamTrackStats". Its members are mostly audio- or video-specific so why are all of the members in the same dictionary?

RTT metrics in milliseconds or seconds?

currently the spec is not clear on what the unit for all RTT measurements are. In one place it says (seconds), and for the other no units are presented.

Should the RTT metrics be reported in milliseconds or seconds. Since the type is double, I feel the milliseconds for the integer part may be the right resolution.

What to do when a function is not supported should be clear

There are a number of counters (for example sliCount) that are likely to be:

  1. Only implemented for some track types (video in this case)
  2. Only implemented by some platforms
    It should be clear what the value of this should be when it's not going to be handled:
  • zero always for a platform that does not count them?
  • missing for a platform that doesn't count them?
  • zero or missing for a track where it's not appliciable? (I think missing)

Codec should have implementation info

Called out by @pbos: In certain contexts, it's important to know which particular encoder is being used by a particular platform (for instance when both hardware and software codecs are available, and one or the other may be in use at any particular moment).

This is really only useful when one has intimate knowledge of the platform in use, so an implementation-defined string seems natural.

Suggestion: Add a new attribute to the RTCCodec dictionary.
Name: implementationName
Value: DOMString
Description: An implementation-specific identifier for the codec in use. This will be the encoder for outgoing streams, and the decoder for incoming streams; they may be different.

Messed up "stream" and "track"

At the moment, the text relevant to this says:

"track"
Contains the sequence of tracks related to a specific media stream and the corresponding media-level metrics. It is accessed by the RTCMediaStreamStats.

This is obviously wrong. The RTCStatsType string for a MediaStream should be "stream", and "track" should point to RTCMediaStreamTrackStats. The term "media stream" shouldn't be used without a reference.

Volume needs a more complete definition.

Current text:

audioLevel of type double
Only valid for audio, and the value is between 0..1 (linear), where 1.0 represents 0 dBov. Calculated as defined in [RFC6464].

RFC 6464 defines a logartihmic scale with -127 pegged to silence. That's not what is meant here.
"Linear" comes close, but not quite enough, I think.

I think we want 0..1, where 0 is silence, 1 is 0 dBov, and 0.5 represents "approximately 6 dBSPL change in the sound pressure level from the maximum" (quoted from the mediacapture draft's "volume" spec).

Add QP statistics to video tracks

From Sami Kalliomäki [email protected]:

What we need is a way to get average QP over some period of time. I don't think adding this to the receiver side is needed by us but maybe it should be added as well. I think the approach of adding a sum of QP would be a good idea. It probably should be added to the RTCMediaStreamTrackStats structure. Maybe something like this:

qpSum of type unsigned long
Only valid for video. QP (quantization parameter) describes how much spatial detail is included a frame. Low value corresponds with good quality. The range of the value per frame is defined by the codec being used. This parameter represents the sum of all QPs for framesDecoded on remote streams and framesSent on local streams.

The average QP has been implemented before as a goog stat but it never landed. The relevant CLs are here:
https://codereview.webrtc.org/1264693003/
https://codereview.webrtc.org/1420963005/

Design consideration for inactive SSRCs and inactive transports

In #68, it was raised that:

  • ICE restarts will cause new candidate pairs to become active and previously active ones to become inactive, if the call last long, the number of candidate pairs will accumulate.
  • Similarly if SSRCs change, previously active SSRCs will still be reported upon.

Is there something that we can do better?

Clarify RTCPeerConnectionStats's dataChannelsOpened/Closed description

Current description: "Represents the number of unique datachannels [opened/closed]."

Only DataChannels that have been fully opened should increase the closed counter when closed, so that (opened - closed) = (currently open). It may be possible for a DataChannel to go from Connecting to Closing/Closed, skipping the Open state.

Also, should "datachannel" be written as "DataChannel" or "data channel" instead?

Extension mechanism needs to be clear

For WebRTC-1.0, stats needs to be a stable reference (with all the stats that are in the MTI set).

Adding stats needs to be a process that's clear to people who want to do it.

Naming inconsistency

Looking at RTCStats desendants:

  • RTCRTPStreamStats : RTCStats
  • RTCCodec : RTCStats
  • RTCPeerConnectionStats : RTCStats
  • RTCMediaStreamStats : RTCStats
  • RTCMediaStreamTrackStats : RTCStats
  • RTCDataChannelStats : RTCStats
  • RTCTransportStats : RTCStats
  • RTCIceCandidateAttributes : RTCStats
  • RTCIceCandidatePairStats : RTCStats
  • RTCCertificateStats : RTCStats

They're all "*Stats" except two. Not that it matters terribly since these are dictionaries, but shouldn't we be consistent?

Need to define "RTP stream" in terminology section

The term "media stream" is heavily overloaded, and should not be used unqualified.
The term "RTP stream" is used in the document, and needs a reference to the correct RFC in the terminology section.

All occurences of "media stream" without qualifier should be updated to reference the term (with links).

Add field to RTCIceCandidateStats indicating whether or not the candidate has been freed

RFC5245 section 8.3 talks about a candidate being "freed". I assume that for TURN candidates, this means sending a refresh request with a lifetime of 0, and for host UDP/TCP candidates, it means closing the socket.

It would be useful to have a field (on local candidates) indicating whether or not the candidate has been freed. This gives an indication of how many sockets and TURN allocations WebRTC is consuming, which can be useful information.

Not clear if RTCTransportStats combines RTP+RTCP or not.

The summary states:

A Transport carries a part of an SDP session, consisting of RTP and RTCP. When Bundle is in use, an SDP session will have only one Transport per Bundle group. When Bundle is not in use, there is one Transport per m-line.

This heavily implies that an RTCTransportStats combines RTP and RTCP for an m= section.

But later, we have rtcpTransportStatsId, defined as:

If RTP and RTCP are not multiplexed, this is the id of the transport that gives stats for the RTCP component, and this record has only the RTP component stats.

Which implies that there are separate RTCTransportStats for RTP and RTCP. This seems correct, since that would allow a 1:1 mapping from an RTCIceTransport to an RTCTransportStats. Also, it's the only way there could be a single "selected candidate pair" per RTCTransportStats.

Describe the reason for "sum & count" rather than "average"

In the design considerations, we should include explanations of why we use "sum & count" rather than "average" - the reason being that "average" implies averaging over some fixed time interval, which may or may not be what the app wants; sum & count allows us to do getStats() twice and calculate the average between them over an app-chosen time interval - which may be long or short.

Need to be clear what happens when a track ends or is disconnected

When a track ends or is disconnected, the stats has to do one of two things:

  • Stop reporting on the track
  • Report on the track with a value showing clearly what its state is (ended, disconnected or both).

Proposal, in consistency with the philosophy so far: If it's ended, just report as normal; show some stat that says that the state is ended.

If it's disconnected, continue reporting (for history), but with a stat saying it's disconnected.

what is ssrcIds?

https://w3c.github.io/webrtc-stats/#mststats-dict* has a member ssrcIds which is not described.
I suspect it is a list of pointers to "RTP streams" which are identified by a ssrc: https://w3c.github.io/webrtc-stats/#streamstats-dict* -- the description of this is missing too ;-)

btw, why is the mediaType defined on RTCRTPStreamStats and not in RTCMediaStreamTrackStats? It would be useful in both probably since some attributes only make sense for audio and video respectively. It would be more natural on the track stats since that is related to an RTPSender/RTPReceiver (which has a kind attribute)

Expose protocol used to communicate with TURN server

For TURN candidates, it would be useful to see the protocol used to communicate with the TURN server. Either UDP, TCP, or TLS over TCP. The protocol field that currently exists is just the protocol of the allocated candidate.

If we add this, it may be worth adding to RTCIceCandidate as well. Though it's in a different category from the other attributes, in that it's not something that appears in the candidate SDP.

Broken links and fragments

Result of: https://validator.w3.org/checklink?url=https://w3c.github.io/webrtc-stats/webrtc-stats.html

 Line: 186 https://w3c.github.io/webrtc-stats/webrtc-stats.html
    Status: 200 OK

    Some of the links to this resource point to broken URI fragments (such as index.html#fragment). 
    Broken fragments:

        https://w3c.github.io/webrtc-stats/webrtc-stats.html#widl-RTCCodec-codec (line 186)

warning Lines: 70, 77, 80, 84 http://dev.w3.org/html5/spec/webappapis.html redirected to http://w3c.github.io/html/webappapis.html
    Status: 301 -> 200 OK

    This is a permanent redirect. The link should be updated to point to the more recent URI. 
    Broken fragments:

        http://dev.w3.org/html5/spec/webappapis.html#event-handlers (line 84)
        http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event (line 80)
        http://dev.w3.org/html5/spec/webappapis.html#queue-a-task (line 77)
        http://dev.w3.org/html5/spec/webappapis.html#eventhandler (line 70)

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.