]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsabat: fix alsabat -86 error
authorKeqiao, Zhang <keqiao.zhang@intel.com>
Fri, 26 Aug 2016 15:37:54 +0000 (23:37 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 30 Aug 2016 05:49:37 +0000 (07:49 +0200)
alsabat reports -86 error when system suspend and resume. Check the
return value of read_to_pcm() and write_to_pcm(), when -x8 err is
detected, do resume and wait for read/write to pcm to complete.

Write PCM device error: Streams pipe error(-86)
Read PCM device error: Streams pipe error(-86)
*** Error in alsabat: double free or corruption (out): 0x00007fb438001810 ***

Signed-off-by: Keqiao, Zhang <keqiao.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
bat/alsa.c

index cef17341c52f07825cc82680d4c2b47fb34ad123..7613f44ba7a29caf294ba9d9400964009cae325a 100644 (file)
@@ -319,6 +319,11 @@ static int write_to_pcm(const struct pcm_container *sndpcm,
                        if (bat->roundtriplatency)
                                bat->latency.xrun_error = true;
                        snd_pcm_prepare(sndpcm->handle);
+               } else if (err == -ESTRPIPE) {
+                       while ((err = snd_pcm_resume(sndpcm->handle)) == -EAGAIN)
+                               sleep(1);  /* wait until resume flag is released */
+                       if (err < 0)
+                               snd_pcm_prepare(sndpcm->handle);
                } else if (err < 0) {
                        fprintf(bat->err, _("Write PCM device error: %s(%d)\n"),
                                        snd_strerror(err), err);
@@ -518,6 +523,11 @@ static int read_from_pcm(struct pcm_container *sndpcm,
                                        snd_strerror(err), err);
                        if (bat->roundtriplatency)
                                bat->latency.xrun_error = true;
+               } else if (err == -ESTRPIPE) {
+                       while ((err = snd_pcm_resume(sndpcm->handle)) == -EAGAIN)
+                               sleep(1);  /* wait until resume flag is released */
+                       if (err < 0)
+                               snd_pcm_prepare(sndpcm->handle);
                } else if (err < 0) {
                        fprintf(bat->err, _("Read PCM device error: %s(%d)\n"),
                                        snd_strerror(err), err);