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 15:27:01 +0100 [thread overview]
Message-ID: <s5hu15t4eve.wl@alsa2.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.53.0310281428510.21064@pnote.perex-int.cz>
At Tue, 28 Oct 2003 14:30:33 +0100 (CET),
Jaroslav wrote:
>
> Yes, several assumptions were made and the SPACE ioctls were a bit broken.
> I've put a fix to our CVS (also included to this e-mail). Hopefully, it
> won't break another OSS applications.
>
> Jaroslav
>
> Index: pcm_oss.c
> ===================================================================
> RCS file: /cvsroot/alsa/alsa-kernel/core/oss/pcm_oss.c,v
> retrieving revision 1.53
> diff -u -r1.53 pcm_oss.c
> --- pcm_oss.c 30 Sep 2003 09:28:26 -0000 1.53
> +++ pcm_oss.c 28 Oct 2003 13:26:12 -0000
> @@ -125,8 +125,8 @@
> if (runtime->period_size == runtime->oss.period_bytes)
> return frames;
> if (runtime->period_size < runtime->oss.period_bytes)
> - return frames * (runtime->oss.period_bytes / runtime->period_size);
> - return frames / (runtime->period_size / runtime->oss.period_bytes);
> + return (frames * runtime->period_size) / runtime->oss.period_bytes;
> + return (frames * runtime->oss.period_bytes) / runtime->period_size;
> }
oh yeah, this is...
> static int snd_pcm_oss_format_from(int format)
> @@ -451,7 +451,7 @@
> sw_params->tstamp_mode = SNDRV_PCM_TSTAMP_NONE;
> sw_params->period_step = 1;
> sw_params->sleep_min = 0;
> - sw_params->avail_min = runtime->period_size;
> + sw_params->avail_min = 1;
> sw_params->xfer_align = 1;
> if (atomic_read(&runtime->mmap_count) ||
> (substream->oss.setup && substream->oss.setup->nosilence)) {
> @@ -470,7 +470,6 @@
> snd_printd("SW_PARAMS failed: %i\n", err);
> goto failure;
> }
> - runtime->control->avail_min = runtime->period_size;
>
> runtime->oss.periods = params_periods(sparams);
> oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams));
> @@ -883,7 +882,7 @@
> if (tmp <= 0)
> return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
> runtime->oss.bytes += tmp;
> - runtime->oss.buffer_used = runtime->oss.period_bytes;
> + runtime->oss.buffer_used = tmp;
> }
> tmp = bytes;
> if ((size_t) tmp > runtime->oss.buffer_used)
> @@ -1425,6 +1424,7 @@
i think the read size should be changed, too.
tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
also, the line below
if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_bytes - runtime->oss.buffer_used), tmp))
the offset calculation is broken if you use buffer_used = tmp.
we'll need another field like my patch to calculate the current
offset.
Takashi
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
prev parent reply other threads:[~2003-10-28 14:27 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
2003-10-28 13:30 ` Jaroslav Kysela
2003-10-28 14:27 ` Takashi Iwai [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=s5hu15t4eve.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