|
@@ -35,7 +35,7 @@
|
|
|
- (instancetype)init {
|
|
- (instancetype)init {
|
|
|
|
|
|
|
|
if (self = [super init]) {
|
|
if (self = [super init]) {
|
|
|
- _maxUploadLoadCount = 3;
|
|
|
|
|
|
|
+ _maxUploadLoadCount = 2;
|
|
|
|
|
|
|
|
_arrayLock = [NSLock new];
|
|
_arrayLock = [NSLock new];
|
|
|
//[self registeNotification];
|
|
//[self registeNotification];
|
|
@@ -107,6 +107,9 @@
|
|
|
if(operation){
|
|
if(operation){
|
|
|
HLog(@"删除完成的上传任务")
|
|
HLog(@"删除完成的上传任务")
|
|
|
[_arrayLock lock];
|
|
[_arrayLock lock];
|
|
|
|
|
+ if(operation.fileHandle){
|
|
|
|
|
+ [operation closeFileHandleFun];
|
|
|
|
|
+ }
|
|
|
[self.uploadingOperationArr removeObject:operation];
|
|
[self.uploadingOperationArr removeObject:operation];
|
|
|
[_arrayLock unlock];
|
|
[_arrayLock unlock];
|
|
|
}
|
|
}
|
|
@@ -438,7 +441,7 @@
|
|
|
[paraDict setObject:[NSNumber numberWithLong:position] forKey:@"position"];
|
|
[paraDict setObject:[NSNumber numberWithLong:position] forKey:@"position"];
|
|
|
|
|
|
|
|
//视频数据切片
|
|
//视频数据切片
|
|
|
- __block NSData *videoData = [self cutVideoFileFunAtIndex:position withMaxLenght:MaxNasUploadPieceSzie withModel:operation.fileModel];
|
|
|
|
|
|
|
+ __block NSData *videoData = [self cutVideoFileFunAtIndex:position withMaxLenght:MaxNasUploadPieceSzie withModel:operation.fileModel withOperation:operation];
|
|
|
|
|
|
|
|
if(!videoData ||videoData.length ==0){
|
|
if(!videoData ||videoData.length ==0){
|
|
|
HLog(@"视频没获取到")
|
|
HLog(@"视频没获取到")
|
|
@@ -475,7 +478,10 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark 分段读视频文件
|
|
#pragma mark 分段读视频文件
|
|
|
--(NSData*)cutVideoFileFunAtIndex:(NSUInteger)dataIndex withMaxLenght:(NSInteger)maxLengt withModel:(uploadFileDataModel*)dataModel{
|
|
|
|
|
|
|
+-(NSData*)cutVideoFileFunAtIndex:(NSUInteger)dataIndex withMaxLenght:(NSInteger)maxLengt withModel:(uploadFileDataModel*)dataModel withOperation:(customUploadOperation*)operation{
|
|
|
|
|
+
|
|
|
|
|
+ //return [operation cutVideoFileFunAtIndex:dataIndex withMaxLenght:maxLengt];
|
|
|
|
|
+
|
|
|
HLog(@"视频切片开始 线程:%@",[NSThread currentThread]);
|
|
HLog(@"视频切片开始 线程:%@",[NSThread currentThread]);
|
|
|
|
|
|
|
|
NSString *filePath = [cachesFileManager getFilePathWithName:dataModel.filename type:uploadFileTypeVideo]; // 文件路径
|
|
NSString *filePath = [cachesFileManager getFilePathWithName:dataModel.filename type:uploadFileTypeVideo]; // 文件路径
|
|
@@ -865,6 +871,11 @@ didReceiveResponse:(NSURLResponse *)response
|
|
|
if([operation.fileModel.filename isEqualToString:fileModel.filename]){
|
|
if([operation.fileModel.filename isEqualToString:fileModel.filename]){
|
|
|
operation.isCancelType = YES;
|
|
operation.isCancelType = YES;
|
|
|
[operation.dataTask cancel];
|
|
[operation.dataTask cancel];
|
|
|
|
|
+
|
|
|
|
|
+ if(operation.fileHandle){
|
|
|
|
|
+ [operation closeFileHandleFun];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
didUnLockType = YES;
|
|
didUnLockType = YES;
|
|
|
[_arrayLock unlock];
|
|
[_arrayLock unlock];
|
|
|
[self beginUploadAfterDeleteOperationBy:operation];
|
|
[self beginUploadAfterDeleteOperationBy:operation];
|
|
@@ -898,6 +909,9 @@ didReceiveResponse:(NSURLResponse *)response
|
|
|
HLog(@"正在遍历数组 _uploadingOperationArr:%@",_uploadingOperationArr);
|
|
HLog(@"正在遍历数组 _uploadingOperationArr:%@",_uploadingOperationArr);
|
|
|
operation.isCancelType = YES;
|
|
operation.isCancelType = YES;
|
|
|
[operation.dataTask cancel];
|
|
[operation.dataTask cancel];
|
|
|
|
|
+ if(operation.fileHandle){
|
|
|
|
|
+ [operation closeFileHandleFun];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
[_uploadingOperationArr removeAllObjects];
|
|
[_uploadingOperationArr removeAllObjects];
|