Revert part of a previous change because NSURL caches the file size value and so it breaks the optimize progress bar
This commit is contained in:
1 parent
81b4d88092
commit
ef92468f35
1 file changed
+2
-6
+2
-6
@@ -561,10 +561,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
|||||||
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||||
|
|
||||||
if (tempURL) {
|
if (tempURL) {
|
||||||
NSNumber *tempValue;
|
unsigned long long originalFileSize = [[[fileManager attributesOfItemAtPath:self.URL.path error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
|
||||||
[self.URL getResourceValue:&tempValue forKey:NSURLFileSizeKey error:NULL];
|
|
||||||
|
|
||||||
unsigned long long originalFileSize = tempValue.longLongValue;
|
|
||||||
|
|
||||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||||
noErr = MP4Optimize(self.URL.path.fileSystemRepresentation, tempURL.path.fileSystemRepresentation);
|
noErr = MP4Optimize(self.URL.path.fileSystemRepresentation, tempURL.path.fileSystemRepresentation);
|
||||||
@@ -573,8 +570,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
|||||||
|
|
||||||
// Loop to check the progress
|
// Loop to check the progress
|
||||||
while (!done) {
|
while (!done) {
|
||||||
[tempURL getResourceValue:&tempValue forKey:NSURLFileSizeKey error:NULL];
|
unsigned long long fileSize = [[[fileManager attributesOfItemAtPath:self.tempURL.path error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
|
||||||
unsigned long long fileSize = tempValue.longLongValue;
|
|
||||||
[self progressStatus:((CGFloat)fileSize / originalFileSize) * 100];
|
[self progressStatus:((CGFloat)fileSize / originalFileSize) * 100];
|
||||||
usleep(450000);
|
usleep(450000);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user