[Sound-open-firmware] [PATCH 2/2] dai: tell pipeline if no data has entered capture buffers

Liam Girdwood liam.r.girdwood at linux.intel.com
Fri Dec 8 23:57:12 CET 2017


Let the pipeline know if no data has entered the capture buffers at
stream start.

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

diff --git a/src/audio/dai.c b/src/audio/dai.c
index 2fbfc5f..558369f 100644
--- a/src/audio/dai.c
+++ b/src/audio/dai.c
@@ -528,6 +528,7 @@ static int dai_cmd(struct comp_dev *dev, int cmd, void *data)
 		break;
 	case COMP_CMD_XRUN:
 		dd->xrun = 1;
+		/* fall through */
 	case COMP_CMD_PAUSE:
 	case COMP_CMD_STOP:
 		wait_init(&dd->complete);
@@ -550,6 +551,12 @@ static int dai_cmd(struct comp_dev *dev, int cmd, void *data)
 /* copy and process stream data from source to sink buffers */
 static int dai_copy(struct comp_dev *dev)
 {
+	/* has data entered the capture buffer yet ? */
+	if (dev->params.direction == SOF_IPC_STREAM_CAPTURE &&
+			dev->position == 0) {
+		/* tell pipeline not to process downstream */
+		return -ENODATA;
+	}
 	return 0;
 }
 
-- 
2.14.1



More information about the Sound-open-firmware mailing list