mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
vector-im/element-ios/issues/4753 - Prevent unnecessary audio file conversions if final file already exists on disk.
This commit is contained in:
committed by
Stefan Ceriu
parent
c70c4fb70a
commit
f21a469f9a
@@ -208,9 +208,9 @@ class VoiceMessageAttachmentCacheManager {
|
||||
return
|
||||
}
|
||||
|
||||
let newURL = temporaryFilesFolderURL.appendingPathComponent(ProcessInfo().globallyUniqueString).appendingPathExtension("m4a")
|
||||
let newURL = temporaryFilesFolderURL.appendingPathComponent(identifier).appendingPathExtension("m4a")
|
||||
|
||||
VoiceMessageAudioConverter.convertToMPEG4AAC(sourceURL: URL(fileURLWithPath: filePath), destinationURL: newURL) { result in
|
||||
let conversionCompletion: (Result<Void, VoiceMessageAudioConverterError>) -> Void = { result in
|
||||
self.workQueue.async {
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -245,6 +245,12 @@ class VoiceMessageAttachmentCacheManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if FileManager.default.fileExists(atPath: newURL.path) {
|
||||
conversionCompletion(Result.success(()))
|
||||
} else {
|
||||
VoiceMessageAudioConverter.convertToMPEG4AAC(sourceURL: URL(fileURLWithPath: filePath), destinationURL: newURL, completion: conversionCompletion)
|
||||
}
|
||||
}
|
||||
|
||||
private func sampleFileAtURL(_ url: URL, duration: TimeInterval, numberOfSamples: Int, identifier: String, semaphore: DispatchSemaphore) {
|
||||
|
||||
Reference in New Issue
Block a user