Skip to content

Commit bccfc20

Browse files
authored
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
1 parent 69dc0d6 commit bccfc20

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

AudioStreaming/Streaming/AudioPlayer/Processors/AudioFileStreamProcessor.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import AVFoundation
9+
import CoreAudio
910

1011
enum AudioConvertStatus: Int32 {
1112
case done = 100
@@ -104,6 +105,8 @@ final class AudioFileStreamProcessor {
104105
let dataLengthInBytes = Double(readingEntry.audioDataLengthBytes())
105106
let entryDuration = readingEntry.duration()
106107
let duration = entryDuration < readingEntry.progress && entryDuration > 0 ? readingEntry.progress : entryDuration
108+
109+
guard duration > 0.0 else { return }
107110

108111
var seekByteOffset = Int64(dataOffset + (readingEntry.seekRequest.time / duration) * dataLengthInBytes)
109112

0 commit comments

Comments
 (0)