Skip to content

Commit

Permalink
Fix ringbuffer write
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Sep 13, 2023
1 parent eccd7fd commit 018e45d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions distrho/extra/RingBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class RingBufferControl

const uint32_t wrap = buffer->tail > buffer->wrtn ? 0 : buffer->size;

return wrap + buffer->tail - buffer->wrtn;
return wrap + buffer->tail - buffer->wrtn - 1;
}

// -------------------------------------------------------------------
Expand Down Expand Up @@ -633,7 +633,7 @@ class RingBufferControl
const uint32_t wrtn = buffer->wrtn;
const uint32_t wrap = tail > wrtn ? 0 : buffer->size;

if (size > wrap + tail - wrtn)
if (size >= wrap + tail - wrtn)
{
if (! errorWriting)
{
Expand Down

0 comments on commit 018e45d

Please sign in to comment.