diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:49 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:49 +0200 |
| commit | 76956486fa7ef52a51d4e56df1e13a9f19a6c93c (patch) | |
| tree | fe0c394439fdc167d1970372e8998874090854dd /Modulator/JttyPcmFifo.cpp | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
| parent | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (diff) | |
Update upstream source from tag 'upstream/3.3.0_beta1+dfsg'
Update to upstream version '3.3.0~beta1+dfsg'
with Debian dir 85037bbb9376721108594b59b54ead82ac6924a3
Diffstat (limited to 'Modulator/JttyPcmFifo.cpp')
| -rw-r--r-- | Modulator/JttyPcmFifo.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Modulator/JttyPcmFifo.cpp b/Modulator/JttyPcmFifo.cpp index fd6d82d7..f78cbede 100644 --- a/Modulator/JttyPcmFifo.cpp +++ b/Modulator/JttyPcmFifo.cpp @@ -61,8 +61,8 @@ bool JttyPcmFifo::enqueue (qint16 const * samples, qint64 count, qint64 epoch) { if (!samples || count <= 0) return true; - qint64 const used = m_used.load (std::memory_order_acquire); - if (!jttyPcmEnqueueFits (m_capacity, used, count)) return false; + if (!jttyPcmEnqueueFits ( + m_capacity, m_used.load (std::memory_order_acquire), count)) return false; qint64 const tail = copyIntoRing (m_buffer, m_capacity, m_tail.load (std::memory_order_relaxed), @@ -170,9 +170,12 @@ JttyPcmFifo::DrainState JttyPcmFifo::takeDrainReady () noexcept qint64 JttyPcmFifo::queuedReal () const noexcept { - qint64 const used = m_used.load (std::memory_order_acquire); + // Read the reset baseline and served count before occupancy: a consumer + // applying a reset stores the decremented occupancy before publishing the + // new served count, so this order never over-reports the logical queue. qint64 const resetTotal = m_resetTotalBaseline.load (std::memory_order_acquire); qint64 const served = m_servedReal.load (std::memory_order_acquire); + qint64 const used = m_used.load (std::memory_order_acquire); qint64 const abortedQueued = resetTotal > served ? resetTotal - served : 0; return used > abortedQueued ? used - abortedQueued : 0; } |
