[alsa-devel] [PATCH v2 6/6] ASoC: wm_adsp: Use new snd_compr_stop_xrun to signal stream failure
Charles Keepax
ckeepax at opensource.wolfsonmicro.com
Wed Apr 6 12:21:55 CEST 2016
If we encounter a fatal error on the compressed stream call the new
snd_compr_stop_xrun to shutdown the stream and allow the core to inform
user-space that the stream is no longer valid.
Signed-off-by: Charles Keepax <ckeepax at opensource.wolfsonmicro.com>
---
sound/soc/codecs/wm_adsp.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 3ac2e1f..4e06776 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -2913,6 +2913,7 @@ int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
}
if (compr->buf->error) {
+ snd_compr_stop_xrun(stream);
ret = -EIO;
goto out;
}
@@ -2930,8 +2931,11 @@ int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
*/
if (buf->avail < wm_adsp_compr_frag_words(compr)) {
ret = wm_adsp_buffer_get_error(buf);
- if (ret < 0)
+ if (ret < 0) {
+ if (compr->buf->error)
+ snd_compr_stop_xrun(stream);
goto out;
+ }
ret = wm_adsp_buffer_reenable_irq(buf);
if (ret < 0) {
@@ -3029,8 +3033,10 @@ static int wm_adsp_compr_read(struct wm_adsp_compr *compr,
if (!compr->buf)
return -ENXIO;
- if (compr->buf->error)
+ if (compr->buf->error) {
+ snd_compr_stop_xrun(compr->stream);
return -EIO;
+ }
count /= WM_ADSP_DATA_WORD_SIZE;
--
2.1.4
More information about the Alsa-devel
mailing list