qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: malc <av1474@comtv.ru>
To: Rob Landley <rob@landley.net>
Cc: qemu-devel@nongnu.org, "Bjørn Mork" <bjorn@mork.no>
Subject: Re: [Qemu-devel] [PATCH] alsa broken when the host is suspended (or hibernated)
Date: Thu, 30 Jul 2009 14:29:17 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.64.0907301428230.2165@linmac.oyster.ru> (raw)
In-Reply-To: <Pine.LNX.4.64.0907292253530.2259@linmac.oyster.ru>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3389 bytes --]

On Wed, 29 Jul 2009, malc wrote:

> On Wed, 29 Jul 2009, Rob Landley wrote:
> 
> > On Wednesday 29 July 2009 05:51:06 BjЪЪrn Mork wrote:
> > > audio output fails after resuming a host running a guest using alsa
> > > audio output. Messages such as
> > >
> > >  alsa: Failed to write 882 frames to 0x1804b98
> > >  alsa: Reason: Streams pipe error
> > >
> > > will appear repeatedly in the monitor.  This is caused by alsaaudio.c
> > > not handling ESTRPIPE.  Fix this by calling snd_pcm_resume() on
> > > ESTRPIPE.
> > >
> > > This bug is similar to the vlc bug discussed on
> > > https://trac.videolan.org/vlc/ticket/1286 and the fix is insired by
> > > the patch attached to that bug report
> > >
> > > Signed-off-by: BjЪЪrn Mork <bjorn@mork.no>
> > > ---
> > >  audio/alsaaudio.c |   22 ++++++++++++++++++++++
> > >  1 files changed, 22 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
> > > index d0b7cd0..1c007e5 100644
> > > --- a/audio/alsaaudio.c
> > > +++ b/audio/alsaaudio.c
> > > @@ -503,6 +503,16 @@ static int alsa_recover (snd_pcm_t *handle)
> > >      return 0;
> > >  }
> > >
> > > +static int alsa_resume (snd_pcm_t *handle)
> > > +{
> > > +    int err = snd_pcm_resume (handle);
> > > +    if (err < 0) {
> > > +        alsa_logerr (err, "Failed to resume handle %p\n", handle);
> > > +        return -1;
> > > +    }
> > > +    return 0;
> > > +}
> > > +
> > >  static snd_pcm_sframes_t alsa_get_avail (snd_pcm_t *handle)
> > >  {
> > >      snd_pcm_sframes_t avail;
> > > @@ -580,6 +590,18 @@ static int alsa_run_out (HWVoiceOut *hw)
> > >                      }
> > >                      continue;
> > >
> > > +		case -ESTRPIPE:
> > > +		    /* stream is suspended and waiting for an application recovery */
> > > +		    if (alsa_resume (alsa->handle)) {
> > > +                        alsa_logerr (written, "Failed to write %d
> > > frames\n", +                                     len);
> > > +                        goto exit;
> > > +                    }
> > > +                    if (conf.verbose) {
> > > +                        dolog ("Resuming suspended stream\n");
> > > +                    }
> > > +                    continue;
> > > +
> > >                  case -EAGAIN:
> > >                      goto exit;
> > 
> > Is there a reason the whole patch couldn't just be something like:
> > 
> > +    case -ESTRPIPE:
> > +        /* manually recover after suspend/resume */
> > +        if (snd_pcm_resume(handle) < 0) {
> > +            alsa_logerr(written, "Failed to resume handle %p", handle);
> > +            goto exit;
> > +        } else if (conf.verbose) dolog("Resuming suspended stream\n");
> > +        continue;
> > 
> > Why are you wrapping a single function call, and adding logging and error 
> > recovery both in that wrapper and in the only caller of that wrapper?
> 
> Because that's how it's done when handling xruns etc, i.e. consistent
> with the rest of the code around it. Verbose is what's there for
> users to set and to report the output when asked for it.
> 
> And snd_pcm_resume is not a wrapper it's an ALSA function.

Uh have to apologize the patch that you are replying to does indeed
intorduce a wrapper, but i haven't seen/received it up until now, so
sorry.

-- 
mailto:av1474@comtv.ru

      reply	other threads:[~2009-07-30 10:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 10:51 [Qemu-devel] [PATCH] alsa broken when the host is suspended (or hibernated) Bjørn Mork
2009-07-29 11:57 ` malc
2009-07-29 12:36   ` Bjørn Mork
2009-07-29 13:45     ` malc
2009-07-29 13:46     ` Bjørn Mork
2009-07-29 13:51       ` malc
2009-07-30  7:44         ` [Qemu-devel] [PATCH] alsa: add host suspend/resume support Bjørn Mork
2009-07-30 10:47           ` [Qemu-devel] " malc
2009-07-30  7:47         ` [Qemu-devel] [PATCH] alsa broken when the host is suspended (or hibernated) Bjørn Mork
2009-07-29 16:58 ` Rob Landley
2009-07-29 18:57   ` malc
2009-07-30 10:29     ` malc [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0907301428230.2165@linmac.oyster.ru \
    --to=av1474@comtv.ru \
    --cc=bjorn@mork.no \
    --cc=qemu-devel@nongnu.org \
    --cc=rob@landley.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).