[Sound-open-firmware] [PATCH v2 3/5] host: host_copy(): add handle for capture

Keyon Jie yang.jie at linux.intel.com
Thu Feb 16 09:08:38 CET 2017


For playback, don't copy if there is no available data;
For capture, don't copy if there is no free host side buffer.

Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
 src/audio/host.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/audio/host.c b/src/audio/host.c
index b604ddc..f15dd33 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -815,7 +815,12 @@ static int host_copy(struct comp_dev *dev)
 	if (dev->state != COMP_STATE_RUNNING)
 		return 0;
 
-	if (hd->host_avail == 0)
+	/* don't copy if the host side buffer is not ready */
+	if ((hd->params.direction == STREAM_DIRECTION_PLAYBACK)
+		&&  (hd->host_avail == 0))
+		return 0;
+	if ((hd->params.direction == STREAM_DIRECTION_CAPTURE)
+		&& (hd->host_free == 0))
 		return 0;
 
 	/* do DMA transfer */
-- 
2.7.4



More information about the Sound-open-firmware mailing list