This read pointer indicate how much we have read, we can use it to inform host side to refill the free periods.
But as it doesn't really mean that we have rendered all of them (there may be several periods in the pipeline buffer), and for the last bytes/period, host side will trigger stop immediately once it got this notification.
To avoid lost for last several periods issue, we postpone this notification to the finish of last bytes/period copy in dai, which will be add in the following patches.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- src/audio/host.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/audio/host.c b/src/audio/host.c index 083261c..2eaea6a 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -174,7 +174,14 @@ static void host_dma_cb_playback(struct comp_dev *dev, hd->host_period_pos += local_elem->size; if (hd->host_period_pos >= hd->host_period_bytes) { hd->host_period_pos = 0; - ipc_stream_send_notification(dev, &hd->cp); + /* for the last bytes/period, send notification later */ + if (hd->host_avail) { + /* update for host side */ + if (hd->host_pos) { + *hd->host_pos = hd->host_pos_read; + ipc_stream_send_notification(dev, &hd->cp); + } + } }
local_elem->src += local_elem->size;