diff --git a/src/noop.jl b/src/noop.jl index d5b511c7..1a3e65f4 100644 --- a/src/noop.jl +++ b/src/noop.jl @@ -167,7 +167,7 @@ function fillbuffer(stream::NoopStream; eager::Bool = false) end nfilled::Int = 0 while ((!eager && buffersize(buffer) == 0) || (eager && makemargin!(buffer, 0, eager = true) > 0)) && !eof(stream.stream) - makemargin!(buffer, 1) + makemargin!(buffer, max(1, div(length(buffer), 2))) nfilled += readdata!(stream.stream, buffer) end buffer.transcoded += nfilled diff --git a/src/stream.jl b/src/stream.jl index ade7a058..fb4bc88d 100644 --- a/src/stream.jl +++ b/src/stream.jl @@ -575,7 +575,7 @@ function fillbuffer(stream::TranscodingStream; eager::Bool = false) end callstartproc(stream, :read) end - makemargin!(buffer2, 1) + makemargin!(buffer2, max(1, div(length(buffer2), 2))) readdata!(stream.stream, buffer2) _, Δout = callprocess(stream, buffer2, buffer1) nfilled += Δout