[Sound-open-firmware] [PATCH] component: don't report xrun in comp_copy().
Liam Girdwood
liam.r.girdwood at linux.intel.com
Tue Jan 16 16:15:22 CET 2018
On Tue, 2018-01-16 at 22:05 +0800, Keyon Jie wrote:
> We don't need to report xrun every time it can't do real
> copy(buffer avail/free not enough),
Why ? what problem is this solving ?
> e.g. we actually don't
> need copy if sink buffer is full, we should do empty copy
> and return success to let pipeline schedule continue.
>
> The xrun will be checked in scheduling component (usually
> is dai) only and reported there.
>
> Todo: remove xrun check in other components also, e.g.
> mixer, src, etc.
>
> Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> ---
> Sanity test passed on minnow turbot with rt5651.
> SOF #master: commit 83fec1559716d5a06137b43848abc18c244bc9e6
> SOF Tool #master: commit a6bb8de907acd642302a227f403bb9fb2c18d075
> Kernel: git at github.com:plbossart/sound.git #topic/sof-v4.14:
> commit 772ab0da7a8298d08edd42ab9a4f4177ec37aec6
>
> src/audio/host.c | 6 +++---
> src/audio/volume.c | 12 ++++++------
> 2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/audio/host.c b/src/audio/host.c
> index 7cba6df..0a047b3 100644
> --- a/src/audio/host.c
> +++ b/src/audio/host.c
> @@ -622,9 +622,9 @@ static int host_copy(struct comp_dev *dev)
>
> if (dma_buffer->free < local_elem->size) {
> /* make sure there is free bytes for next period */
> - trace_host_error("xro");
> - comp_overrun(dev, dma_buffer, local_elem->size, 0);
> - return -EIO;
> + /* dont be too nervous, just warning and return */
> + trace_host("xo?");
How will host userspace know about XRUN ?
Also this means that the xrun will propagate through the pipeline (as
each sink/source may underrun or overrun until xrun clears) causing a
longer overall audio artefact.
Liam
> + return 0;
> }
> } else {
>
> diff --git a/src/audio/volume.c b/src/audio/volume.c
> index 05459b8..9ea3c92 100644
> --- a/src/audio/volume.c
> +++ b/src/audio/volume.c
> @@ -577,14 +577,14 @@ static int volume_copy(struct comp_dev *dev)
> * the sink component buffer has enough free bytes for copy. Also
> * check for XRUNs */
> if (source->avail < cd->source_period_bytes) {
> - trace_volume_error("xru");
> - comp_underrun(dev, source, cd->source_period_bytes, 0);
> - return -EIO; /* xrun */
> + /* dont be too nervous, just warning if can't copy this time */
> + trace_volume("xu?");
> + return 0; /* don't break the pipeline */
> }
> if (sink->free < cd->sink_period_bytes) {
> - trace_volume_error("xro");
> - comp_overrun(dev, sink, cd->sink_period_bytes, 0);
> - return -EIO; /* xrun */
> + /* dont be too nervous, just warning if can't copy this time */
> + trace_volume_error("xo?");
> + return 0; /* don't break the pipeline */
> }
>
> /* copy and scale volume */
More information about the Sound-open-firmware
mailing list