[Sound-open-firmware] [PATCH] comp: volume: use XRUN handler to report XRUNs

Liam Girdwood liam.r.girdwood at linux.intel.com
Tue Aug 22 23:35:07 CEST 2017


Use the new XRUN API to report XRUNs to host and trace.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/audio/volume.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/audio/volume.c b/src/audio/volume.c
index c81fd33..925a274 100644
--- a/src/audio/volume.c
+++ b/src/audio/volume.c
@@ -467,9 +467,12 @@ static int volume_copy(struct comp_dev *dev)
 	copy_bytes = comp_buffer_get_copy_bytes(dev, source, sink);
 
 	/* Run volume if buffers have enough room */
-	if (copy_bytes < cd->source_period_bytes ||
-		copy_bytes < cd->sink_period_bytes) {
-		trace_volume_error("xru");
+	if (copy_bytes < cd->source_period_bytes) {
+		comp_underrun(dev, source, cd->source_period_bytes);
+		return 0;
+	}
+	if (copy_bytes < cd->sink_period_bytes) {
+		comp_overrun(dev, source, cd->sink_period_bytes);
 		return 0;
 	}
 
-- 
2.11.0



More information about the Sound-open-firmware mailing list