@@ -91,6 +91,40 @@ extension type RTCRtpStreamStats._(JSObject _) implements RTCStats, JSObject {
91
91
external String get codecId;
92
92
external set codecId (String value);
93
93
}
94
+
95
+ /// The **`RTCCodecStats` ** dictionary of the
96
+ /// [WebRTC API] (https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API)
97
+ /// provides statistics about a codec used by streams that are being sent or
98
+ /// received by the associated [RTCPeerConnection] object.
99
+ ///
100
+ /// These statistics can be obtained by iterating the [RTCStatsReport] object
101
+ /// returned by [RTCPeerConnection.getStats] until you find an entry with the
102
+ /// [`type`] (#type) of `codec` .
103
+ ///
104
+ /// The codec statistics can be correlated with the inbound or outbound stream
105
+ /// statistics (both local and remote) by matching their `codecId` property to
106
+ /// the codec's `id` .
107
+ /// For example, if
108
+ /// [`RTCInboundRtpStreamStats.codecId`] (/en-US/docs/Web/API/RTCInboundRtpStreamStats#codecid)
109
+ /// matches an [`RTCCodecStats.id`] (#id) in the same report, then we know that
110
+ /// the codec is being used on this peer connection's inbound stream.
111
+ /// If no stream `codecId` references a codec statistic, then that codec
112
+ /// statistic object is deleted — if the codec is used again, the statistics
113
+ /// object will be recreated with the same `id` .
114
+ ///
115
+ /// Codec objects may be referenced by multiple RTP streams in media sections
116
+ /// using the same transport.
117
+ /// In fact, user agents are expected to consolidate information into a single
118
+ /// "codec" entry per payload type per transport (unless
119
+ /// [sdpFmtpLine] (#sdpfmtpline) is different when sending or receiving, in which
120
+ /// case, different codecs will be needed for encoding and decoding).
121
+ /// Note that other transports will use their own distinct `RTCCodecStats`
122
+ /// objects.
123
+ ///
124
+ /// ---
125
+ ///
126
+ /// API documentation sourced from
127
+ /// [MDN Web Docs] (https://developer.mozilla.org/en-US/docs/Web/API/RTCCodecStats).
94
128
extension type RTCCodecStats ._(JSObject _) implements RTCStats , JSObject {
95
129
external factory RTCCodecStats ({
96
130
required DOMHighResTimeStamp timestamp,
@@ -104,16 +138,51 @@ extension type RTCCodecStats._(JSObject _) implements RTCStats, JSObject {
104
138
String sdpFmtpLine,
105
139
});
106
140
141
+ /// The **`payloadType` ** property of the [RTCCodecStats] dictionary is a
142
+ /// positive integer in the range from 0 to 127 that describes the format of
143
+ /// the payload used in RTP encoding or decoding.
107
144
external int get payloadType;
108
145
external set payloadType (int value);
146
+
147
+ /// The **`transportId` ** property of the [RTCCodecStats] dictionary is a
148
+ /// string that contains the unique identifier of the corresponding transport
149
+ /// on which this codec is being used.
150
+ ///
151
+ /// You can correlate the codec and associated transport statistics by
152
+ /// matching the `RTCCodecStats.transportId` with an [RTCTransportStats.id]
153
+ /// value.
109
154
external String get transportId;
110
155
external set transportId (String value);
156
+
157
+ /// The **`mimeType` ** property of the [RTCCodecStats] dictionary is a string
158
+ /// containing the codec's and subtype.
159
+ ///
160
+ /// This is of the form `"type/subtype"` , such as "video/VP8" or "audio/opus",
161
+ /// as defined in the
162
+ /// [IANA registry of valid MIME types] (https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2).
111
163
external String get mimeType;
112
164
external set mimeType (String value);
165
+
166
+ /// The **`clockRate` ** property of the [RTCCodecStats] dictionary is a
167
+ /// positive number containing the media sampling rate in hertz (Hz).
113
168
external int get clockRate;
114
169
external set clockRate (int value);
170
+
171
+ /// The **`channels` ** property of the [RTCCodecStats] dictionary is a
172
+ /// positive number containing the number of channels supported by the codec.
173
+ ///
174
+ /// For audio codecs, a value of 1 specifies monaural sound while 2 indicates
175
+ /// stereo.
115
176
external int get channels;
116
177
external set channels (int value);
178
+
179
+ /// The **`sdpFmtpLine` ** property of the [RTCCodecStats] dictionary is a
180
+ /// string containing the format-specific parameters of the codec.
181
+ ///
182
+ /// These are the values in the `"a=fmtp"` line in the codec's (if present)
183
+ /// after the payload type number (see [section 5.8 of the IETF specification
184
+ /// for
185
+ /// JSEP](https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-jsep-24#section-5.8)).
117
186
external String get sdpFmtpLine;
118
187
external set sdpFmtpLine (String value);
119
188
}
0 commit comments