diff --git a/src/streaming/models/MetricsModel.js b/src/streaming/models/MetricsModel.js index 65b857abbc..1e1ed310ee 100644 --- a/src/streaming/models/MetricsModel.js +++ b/src/streaming/models/MetricsModel.js @@ -116,13 +116,12 @@ function MetricsModel(config) { } } - function appendHttpTrace(httpRequest, s, d, b, t) { + function appendHttpTrace(httpRequest, s, d, b) { let vo = new HTTPRequestTrace(); vo.s = s; vo.d = d; vo.b = b; - vo._t = t; httpRequest.trace.push(vo); @@ -188,7 +187,7 @@ function MetricsModel(config) { if (traces) { traces.forEach(trace => { - appendHttpTrace(vo, trace.s, trace.d, trace.b, trace.t); + appendHttpTrace(vo, trace.s, trace.d, trace.b); }); } else { // The interval and trace shall be absent for redirect and failure records. diff --git a/src/streaming/net/FetchLoader.js b/src/streaming/net/FetchLoader.js index e30ce8c218..0be29580f3 100644 --- a/src/streaming/net/FetchLoader.js +++ b/src/streaming/net/FetchLoader.js @@ -231,16 +231,22 @@ function FetchLoader(cfg) { // are correctly generated // Same structure as https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequestEventTarget/ let calculatedThroughput = null; + let calculatedTime = null; if (calculationMode === Constants.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING) { calculatedThroughput = calculateThroughputByChunkData(startTimeData, endTimeData); + if (calculatedThroughput) { + calculatedTime = bytesReceived * 8 / calculatedThroughput; + } + } + else if (calculationMode === Constants.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA) { + calculatedTime = calculateDownloadedTime(downloadedData, bytesReceived); } httpRequest.progress({ loaded: bytesReceived, total: isNaN(totalBytes) ? bytesReceived : totalBytes, lengthComputable: true, - time: calculateDownloadedTime(downloadedData, bytesReceived), - throughput: calculatedThroughput, + time: calculatedTime, stream: true }); } diff --git a/src/streaming/net/HTTPLoader.js b/src/streaming/net/HTTPLoader.js index c1755148ef..26ec382903 100644 --- a/src/streaming/net/HTTPLoader.js +++ b/src/streaming/net/HTTPLoader.js @@ -208,8 +208,7 @@ function HTTPLoader(cfg) { traces.push({ s: lastTraceTime, d: event.time ? event.time : currentTime.getTime() - lastTraceTime.getTime(), - b: [event.loaded ? event.loaded - lastTraceReceivedCount : 0], - t: event.throughput + b: [event.loaded ? event.loaded - lastTraceReceivedCount : 0] }); lastTraceTime = currentTime; diff --git a/src/streaming/rules/ThroughputHistory.js b/src/streaming/rules/ThroughputHistory.js index fc7c0c52a2..ac5ea92d3a 100644 --- a/src/streaming/rules/ThroughputHistory.js +++ b/src/streaming/rules/ThroughputHistory.js @@ -91,14 +91,7 @@ function ThroughputHistory(config) { let throughputMeasureTime = 0, throughput = 0; if (httpRequest._fileLoaderType && httpRequest._fileLoaderType === Constants.FILE_LOADER_TYPES.FETCH) { - const calculationMode = settings.get().streaming.abr.fetchThroughputCalculationMode; - if (calculationMode === Constants.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING) { - const sumOfThroughputValues = httpRequest.trace.reduce((a, b) => a + b._t, 0); - throughput = Math.round(sumOfThroughputValues / httpRequest.trace.length); - } - if (throughput === 0) { - throughputMeasureTime = httpRequest.trace.reduce((a, b) => a + b.d, 0); - } + throughputMeasureTime = httpRequest.trace.reduce((a, b) => a + b.d, 0); } else { throughputMeasureTime = useDeadTimeLatency ? downloadTimeInMilliseconds : latencyTimeInMilliseconds + downloadTimeInMilliseconds; } diff --git a/src/streaming/vo/metrics/HTTPRequest.js b/src/streaming/vo/metrics/HTTPRequest.js index 071e64536e..ba3b45e26d 100644 --- a/src/streaming/vo/metrics/HTTPRequest.js +++ b/src/streaming/vo/metrics/HTTPRequest.js @@ -159,11 +159,6 @@ class HTTPRequestTrace { * @public */ this.b = []; - /** - * Measurement throughput in kbits/s - * @public - */ - this._t = null; } }