@@ -24,7 +24,7 @@ class ChunkedFileUploader {
24
24
private var delegates : [ String : ChunkedFileUploaderDelegate ] = [ : ]
25
25
26
26
private let file : ChunkedFile
27
- private var currentWorkTask : Task < ( ) , Never > ? = nil
27
+ private var currentWorkTask : Task < ( ) , Error > ? = nil
28
28
private var _currentState : InternalUploadState = . ready
29
29
private var overallProgress : Progress = Progress ( )
30
30
private var lastReadCount : UInt64 = 0
@@ -94,7 +94,7 @@ class ChunkedFileUploader {
94
94
do {
95
95
// It's fine if it's already open, that's handled by ignoring the call
96
96
let fileSize = try FileManager . default. fileSizeOfItem (
97
- atPath: uploadInfo . videoFile . path
97
+ atPath: inputFileURL . path
98
98
)
99
99
let result = try await makeWorker ( ) . performUpload ( )
100
100
file. close ( )
@@ -137,21 +137,26 @@ class ChunkedFileUploader {
137
137
} else {
138
138
MuxUploadSDK . logger? . debug ( " Task finished due to error in state \( String ( describing: self . currentState) ) " )
139
139
let uploadError = InternalUploaderError ( reason: error, lastByte: lastReadCount)
140
+ notifyStateFromWorker ( . failure( uploadError) )
140
141
141
142
if shouldReport {
143
+ let fileSize = try FileManager . default. fileSizeOfItem (
144
+ atPath: inputFileURL. path
145
+ )
146
+
142
147
#warning("Start and end time need to be fixed")
143
148
reporter. reportUploadFailure (
144
149
transportStartTime: 0 ,
145
150
transportEndTime: 0 ,
146
151
errorDescription: uploadError. localizedDescription,
147
- inputSize: file . fileSize,
152
+ inputSize: fileSize,
148
153
inputStandardizationEnabled: uploadInfo. options. inputStandardization. isEnabled,
149
154
inputDuration: 0.0 ,
150
155
uploadURL: uploadInfo. uploadURL
151
156
)
152
157
}
153
158
154
- notifyStateFromWorker ( . failure ( uploadError ) )
159
+
155
160
}
156
161
}
157
162
}
@@ -289,9 +294,8 @@ fileprivate actor Worker {
289
294
290
295
let startTime = Date ( ) . timeIntervalSince1970
291
296
let fileSize = try FileManager . default. fileSizeOfItem (
292
- atPath: uploadInfo . videoFile . path
297
+ atPath: inputFileURL . path
293
298
)
294
-
295
299
let wideFileSize : Int64
296
300
297
301
// Prevent overflow if UInt64 exceeds Int64.max
0 commit comments