Fix rare issue where DASH/HLS dl speed divides by 0

This commit is contained in:
rlaphoenix 2023-03-26 14:30:12 +01:00
parent 1c73e8d7fa
commit 71cf2b4016
2 changed files with 2 additions and 2 deletions

View File

@ -568,7 +568,7 @@ class DASH:
if download_sizes and (time_since > 5 or finished_threads == len(segments)): if download_sizes and (time_since > 5 or finished_threads == len(segments)):
data_size = sum(download_sizes) data_size = sum(download_sizes)
download_speed = data_size / time_since download_speed = data_size / (time_since or 1)
progress(downloaded=f"DASH {filesize.decimal(download_speed)}/s") progress(downloaded=f"DASH {filesize.decimal(download_speed)}/s")
last_speed_refresh = now last_speed_refresh = now
download_sizes.clear() download_sizes.clear()

View File

@ -413,7 +413,7 @@ class HLS:
if download_sizes and (time_since > 5 or finished_threads == len(master.segments)): if download_sizes and (time_since > 5 or finished_threads == len(master.segments)):
data_size = sum(download_sizes) data_size = sum(download_sizes)
download_speed = data_size / time_since download_speed = data_size / (time_since or 1)
progress(downloaded=f"HLS {filesize.decimal(download_speed)}/s") progress(downloaded=f"HLS {filesize.decimal(download_speed)}/s")
last_speed_refresh = now last_speed_refresh = now
download_sizes.clear() download_sizes.clear()