summaryrefslogtreecommitdiffstats
path: root/vendor/web-sys/webidls/enabled/RTCStatsReport.webidl
blob: a52a2a8f5bb8ad7bd966453fe3d1ea908723ccbc (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
/* -*- 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
 */

enum RTCStatsType {
  "inbound-rtp",
  "outbound-rtp",
  "csrc",
  "session",
  "track",
  "transport",
  "candidate-pair",
  "local-candidate",
  "remote-candidate"
};

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

dictionary RTCRTPStreamStats : RTCStats {
  DOMString ssrc;
  DOMString mediaType;
  DOMString remoteId;
  boolean isRemote = false;
  DOMString mediaTrackId;
  DOMString transportId;
  DOMString codecId;

  // Video encoder/decoder measurements, not present in RTCP case
  double bitrateMean;
  double bitrateStdDev;
  double framerateMean;
  double framerateStdDev;

  // Local only measurements, RTCP related but not communicated via RTCP. Not
  // present in RTCP case.
  unsigned long firCount;
  unsigned long pliCount;
  unsigned long nackCount;
};

dictionary RTCInboundRTPStreamStats : RTCRTPStreamStats {
  unsigned long packetsReceived;
  unsigned long long bytesReceived;
  double jitter;
  unsigned long packetsLost;
  long roundTripTime;

  // Video decoder measurement, not present in RTCP case
  unsigned long discardedPackets;
  unsigned long framesDecoded;
};

dictionary RTCOutboundRTPStreamStats : RTCRTPStreamStats {
  unsigned long packetsSent;
  unsigned long long bytesSent;
  double targetBitrate;  // config encoder bitrate target of this SSRC in bits/s

  // Video encoder measurements, not present in RTCP case
  unsigned long droppedFrames;
  unsigned long framesEncoded;
};

dictionary RTCMediaStreamTrackStats : RTCStats {
  DOMString trackIdentifier;      // track.id property
  boolean remoteSource;
  sequence<DOMString> ssrcIds;
  // Stuff that makes sense for video
  unsigned long frameWidth;
  unsigned long frameHeight;
  double framesPerSecond;        // The nominal FPS value
  unsigned long framesSent;
  unsigned long framesReceived;  // Only for remoteSource=true
  unsigned long framesDecoded;
  unsigned long framesDropped;   // See VideoPlaybackQuality.droppedVideoFrames
  unsigned long framesCorrupted; // as above.
  // Stuff that makes sense for audio
  double audioLevel;               // linear, 1.0 = 0 dBov (from RFC 6464).
  // AEC stuff on audio tracks sourced from a microphone where AEC is applied
  double echoReturnLoss;           // in decibels from G.168 (2012) section 3.14
  double echoReturnLossEnhancement; // as above, section 3.15
};

dictionary RTCMediaStreamStats : RTCStats {
  DOMString streamIdentifier;     // stream.id property
  sequence<DOMString> trackIds;   // Note: stats object ids, not track.id
};

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

dictionary RTCTransportStats: RTCStats {
  unsigned long bytesSent;
  unsigned long bytesReceived;
};

dictionary RTCIceComponentStats : RTCStats {
  DOMString transportId;
  long component;
  unsigned long bytesSent;
  unsigned long bytesReceived;
  boolean activeConnection;
};

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 RTCStatsIceCandidateType {
  "host",
  "serverreflexive",
  "peerreflexive",
  "relayed"
};

dictionary RTCIceCandidateStats : RTCStats {
  DOMString componentId;
  DOMString candidateId;
  DOMString ipAddress;
  DOMString transport;
  long portNumber;
  RTCStatsIceCandidateType candidateType;
};

dictionary RTCCodecStats : RTCStats {
  unsigned long payloadType;       // As used in RTP encoding.
  DOMString codec;                 // video/vp8 or equivalent
  unsigned long clockRate;
  unsigned long channels;          // 2=stereo, missing for most other cases.
  DOMString parameters;            // From SDP description line
};

// This is the internal representation of the report in this implementation
// to be received from c++

dictionary RTCStatsReportInternal {
  DOMString                               pcid = "";
  sequence<RTCInboundRTPStreamStats>      inboundRTPStreamStats;
  sequence<RTCOutboundRTPStreamStats>     outboundRTPStreamStats;
  sequence<RTCRTPContributingSourceStats> rtpContributingSourceStats;
  sequence<RTCMediaStreamTrackStats>      mediaStreamTrackStats;
  sequence<RTCMediaStreamStats>           mediaStreamStats;
  sequence<RTCTransportStats>             transportStats;
  sequence<RTCIceComponentStats>          iceComponentStats;
  sequence<RTCIceCandidatePairStats>      iceCandidatePairStats;
  sequence<RTCIceCandidateStats>          iceCandidateStats;
  sequence<RTCCodecStats>                 codecStats;
  DOMString                               localSdp;
  DOMString                               remoteSdp;
  DOMHighResTimeStamp                     timestamp;
  unsigned long                           iceRestarts;
  unsigned long                           iceRollbacks;
  boolean                                 offerer; // Is the PC the offerer
  boolean                                 closed; // Is the PC now closed
  sequence<RTCIceCandidateStats>          trickledIceCandidateStats;
  sequence<DOMString>                     rawLocalCandidates;
  sequence<DOMString>                     rawRemoteCandidates;
};

[Pref="media.peerconnection.enabled",
// TODO: Use MapClass here once it's available (Bug 928114)
// MapClass(DOMString, object)
 JSImplementation="@mozilla.org/dom/rtcstatsreport;1"]
interface RTCStatsReport {
  readonly maplike<DOMString, object>;
};