fix seek crash: Double value gets infinit and can't be converted to Int64 (#115)
* fix seek crash: Double value get infinit and can't be converted to Int64 * add CoreAudio import to be able to build for macOS Catalyst
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
import CoreAudio
|
||||
|
||||
enum AudioConvertStatus: Int32 {
|
||||
case done = 100
|
||||
@@ -104,6 +105,8 @@ final class AudioFileStreamProcessor {
|
||||
let dataLengthInBytes = Double(readingEntry.audioDataLengthBytes())
|
||||
let entryDuration = readingEntry.duration()
|
||||
let duration = entryDuration < readingEntry.progress && entryDuration > 0 ? readingEntry.progress : entryDuration
|
||||
|
||||
guard duration > 0.0 else { return }
|
||||
|
||||
var seekByteOffset = Int64(dataOffset + (readingEntry.seekRequest.time / duration) * dataLengthInBytes)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user