summaryrefslogtreecommitdiffstats
path: root/dom/webidl/RTCStatsReport.webidl
blob: f10e4b56d3a89187699282dfd6a28c0000b58092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * The origin of this IDL file is
 * http://dev.w3.org/2011/webrtc/editor/webrtc.html#rtcstatsreport-object
 * http://www.w3.org/2011/04/webrtc/wiki/Stats
 * https://www.w3.org/TR/webrtc-stats/
 */

enum RTCStatsType {
  "codec",
  "inbound-rtp",
  "outbound-rtp",
  "remote-inbound-rtp",
  "remote-outbound-rtp",
  "media-source",
  "peer-connection",
  "csrc",
  "data-channel",
  "session",
  "track",
  "transport",
  "candidate-pair",
  "local-candidate",
  "remote-candidate"
};

dictionary RTCStats {
  DOMHighResTimeStamp timestamp;
  RTCStatsType type;
  DOMString id;
};

dictionary RTCRtpStreamStats : RTCStats {
  required unsigned long ssrc;
  required DOMString kind;
  DOMString mediaType;
  DOMString transportId;
  DOMString codecId;
};

dictionary RTCCodecStats : RTCStats {
  required unsigned long payloadType;
  RTCCodecType  codecType;
  required DOMString     transportId;
  required DOMString     mimeType;
  unsigned long clockRate;
  unsigned long channels;
  DOMString     sdpFmtpLine;
};

enum RTCCodecType {
  "encode",
  "decode",
};

dictionary RTCReceivedRtpStreamStats: RTCRtpStreamStats {
  unsigned long long packetsReceived;
  long long packetsLost;
  double jitter;
  unsigned long discardedPackets; // non-standard alias for packetsDiscarded
  unsigned long packetsDiscarded;
};

dictionary RTCInboundRtpStreamStats : RTCReceivedRtpStreamStats {
  required DOMString trackIdentifier;
  DOMString remoteId;
  unsigned long framesDecoded;
  unsigned long framesDropped;
  unsigned long frameWidth;
  unsigned long frameHeight;
  double framesPerSecond;
  unsigned long long qpSum;
  double totalDecodeTime;
  double totalInterFrameDelay;
  double totalSquaredInterFrameDelay;
  DOMHighResTimeStamp lastPacketReceivedTimestamp;
  unsigned long long headerBytesReceived;
  unsigned long long fecPacketsReceived;
  unsigned long long fecPacketsDiscarded;
  unsigned long long bytesReceived;
  unsigned long nackCount;
  unsigned long firCount;
  unsigned long pliCount;
  double totalProcessingDelay;
  // Always missing from libwebrtc
  // DOMHighResTimeStamp  estimatedPlayoutTimestamp;
  double jitterBufferDelay;
  unsigned long long jitterBufferEmittedCount;
  unsigned long long totalSamplesReceived;
  unsigned long long concealedSamples;
  unsigned long long silentConcealedSamples;
  unsigned long long concealmentEvents;
  unsigned long long insertedSamplesForDeceleration;
  unsigned long long removedSamplesForAcceleration;
  double audioLevel;
  double totalAudioEnergy;
  double totalSamplesDuration;
  unsigned long framesReceived;
};

dictionary RTCRemoteInboundRtpStreamStats : RTCReceivedRtpStreamStats {
  DOMString localId;
  double roundTripTime;
  double totalRoundTripTime;
  double fractionLost;
  unsigned long long roundTripTimeMeasurements;
};

dictionary RTCSentRtpStreamStats : RTCRtpStreamStats {
  unsigned long packetsSent;
  unsigned long long bytesSent;
};

