From 0674880c112a80687368f0be91b8c5d09626b9a3 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 15 Feb 2018 16:08:21 +0000 Subject: [PATCH] Undo accidental removal of buffering bounds check --- lib_xua/src/core/buffer/decouple/decouple.xc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index a5f235f5..aaf74386 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -491,12 +491,12 @@ __builtin_unreachable(); totalSampsToWrite = speedRem >> 16; speedRem &= 0xffff; -# if 0 + /* This patches up the case where the FB is well off, leading to totalSampsToWrite to also be off */ + /* This can be startup case, back mclk input etc */ if (totalSampsToWrite < 0 || totalSampsToWrite * g_curSubSlot_In * g_numUsbChan_In > g_maxPacketSize) { totalSampsToWrite = 0; } -#endif /* Calc slots left in fifo */ space_left = g_aud_to_host_rdptr - g_aud_to_host_wrptr; @@ -507,7 +507,6 @@ __builtin_unreachable(); space_left = aud_to_host_fifo_end - g_aud_to_host_wrptr; } - //if((space_left > 0) && (space_left < (totalSampsToWrite * g_numUsbChan_In * g_curSubSlot_In + 4))) if((space_left < (totalSampsToWrite * g_numUsbChan_In * g_curSubSlot_In + 4))) { /* In pipe has filled its buffer - we need to overflow