Skip to content

Commit a696023

Browse files
committed
Fix 'd' trace httpList metric reporting
- Ensure 'd' (Measurement period duration) trace httpList metric reflects that used by ABR - Limit use of throughput metric to FetchLoader - Remove throughput metric from trace object - Simplify ThroughputHistory rules
1 parent b98673e commit a696023

File tree

5 files changed

+12
-20
lines changed

5 files changed

+12
-20
lines changed

src/streaming/models/MetricsModel.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,12 @@ function MetricsModel(config) {
116116
}
117117
}
118118

119-
function appendHttpTrace(httpRequest, s, d, b, t) {
119+
function appendHttpTrace(httpRequest, s, d, b) {
120120
let vo = new HTTPRequestTrace();
121121

122122
vo.s = s;
123123
vo.d = d;
124124
vo.b = b;
125-
vo._t = t;
126125

127126
httpRequest.trace.push(vo);
128127

@@ -188,7 +187,7 @@ function MetricsModel(config) {
188187

189188
if (traces) {
190189
traces.forEach(trace => {
191-
appendHttpTrace(vo, trace.s, trace.d, trace.b, trace.t);
190+
appendHttpTrace(vo, trace.s, trace.d, trace.b);
192191
});
193192
} else {
194193
// The interval and trace shall be absent for redirect and failure records.

src/streaming/net/FetchLoader.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,22 @@ function FetchLoader(cfg) {
231231
// are correctly generated
232232
// Same structure as https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequestEventTarget/
233233
let calculatedThroughput = null;
234+
let calculatedTime = null;
234235
if (calculationMode === Constants.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING) {
235236
calculatedThroughput = calculateThroughputByChunkData(startTimeData, endTimeData);
237+
if (calculatedThroughput) {
238+
calculatedTime = bytesReceived * 8 / calculatedThroughput;
239+
}
240+
}
241+
else if (calculationMode === Constants.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA) {
242+
calculatedTime = calculateDownloadedTime(downloadedData, bytesReceived);
236243
}
237244

238245
httpRequest.progress({
239246
loaded: bytesReceived,
240247
total: isNaN(totalBytes) ? bytesReceived : totalBytes,
241248
lengthComputable: true,
242-
time: calculateDownloadedTime(downloadedData, bytesReceived),
243-
throughput: calculatedThroughput,
249+
time: calculatedTime,
244250
stream: true
245251
});
246252
}

src/streaming/net/HTTPLoader.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ function HTTPLoader(cfg) {
208208
traces.push({
209209
s: lastTraceTime,
210210
d: event.time ? event.time : currentTime.getTime() - lastTraceTime.getTime(),
211-
b: [event.loaded ? event.loaded - lastTraceReceivedCount : 0],
212-
t: event.throughput
211+
b: [event.loaded ? event.loaded - lastTraceReceivedCount : 0]
213212
});
214213

215214
lastTraceTime = currentTime;

src/streaming/rules/ThroughputHistory.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,7 @@ function ThroughputHistory(config) {
9191
let throughputMeasureTime = 0, throughput = 0;
9292

9393
if (httpRequest._fileLoaderType && httpRequest._fileLoaderType === Constants.FILE_LOADER_TYPES.FETCH) {
94-
const calculationMode = settings.get().streaming.abr.fetchThroughputCalculationMode;
95-
if (calculationMode === Constants.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING) {
96-
const sumOfThroughputValues = httpRequest.trace.reduce((a, b) => a + b._t, 0);
97-
throughput = Math.round(sumOfThroughputValues / httpRequest.trace.length);
98-
}
99-
if (throughput === 0) {
100-
throughputMeasureTime = httpRequest.trace.reduce((a, b) => a + b.d, 0);
101-
}
94+
throughputMeasureTime = httpRequest.trace.reduce((a, b) => a + b.d, 0);
10295
} else {
10396
throughputMeasureTime = useDeadTimeLatency ? downloadTimeInMilliseconds : latencyTimeInMilliseconds + downloadTimeInMilliseconds;
10497
}

src/streaming/vo/metrics/HTTPRequest.js

-5
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,6 @@ class HTTPRequestTrace {
159159
* @public
160160
*/
161161
this.b = [];
162-
/**
163-
* Measurement throughput in kbits/s
164-
* @public
165-
*/
166-
this._t = null;
167162
}
168163
}
169164

0 commit comments

Comments
 (0)