Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jaroslav Kysela <perex@suse.cz>
Cc: andi@rhlx01.fht-esslingen.de, alsa-devel@lists.sourceforge.net
Subject: Re: OSS SNDCTL_DSP_GETISPACE, non-blocking read: messy :-\
Date: Tue, 28 Oct 2003 14:24:50 +0100	[thread overview]
Message-ID: <s5hznfl4hr1.wl@alsa2.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.53.0310281335370.21064@pnote.perex-int.cz>

At Tue, 28 Oct 2003 13:36:37 +0100 (CET),
Jaroslav wrote:
> 
> On Tue, 28 Oct 2003, Takashi Iwai wrote:
> 
> > At Mon, 27 Oct 2003 13:11:58 +0100,
> > Andreas Mohr wrote:
> > >
> > > Hello Takashi,
> > >
> > > On Mon, Oct 27, 2003 at 01:01:37PM +0100, Takashi Iwai wrote:
> > > > At Sat, 25 Oct 2003 22:02:21 +0200,
> > > > Andreas Mohr wrote:
> > > > > Or, as a short summary:
> > > > > The application is perfectly well aware of how many bytes there are left
> > > > > to read (from calling SNDCTL_DSP_GETISPACE) and then does a read() with
> > > > > this amount of bytes, however since the ALSA OSS layer attempts to read
> > > > > this byte amount in blocks of runtime->oss.period_bytes bytes from the sound
> > > > > device, we ARTIFICIALLY cause a -EAGAIN to be returned due to insufficient
> > > > > available data, thus potentially confusing many OSS applications.
> > > > >
> > > > > Now what to do here?
> > > >
> > > > this problem is a bit touch, because the ALSA OSS layer does the
> > > > sample-rate conversion, etc.
> > > > when the sample rate is converted between 44.1kHz and 48kHz, some
> > > > round error may happen and it will be accumulated.   hence, the size
> > > > will be different between two cases: reading a whole period once and
> > > > reading a period by multiple calls.
> > > >
> > > > i'll take a more deeper look...
> > > Ah, thanks! (also for the explanation given above)
> > >
> > > Given that 1.0 is approaching, it'd certainly be useful to get such a
> > > problem fixed ;-)
> >
> > i come to believe that it's a bug, too.
> > as you wrote, the fix is easy except for the rare problem what i
> > mentioned above.  in that case (e.g. the sample-rate conversion
> > between 44.1 and 48khz required), you'll still get -EAGAIN
> > occasionally.  but normally, it seems ok.
> >
> > the attached is the patch to fix the original problem.
> > to take back to the old behavior (always reading a whole period),
> > you can write "whole-frag" command to the proc file.
> >
> > anyway, i'll try a bit more to solve the problem above.
> 
> I think that the problem is at another place. I'm investigating the bug in
> code now.

thanks.

just to avoid confusion: there are two "bugs" here discussed.

1. the original problem, read() returns -EAGAIN when trying to read
   the bytes returned by GETISPACE ioctl.  this is because
   snd_pcm_oss_read2() always reads a whole period.
   my last patch is for this problem.

2. read() return -EAGAIN occasionally.  likely  because of the rate
   plugin.


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/

  reply	other threads:[~2003-10-28 13:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-25 20:02 OSS SNDCTL_DSP_GETISPACE, non-blocking read: messy :-\ Andreas Mohr
2003-10-27 12:01 ` Takashi Iwai
2003-10-27 12:11   ` Andreas Mohr
2003-10-28 11:21     ` Takashi Iwai
2003-10-28 12:36       ` Jaroslav Kysela
2003-10-28 13:24         ` Takashi Iwai [this message]
2003-10-28 13:30         ` Jaroslav Kysela
2003-10-28 14:27           ` 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=s5hznfl4hr1.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=andi@rhlx01.fht-esslingen.de \
    --cc=perex@suse.cz \
    /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