diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-08-16 15:09:49 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-08-21 23:18:45 +0200 |
commit | c87ce4bafcfba47518b59fc911cbd6be374cd368 (patch) | |
tree | 34f43c8948b06ff4caba259df7c7d2259790980f /apps/files/js/file-upload.js | |
parent | 0609aeeb0ac86ce428f717e991d4238166ebcac7 (diff) | |
download | nextcloud-server-c87ce4bafcfba47518b59fc911cbd6be374cd368.tar.gz nextcloud-server-c87ce4bafcfba47518b59fc911cbd6be374cd368.zip |
fix: Make smooth bitrate and remaining upload time work when unset
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r-- | apps/files/js/file-upload.js | 12 |
1 files 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})' , { |