@@ -4995,35 +4995,34 @@ <h3>RTCStatsReport Object</h3>
4995
4995
4996
4996
< p > The < code > < a href ="#widl-RTCPeerConnection-getStats-Promise-RTCStatsReport--MediaStreamTrack-selector ">
4997
4997
getStats()</ a > </ code >
4998
- method delivers a successful result in the form of a
4999
- < code > < a > RTCStatsReport</ a > </ code > object. A
5000
- < code > < a > RTCStatsReport</ a > </ code > object represents a map between
5001
- strings, identifying the inspected objects (< a href =
4998
+ method delivers a successful result in the form of an
4999
+ < code > < a > RTCStatsReport</ a > </ code > object. An
5000
+ < code > < a > RTCStatsReport</ a > </ code > object is a map between
5001
+ strings that identify the inspected objects (< a href =
5002
5002
"#dom-rtcstats-id "> RTCStats.id</ a > ), and their corresponding
5003
- < code > < a > RTCStats</ a > </ code > objects .</ p >
5003
+ < code > < a > RTCStats</ a > </ code > -derived dictionaries .</ p >
5004
5004
5005
5005
< p > An < code > < a > RTCStatsReport</ a > </ code > may be composed of several
5006
- < code > < a > RTCStats</ a > </ code > objects , each reporting stats for one
5006
+ < code > < a > RTCStats</ a > </ code > -derived dictionaries , each reporting stats for one
5007
5007
underlying object that the implementation thinks is relevant for the
5008
5008
< a href ="#stats-selector "> selector</ a > . One achieves the total for the
5009
5009
< a href ="#stats-selector "> selector</ a > by summing over all the stats of a
5010
5010
certain type; for instance, if a < code > MediaStreamTrack</ code > is carried
5011
5011
by multiple SSRCs over the network, the
5012
- < code > < a > RTCStatsReport</ a > </ code > may contain one < code > RTCStats</ code >
5013
- object per SSRC (which can be distinguished by the value of the "ssrc"
5012
+ < code > < a > RTCStatsReport</ a > </ code > may contain one < code > RTCStats</ code > -derived
5013
+ dictionary per SSRC (which can be distinguished by the value of the "ssrc"
5014
5014
stats attribute).</ p >
5015
5015
5016
5016
< dl class ="idl " title ="interface RTCStatsReport ">
5017
- < dt > getter RTCStats ( DOMString id) </ dt >
5017
+ < dt > readonly maplike< DOMString, object> </ dt >
5018
5018
5019
5019
< dd >
5020
- < p > Getter to retrieve the < code > < a > RTCStats</ a > </ code > objects that
5021
- this stats report is composed of.</ p >
5022
-
5023
- < p > The set of supported property names [[!WEBIDL]] is defined as the
5024
- ids of all the < code > < a > RTCStats</ a > </ code > objects that has been
5025
- generated for this stats report. The order of the property names is
5026
- left to the user agent.</ p >
5020
+ Use these to retrieve the various dictionaries
5021
+ descended from < code > < a > RTCStats</ a > </ code > that
5022
+ this stats report is composed of.
5023
+ The set of supported property names [[!WEBIDL]] is defined as the
5024
+ ids of all the < code > < a > RTCStats</ a > </ code > -derived dictionaries that
5025
+ have been generated for this stats report.
5027
5026
</ dd >
5028
5027
</ dl >
5029
5028
</ section >
@@ -5054,8 +5053,8 @@ <h3>RTCStats Dictionary</h3>
5054
5053
"packetsSent" are both reported, they both need to be reported over the
5055
5054
same interval, so that "average packet size" can be computed as "bytes /
5056
5055
packets" - if the intervals are different, this will yield errors. Thus
5057
- implementations MUST return synchronized values for all stats in a
5058
- < code > < a > RTCStats</ a > </ code > object .</ p >
5056
+ implementations MUST return synchronized values for all stats in an
5057
+ < code > < a > RTCStats</ a > </ code > -derived dictionary .</ p >
5059
5058
5060
5059
< dl class ="idl " title ="dictionary RTCStats ">
5061
5060
< dt > DOMHiResTimeStamp timestamp</ dt >
@@ -5190,17 +5189,16 @@ <h3>Example</h3>
5190
5189
5191
5190
function processStats() {
5192
5191
// compare the elements from the current report with the baseline
5193
- for (var i in currentReport) {
5194
- var now = currentReport[i];
5192
+ currentReport.forEach (now => {
5195
5193
if (now.type != "outboundrtp")
5196
- continue ;
5194
+ return ;
5197
5195
5198
5196
// get the corresponding stats from the baseline report
5199
- base = baselineReport[ now.id] ;
5197
+ base = baselineReport.get( now.id) ;
5200
5198
5201
5199
if (base) {
5202
- remoteNow = currentReport[ now.remoteId] ;
5203
- remoteBase = baselineReport[ base.remoteId] ;
5200
+ remoteNow = currentReport.get( now.remoteId) ;
5201
+ remoteBase = baselineReport.get( base.remoteId) ;
5204
5202
5205
5203
var packetsSent = now.packetsSent - base.packetsSent;
5206
5204
var packetsReceived = remoteNow.packetsReceived - remoteBase.packetsReceived;
0 commit comments