aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader/fragment.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-03-06 05:36:52 +0600
committerSergey M․ <dstftw@gmail.com>2016-03-06 05:36:52 +0600
commit1b5284b13f1b579b2cbac5ce6ab9faa5b95800fb (patch)
treeb5671d04465d7152a1e526aeb28527ce6a35141c /youtube_dl/downloader/fragment.py
parentd1e4a464cd9f0efd6a9020c8577eb319847c0a68 (diff)
[downloader/fragment] Make speed more smooth
At the beginning of every segment there was a drop to Unknown speed due to timeslice being too small to calculate speed. Now last speed from the previous fragment is used.
Diffstat (limited to 'youtube_dl/downloader/fragment.py')
-rw-r--r--youtube_dl/downloader/fragment.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube_dl/downloader/fragment.py b/youtube_dl/downloader/fragment.py
index 5bc99492b..a5bae9669 100644
--- a/youtube_dl/downloader/fragment.py
+++ b/youtube_dl/downloader/fragment.py
@@ -99,7 +99,8 @@ class FragmentFD(FileDownloader):
state['eta'] = self.calc_eta(
start, time_now, estimated_size,
state['downloaded_bytes'])
- state['speed'] = s.get('speed')
+ state['speed'] = s.get('speed') or ctx.get('speed')
+ ctx['speed'] = state['speed']
ctx['prev_frag_downloaded_bytes'] = frag_downloaded_bytes
self._hook_progress(state)