1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * The origin of this IDL file is
7 * http://dev.w3.org/2011/webrtc/editor/webrtc.html#rtcstatsreport-object
8 * http://www.w3.org/2011/04/webrtc/wiki/Stats
9 */
10
11enum RTCStatsType {
12  "inbound-rtp",
13  "outbound-rtp",
14  "csrc",
15  "session",
16  "track",
17  "transport",
18  "candidate-pair",
19  "local-candidate",
20  "remote-candidate"
21};
22
23dictionary RTCStats {
24  DOMHighResTimeStamp timestamp;
25  RTCStatsType type;
26  DOMString id;
27};
28
29dictionary RTCRTPStreamStats : RTCStats {
30  DOMString ssrc;
31  DOMString mediaType;
32  DOMString remoteId;
33  boolean isRemote = false;
34  DOMString mediaTrackId;
35  DOMString transportId;
36  DOMString codecId;
37
38  // Video encoder/decoder measurements, not present in RTCP case
39  double bitrateMean;
40  double bitrateStdDev;
41  double framerateMean;
42  double framerateStdDev;
43
44  // Local only measurements, RTCP related but not communicated via RTCP. Not
45  // present in RTCP case.
46  unsigned long firCount;
47  unsigned long pliCount;
48  unsigned long nackCount;
49};
50
51dictionary RTCInboundRTPStreamStats : RTCRTPStreamStats {
52  unsigned long packetsReceived;
53  unsigned long long bytesReceived;
54  double jitter;
55  unsigned long packetsLost;
56  long roundTripTime;
57
58  // Video decoder measurement, not present in RTCP case
59  unsigned long discardedPackets;
60  unsigned long framesDecoded;
61};
62
63dictionary RTCOutboundRTPStreamStats : RTCRTPStreamStats {
64  unsigned long packetsSent;
65  unsigned long long bytesSent;
66  double targetBitrate;  // config encoder bitrate target of this SSRC in bits/s
67
68  // Video encoder measurements, not present in RTCP case
69  unsigned long droppedFrames;
70  unsigned long framesEncoded;
71};
72
73dictionary RTCMediaStreamTrackStats : RTCStats {
74  DOMString trackIdentifier;      // track.id property
75  boolean remoteSource;
76  sequence<DOMString> ssrcIds;
77  // Stuff that makes sense for video
78  unsigned long frameWidth;
79  unsigned long frameHeight;
80  double framesPerSecond;        // The nominal FPS value
81  unsigned long framesSent;
82  unsigned long framesReceived;  // Only for remoteSource=true
83  unsigned long framesDecoded;
84  unsigned long framesDropped;   // See VideoPlaybackQuality.droppedVideoFrames
85  unsigned long framesCorrupted; // as above.
86  // Stuff that makes sense for audio
87  double audioLevel;               // linear, 1.0 = 0 dBov (from RFC 6464).
88  // AEC stuff on audio tracks sourced from a microphone where AEC is applied
89  double echoReturnLoss;           // in decibels from G.168 (2012) section 3.14
90  double echoReturnLossEnhancement; // as above, section 3.15
91};
92
93dictionary RTCMediaStreamStats : RTCStats {
94  DOMString streamIdentifier;     // stream.id property
95  sequence<DOMString> trackIds;   // Note: stats object ids, not track.id
96};
97
98dictionary RTCRTPContributingSourceStats : RTCStats {
99  unsigned long contributorSsrc;
100  DOMString     inboundRtpStreamId;
101};
102
103dictionary RTCTransportStats: RTCStats {
104  unsigned long bytesSent;
105  unsigned long bytesReceived;
106};
107
108dictionary RTCIceComponentStats : RTCStats {
109  DOMString transportId;
110  long component;
111  unsigned long bytesSent;
112  unsigned long bytesReceived;
113  boolean activeConnection;
114};
115
116enum RTCStatsIceCandidatePairState {
117  "frozen",
118  "waiting",
119  "inprogress",
120  "failed",
121  "succeeded",
122  "cancelled"
123};
124
125dictionary RTCIceCandidatePairStats : RTCStats {
126  DOMString transportId;
127  DOMString localCandidateId;
128  DOMString remoteCandidateId;
129  RTCStatsIceCandidatePairState state;
130  unsigned long long priority;
131  boolean nominated;
132  boolean writable;
133  boolean readable;
134  unsigned long long bytesSent;
135  unsigned long long bytesReceived;
136  DOMHighResTimeStamp lastPacketSentTimestamp;
137  DOMHighResTimeStamp lastPacketReceivedTimestamp;
138  boolean selected;
139  [ChromeOnly]
140  unsigned long componentId; // moz
141};
142
143enum RTCStatsIceCandidateType {
144  "host",
145  "serverreflexive",
146  "peerreflexive",
147  "relayed"
148};
149
150dictionary RTCIceCandidateStats : RTCStats {
151  DOMString componentId;
152  DOMString candidateId;
153  DOMString ipAddress;
154  DOMString transport;
155  long portNumber;
156  RTCStatsIceCandidateType candidateType;
157};
158
159dictionary RTCCodecStats : RTCStats {
160  unsigned long payloadType;       // As used in RTP encoding.
161  DOMString codec;                 // video/vp8 or equivalent
162  unsigned long clockRate;
163  unsigned long channels;          // 2=stereo, missing for most other cases.
164  DOMString parameters;            // From SDP description line
165};
166
167// This is the internal representation of the report in this implementation
168// to be received from c++
169
170dictionary RTCStatsReportInternal {
171  DOMString                               pcid = "";
172  sequence<RTCInboundRTPStreamStats>      inboundRTPStreamStats;
173  sequence<RTCOutboundRTPStreamStats>     outboundRTPStreamStats;
174  sequence<RTCRTPContributingSourceStats> rtpContributingSourceStats;
175  sequence<RTCMediaStreamTrackStats>      mediaStreamTrackStats;
176  sequence<RTCMediaStreamStats>           mediaStreamStats;
177  sequence<RTCTransportStats>             transportStats;
178  sequence<RTCIceComponentStats>          iceComponentStats;
179  sequence<RTCIceCandidatePairStats>      iceCandidatePairStats;
180  sequence<RTCIceCandidateStats>          iceCandidateStats;
181  sequence<RTCCodecStats>                 codecStats;
182  DOMString                               localSdp;
183  DOMString                               remoteSdp;
184  DOMHighResTimeStamp                     timestamp;
185  unsigned long                           iceRestarts;
186  unsigned long                           iceRollbacks;
187  boolean                                 offerer; // Is the PC the offerer
188  boolean                                 closed; // Is the PC now closed
189  sequence<RTCIceCandidateStats>          trickledIceCandidateStats;
190  sequence<DOMString>                     rawLocalCandidates;
191  sequence<DOMString>                     rawRemoteCandidates;
192};
193
194[Pref="media.peerconnection.enabled",
195// TODO: Use MapClass here once it's available (Bug 928114)
196// MapClass(DOMString, object)
197 JSImplementation="@mozilla.org/dom/rtcstatsreport;1"]
198interface RTCStatsReport {
199  readonly maplike<DOMString, object>;
200};
201