From 60a5eb60593d504106df2937a86c761438ecad5e Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 16 Aug 2023 15:09:49 +0200 Subject: [PATCH] fix: Make smooth bitrate and remaining upload time work when unset Signed-off-by: Ferdinand Thiessen --- apps/files/js/file-upload.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 7a129a989d1..a4058fd1ad5 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -1264,10 +1264,10 @@ OC.Uploader.prototype = _.extend({ } //console.log('#', ' idx: ',bufferIndex, ' Total: ', bufferTotal, ' remainSeconds: ', remainingSeconds, ' during: ', diffUpdate); - if (smoothRemainingSeconds === null) { - smoothRemainingSeconds = bufferTotal / bufferSize; - } else{ + if (smoothRemainingSeconds) { smoothRemainingSeconds = smoothing * (bufferTotal / bufferSize) + ((1-smoothing) * smoothRemainingSeconds); + } else { + smoothRemainingSeconds = bufferTotal / bufferSize; } if (bufferIndex % 4 === 0) { @@ -1281,10 +1281,10 @@ OC.Uploader.prototype = _.extend({ } // smooth bitrate - if (smoothBitrate === null) { - smoothBitrate = data.bitrate; - } else{ + if (smoothBitrate) { smoothBitrate = smoothing * data.bitrate + ((1-smoothing) * smoothBitrate); + } else { + smoothBitrate = data.bitrate; } self._setProgressBarText(h, h, t('files', '{loadedSize} of {totalSize} ({bitrate})' , { -- 2.39.5