From 7b843b1d56d5b65a7fe1fdf89976bdf7ccfd568c Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Wed, 3 Jan 2024 08:41:45 +0000 Subject: [PATCH] Avoid repeating old samples when entering underflow state --- CHANGELOG.rst | 1 + lib_xua/src/core/clocking/clockgen.xc | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ff384e99..3ffb3cf7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,7 @@ HEAD * RESOLVED: Input stream sending an erroneous zero-length packet when exiting underflow state * RESOLVED Build failures when XUA_USB_EN = 0 * RESOLVED: Clock configuration issues when ADAT and S/PDIF receive are enabled (#352) + * RESOLVED: Repeated old S/PDIF and ADAT samples when entering underflow state * CHANGED: QUAD_SPI_FLASH replaced by XUA_QUAD_SPI_FLASH (default: 1) * CHANGED: UserBufferManagementInit() now takes a sample rate parameter diff --git a/lib_xua/src/core/clocking/clockgen.xc b/lib_xua/src/core/clocking/clockgen.xc index d6ebe69a..9bacdfb1 100644 --- a/lib_xua/src/core/clocking/clockgen.xc +++ b/lib_xua/src/core/clocking/clockgen.xc @@ -1,4 +1,4 @@ -// Copyright 2011-2023 XMOS LIMITED. +// Copyright 2011-2024 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include @@ -718,7 +718,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa spdifSamps -= 2; /* spdifSamps could go to -1 */ - if(spdifSamps < 0) + if(spdifSamps <= 0) { /* We're out of S/PDIF samples, mark underflow condition */ spdifUnderflow = 1; @@ -799,7 +799,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa } /* adatSamps could go to -1 */ - if (adatSamps < 0) + if (adatSamps <= 0) { /* we're out of ADAT samples, mark underflow condition */ adatUnderflow = 1;