dictionary RTCOutboundRtpStreamStats : RTCSentRtpStreamStats {
  DOMString remoteId;
  unsigned long framesEncoded;
  unsigned long long qpSum;
  unsigned long nackCount;
  unsigned long firCount;
  unsigned long pliCount;
  unsigned long long headerBytesSent;
  unsigned long long retransmittedPacketsSent;
  unsigned long long retransmittedBytesSent;
  unsigned long long totalEncodedBytesTarget;
  unsigned long frameWidth;
  unsigned long frameHeight;
  unsigned long framesSent;
  unsigned long hugeFramesSent;
  double totalEncodeTime;
};

dictionary RTCRemoteOutboundRtpStreamStats : RTCSentRtpStreamStats {
  DOMString localId;
  DOMHighResTimeStamp remoteTimestamp;
};

dictionary RTCMediaSourceStats : RTCStats {
  required DOMString trackIdentifier;
  required DOMString kind;
};

dictionary RTCPeerConnectionStats : RTCStats {
  unsigned long dataChannelsOpened;
  unsigned long dataChannelsClosed;
};

dictionary RTCRTPContributingSourceStats : RTCStats {
  unsigned long contributorSsrc;
  DOMString     inboundRtpStreamId;
};

dictionary RTCDataChannelStats : RTCStats {
  DOMString           label;
  DOMString           protocol;
  long                dataChannelIdentifier;
  // RTCTransportId is not yet implemented - Bug 1225723
  // DOMString transportId;
  RTCDataChannelState state;
  unsigned long       messagesSent;
  unsigned long long  bytesSent;
  unsigned long       messagesReceived;
  unsigned long long  bytesReceived;
};

enum RTCStatsIceCandidatePairState {
  "frozen",
  "waiting",
  "inprogress",
  "failed",
  "succeeded",
  "cancelled"
};

dictionary RTCIceCandidatePairStats : RTCStats {
  DOMString transportId;
  DOMString localCandidateId;
  DOMString remoteCandidateId;
  RTCStatsIceCandidatePairState state;
  unsigned long long priority;
  boolean nominated;
  boolean writable;
  boolean readable;
  unsigned long long bytesSent;
  unsigned long long bytesReceived;
  DOMHighResTimeStamp lastPacketSentTimestamp;
  DOMHighResTimeStamp lastPacketReceivedTimestamp;
  boolean selected;
  [ChromeOnly]
  unsigned long componentId; // moz
};

enum RTCIceCandidateType {
  "host",
  "srflx",
  "prflx",
  "relay"
};

dictionary RTCIceCandidateStats : RTCStats {
  DOMString address;
  long port;
  DOMString protocol;
  RTCIceCandidateType candidateType;
  long priority;
  DOMString relayProtocol;
  // Because we use this internally but don't support RTCIceCandidateStats,
  // we need to keep the field as ChromeOnly. Bug 1225723
  [ChromeOnly]
  DOMString transportId;
  [ChromeOnly]
  DOMString proxied;
};

// This is for tracking the frame rate in about:webrtc
dictionary RTCVideoFrameHistoryEntryInternal {
  required unsigned long       width;
  required unsigned long       height;
  required unsigned long       rotationAngle;
  required DOMHighResTimeStamp firstFrameTimestamp;
  required DOMHighResTimeStamp lastFrameTimestamp;
  required unsigned long long  consecutiveFrames;
  required unsigned long       localSsrc;
  required unsigned long       remoteSsrc;
};

// Collection over the entries for a single track for about:webrtc
dictionary RTCVideoFrameHistoryInternal {
  required DOMString                          trackIdentifier;
  sequence<RTCVideoFrameHistoryEntryInternal> entries = [];
};

// Collection over the libwebrtc bandwidth estimation stats
dictionary RTCBandwidthEstimationInternal {
  required DOMString  trackIdentifier;
  long                sendBandwidthBps;    // Estimated available send bandwidth
  long                maxPaddingBps;       // Cumulative configured max padding
  long                receiveBandwidthBps; // Estimated available receive bandwidth
  long                pacerDelayMs;
  long                rttMs;
};

// This is used by about:webrtc to report SDP parsing errors
dictionary RTCSdpParsingErrorInternal {
  required unsigned long lineNumber;
  required DOMString     error;
};

