All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Carl Hetherington <lists@carlh.net>
Cc: alsa-devel@alsa-project.org
Subject: Re: Query about xrun on usb/pcm
Date: Mon, 05 Dec 2022 13:33:56 +0100	[thread overview]
Message-ID: <87lenmm3m3.wl-tiwai@suse.de> (raw)
In-Reply-To: <656d9d2-a0ec-7a3-394c-7a84b17afa11@carlh.net>

On Mon, 05 Dec 2022 12:59:54 +0100,
Carl Hetherington wrote:
> 
> Hi Takashi,
> 
> > > Can you see any problems with that?  In the application code I do need
> > > to re-try the snd_pcm_prepare() if one fails with -EPIPE, but with this
> > > undo step the second snd_pcm_prepare() is able to recover the endpoint
> > > states, instead of hitting this problem where it tries to start things
> > > that are STOPPING, but also won't set things to STOPPED because
> > > stop_operating is false.
> >
> > Setting the stop_operating unconditionally there doesn't look right,
> > as there may be other error types not only the pending XRUN.
> >
> > The problem is rather specific to USB audio driver that tries to start
> > the stream at PCM prepare, so it's better to handle in USB audio
> > driver itself.  That is, when -EPIPE is returned from
> > start_endpoints() at prepare, the driver does some action.
> >
> > I can see two options:
> > - Issue snd_pcm_stop_xrun() when start_endpoints() returns -EPIPE
> > - Repeat the prepare after the sync at snd_usb_pcm_prepare()
> >
> > The former would require a bit of change in snd_pcm_stop_xrun(), and
> > it relies on the application retrying the prepare.  The latter would
> > be more self-contained.  I attached two patches (totally untested) for
> > both scenarios.
> >
> > My gut feeling is for the latter solution, but this needs
> > verification.
> 
> The latter solution seems to fix our problem perfectly!  Thank you so
> much!
> 
> Is there anything I can/should do to help get the change merged?

I'm going to submit fix patches and put you to Cc.  I believe that the
former patches are also valid, although it doesn't influence in your
case, so they'll be included.

The fixes will be likely included in 6.2-rc1.


thanks,

Takashi

  reply	other threads:[~2022-12-05 12:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 21:14 Query about xrun on usb/pcm Carl Hetherington
2022-11-22  7:25 ` Takashi Iwai
2022-11-22 11:16   ` Carl Hetherington
2022-11-22 14:19     ` Takashi Iwai
2022-11-22 14:22       ` Takashi Iwai
2022-11-28 22:51       ` Carl Hetherington
2022-11-29  7:45         ` Takashi Iwai
2022-11-30 22:37           ` Carl Hetherington
2022-12-01  7:47             ` Takashi Iwai
2022-12-05 11:59               ` Carl Hetherington
2022-12-05 12:33                 ` Takashi Iwai [this message]
2022-12-05 18:53                   ` Carl Hetherington
2022-12-06  7:51                     ` Takashi Iwai

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=87lenmm3m3.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=lists@carlh.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.