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/
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to