// This is for tracking the flow of SDP for about:webrtc
dictionary RTCSdpHistoryEntryInternal {
  required DOMHighResTimeStamp         timestamp;
  required boolean                     isLocal;
  required DOMString                   sdp;
  sequence<RTCSdpParsingErrorInternal> errors = [];
};

// This is intended to be a list of dictionaries that inherit from RTCStats
// (with some raw ICE candidates thrown in). Unfortunately, we cannot simply
// store a sequence<RTCStats> because of slicing. So, we have to have a
// separate list for each type. Used in c++ gecko code.
dictionary RTCStatsCollection {
  sequence<RTCInboundRtpStreamStats>        inboundRtpStreamStats = [];
  sequence<RTCOutboundRtpStreamStats>       outboundRtpStreamStats = [];
  sequence<RTCRemoteInboundRtpStreamStats>  remoteInboundRtpStreamStats = [];
  sequence<RTCRemoteOutboundRtpStreamStats> remoteOutboundRtpStreamStats = [];
  sequence<RTCMediaSourceStats>             mediaSourceStats = [];
  sequence<RTCPeerConnectionStats>          peerConnectionStats = [];
  sequence<RTCRTPContributingSourceStats>   rtpContributingSourceStats = [];
  sequence<RTCIceCandidatePairStats>        iceCandidatePairStats = [];
  sequence<RTCIceCandidateStats>            iceCandidateStats = [];
  sequence<RTCIceCandidateStats>            trickledIceCandidateStats = [];
  sequence<RTCDataChannelStats>             dataChannelStats = [];
  sequence<RTCCodecStats>                   codecStats = [];

  // For internal use only
  sequence<DOMString>                       rawLocalCandidates = [];
  sequence<DOMString>                       rawRemoteCandidates = [];
  sequence<RTCVideoFrameHistoryInternal>    videoFrameHistories = [];
  sequence<RTCBandwidthEstimationInternal>  bandwidthEstimations = [];
};

// Details that about:webrtc can display about configured ICE servers
dictionary RTCIceServerInternal {
  sequence<DOMString> urls = [];
  required boolean    credentialProvided;
  required boolean    userNameProvided;
};

// Details that about:webrtc can display about the RTCConfiguration
// Chrome only
dictionary RTCConfigurationInternal {
  RTCBundlePolicy                bundlePolicy;
  required boolean               certificatesProvided;
  sequence<RTCIceServerInternal> iceServers = [];
  RTCIceTransportPolicy          iceTransportPolicy;
  required boolean               peerIdentityProvided;
  DOMString                      sdpSemantics;
};

dictionary RTCSdpHistoryInternal {
  required DOMString pcid;
  sequence<RTCSdpHistoryEntryInternal> sdpHistory = [];
};

// A collection of RTCStats dictionaries, plus some other info. Used by
// WebrtcGlobalInformation for about:webrtc, and telemetry.
dictionary RTCStatsReportInternal : RTCStatsCollection {
  required DOMString                        pcid;
  required unsigned long                    browserId;
  RTCConfigurationInternal                  configuration;
  DOMString                                 jsepSessionErrors;
  // TODO demux from RTCStatsReportInternal in bug 1830824
  sequence<RTCSdpHistoryEntryInternal>      sdpHistory = [];
  required DOMHighResTimeStamp              timestamp;
  double                                    callDurationMs;
  required unsigned long                    iceRestarts;
  required unsigned long                    iceRollbacks;
  boolean                                   offerer; // Is the PC the offerer
  required boolean                          closed; // Is the PC now closed
};

[Pref="media.peerconnection.enabled",
 Exposed=Window]
interface RTCStatsReport {

  // TODO(bug 1586109): Remove this once we no longer need to be able to
  // construct empty RTCStatsReports from JS.
  [ChromeOnly]
  constructor();

  readonly maplike<DOMString, object>;
};