Skip to content

Commit

Permalink
fix on 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
palday committed Oct 9, 2024
1 parent 05fe086 commit 838129b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,11 @@ function deserialize_lpcm(stream::LPCMStream, sample_offset::Integer=0,
bytes_per_sample = _bytes_per_sample(stream.format)
jump(stream.io, bytes_per_sample * sample_offset)
byte_count = bytes_per_sample * sample_count
byte_count = byte_count >= 0 ? byte_count : typemax(Int) # handle overflow
return deserialize_lpcm(stream.format, read(stream.io, byte_count))
# XXX on Julia 1.11.0, setting byte_count to the sentinal value typemax(Int)
# doesn't work: the correct number of bytes is returned from `read`, but the
# values change every time. By using a different method, we avoid that problem
bytes = byte_count >= 0 ? read(stream.io, byte_count) : read(stream.io) # handle overflow
return deserialize_lpcm(stream.format, bytes)
end

_matrix(samples::Matrix) = samples
Expand Down

0 comments on commit 838129b

Please sign in to comment.