Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1597,6 +1597,13 @@ int dai_zephyr_copy(struct dai_data *dd, struct comp_dev *dev, pcm_converter_fun
samples = MIN(samples, src_samples);
}

/* return if nothing to copy */
if (!samples) {
comp_warn(dev, "dai_zephyr_copy(): nothing to copy, dd->total_data_processed %llu", dd->total_data_processed);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome addition. Might be good to add also data on the sink/src_samples status, providing hints whether we are not copying because of pipeline not providing/consuming data, or because of the DAI side. But can be done in later PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the contrary, I would suggest add less characters as possible, if there is an error here, we already get the information, we can add more information personally in local build, add too much debug related code will eventually make 1.9MB exhausted, then have to split out modules as loadable modules, then maybe more bugs will come.

dma_reload(dd->chan->dma->z_dev, dd->chan->index, 0, 0, 0);
return 0;
}

/* limit bytes per copy to one period for the whole pipeline
* in order to avoid high load spike
* if FAST_MODE is enabled, then one period limitation is omitted
Expand All @@ -1619,13 +1626,6 @@ int dai_zephyr_copy(struct dai_data *dd, struct comp_dev *dev, pcm_converter_fun
comp_warn(dev, "dai_zephyr_copy(): Copy_bytes %d + free bytes %d < period bytes %d, possible glitch",
copy_bytes, free_bytes, dd->period_bytes);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we do skip the glitch detection as well. This has no functional impact, but will affect debugging as the buffer avail/free state is not printed out when we do run out.

/* return if nothing to copy */
if (!copy_bytes) {
comp_warn(dev, "dai_zephyr_copy(): nothing to copy");
dma_reload(dd->chan->dma->z_dev, dd->chan->index, 0, 0, 0);
return 0;
}

/* trigger optional DAI_TRIGGER_COPY which prepares dai to copy */
ret = dai_trigger(dd->dai->dev, dev->direction, DAI_TRIGGER_COPY);
if (ret < 0)
Expand Down
4 changes: 2 additions & 2 deletions src/audio/host-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ static uint32_t host_get_copy_bytes_normal(struct host_data *hd, struct comp_dev
dma_copy_bytes = MIN(hd->period_bytes, dma_copy_bytes);

if (!dma_copy_bytes)
comp_info(dev, "no bytes to copy, available samples: %d, free_samples: %d",
avail_samples, free_samples);
comp_info(dev, "no bytes to copy, hd->total_data_processed %llu available samples: %d, free_samples: %d",
hd->total_data_processed, avail_samples, free_samples);

buffer_release(buffer_c);

Expand Down