Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
75f1c453
Commit
75f1c453
authored
Oct 22, 2013
by
Felix Paul Kühne
Browse files
Downloads: update stats every 0.5s only
parent
3d9c4731
Changes
1
Hide whitespace changes
Inline
Side-by-side
AspenProject/VLCDownloadViewController.m
View file @
75f1c453
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
VLCHTTPFileDownloader
*
_httpDownloader
;
VLCHTTPFileDownloader
*
_httpDownloader
;
WRRequestDownload
*
_FTPDownloadRequest
;
WRRequestDownload
*
_FTPDownloadRequest
;
NSTimeInterval
_lastStatsUpdate
;
}
}
@end
@end
...
@@ -228,9 +229,12 @@
...
@@ -228,9 +229,12 @@
-
(
void
)
progressUpdatedTo
:(
CGFloat
)
percentage
receivedDataSize
:(
CGFloat
)
receivedDataSize
expectedDownloadSize
:(
CGFloat
)
expectedDownloadSize
-
(
void
)
progressUpdatedTo
:(
CGFloat
)
percentage
receivedDataSize
:(
CGFloat
)
receivedDataSize
expectedDownloadSize
:(
CGFloat
)
expectedDownloadSize
{
{
[
self
.
progressPercent
setText
:[
NSString
stringWithFormat
:
@"%.1f%%"
,
percentage
*
100
]];
if
((
_lastStatsUpdate
>
0
&&
([
NSDate
timeIntervalSinceReferenceDate
]
-
_lastStatsUpdate
>
.
5
))
||
_lastStatsUpdate
<=
0
)
{
[
self
.
timeDL
setText
:[
self
calculateRemainingTime
:
receivedDataSize
expectedDownloadSize
:
expectedDownloadSize
]];
[
self
.
progressPercent
setText
:[
NSString
stringWithFormat
:
@"%.1f%%"
,
percentage
*
100
]];
[
self
.
speedRate
setText
:[
self
calculateSpeedString
:
receivedDataSize
]];
[
self
.
timeDL
setText
:[
self
calculateRemainingTime
:
receivedDataSize
expectedDownloadSize
:
expectedDownloadSize
]];
[
self
.
speedRate
setText
:[
self
calculateSpeedString
:
receivedDataSize
]];
_lastStatsUpdate
=
[
NSDate
timeIntervalSinceReferenceDate
];
}
[
self
.
progressView
setProgress
:
percentage
animated
:
YES
];
[
self
.
progressView
setProgress
:
percentage
animated
:
YES
];
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment