From: Timur Tabi <timur@freescale.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: How to report error in _pointer function?
Date: Fri, 08 Aug 2008 17:26:11 -0500 [thread overview]
Message-ID: <489CC803.9030408@freescale.com> (raw)
In-Reply-To: <s5h1w0z67eq.wl%tiwai@suse.de>
Takashi Iwai wrote:
> So, the PCM status is properly changed to XRUN as expected. From the
> driver perspective, everything must be fine.
I've been debugging aplay. The main loop is function pcm_write(). It calls
writei_func() which returns -EPIPE. This causes aplay to jump to xrun(), which
attempts to recover.
This is not what I want. I don't want to return overrun/underrun. I want to
return failure. Returning XRUN is wrong.
Instead, I need to take a look at this code I have:
snd_pcm_stream_lock_irqsave(substream, flags);
if (snd_pcm_running(substream))
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock_irqrestore(substream, flags);
It's the call to snd_pcm_stop() that I don't like. There doesn't appear to be a
SNDRV_PCM_STATE_xxx state that makes sense. This function should eventually
bring me to snd_pcm_pre_stop(). But this function returns -EBADFD because the
current state is RUNNING and not OPEN. Because it returns an error,
snd_pcm_do_stop() is never called.
This doesn't make any sense to me. Why should I be able to stop a stream only
if it's open but not running? If it's open, but not running, then there's
nothing to stop! Can you explain the restriction in snd_pcm_pre_stop()?
--
Timur Tabi
Linux kernel developer at Freescale
next prev parent reply other threads:[~2008-08-08 22:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-30 15:56 How to report error in _pointer function? Timur Tabi
2008-07-30 16:12 ` Takashi Iwai
2008-08-06 21:54 ` Timur Tabi
2008-08-07 16:29 ` Takashi Iwai
2008-08-07 18:59 ` Timur Tabi
2008-08-08 12:03 ` Takashi Iwai
2008-08-08 15:55 ` Timur Tabi
2008-08-08 22:26 ` Timur Tabi [this message]
2008-08-11 7:19 ` Takashi Iwai
2008-08-11 15:37 ` Timur Tabi
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=489CC803.9030408@freescale.com \
--to=timur@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/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.