Re: [linux-audio-dev] fragmentcount ioctl with - 1?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] fragmentcount ioctl with - 1?
From: Benno Senoner (sbenno_AT_gardena.net)
Date: Fri Sep 08 2000 - 15:10:47 EEST


yes,
I discovered this problem sometime ago,
and noticed that the ALSA OSS emulation behaves correctly,
(eg. requesting 3 fragments in OSS/Free gives you 2 real fragments,
while ALSA OSS emulation gives you the correct number (3)).

One possiblity would be to check the num of real fragments
after the ioctl, and then in the the case that it varies,
try again with fragmentnum+1.

But I am thinkning about all the legacy apps out here:
not all are sensitive to the number of fragments, but in
some case where you must rely on the effective latency
(because you mix or sync with/to external sources),
then it would be nice if ALSA and OSS/Free behaved correctly.

So the possiblities are: fix OSS so that it uses the requested
num of fragments, or modify the ALSA OSS emulation so that
it behaves just like OSS (allocating num_requested_fragments -1 )
but then, I believe that commercial OSS ( 4front-tech),
behaves like ALSA too.

what would in your opinion be the best way to achieve that
OSS/Free, OSS and ALSA OSS-emulation behave identically ?

better to fix the semantics (and potentially break some legacy apps
(which are sensitive to latency changes), or modify the API specs
so that the offical behaviour is
num of real fragments = num of requested fragments -1

cheers,
Benno.

On Thu, 07 Sep 2000, Stefan Westerfeld wrote:
> Hi!
>
> I just found out that if I try to initialize the fragment count/size, then my
> code is currently always wrong by 1. It seems that when using
>
> ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, 0xMMMMSSSS);
>
> then 2^SSSS is the usual fragment value, whereas MMMM is the number of
> fragments MINUS 1. Can anybody confirm this MINUS 1 (didn't find it in
> the docs), or is MMMM really supposed to be the number of fragments, and
> its just that the driver is wrong here?
>
> To illustrate: ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, 0x0002000a) gives
> me 3 (!) fragments with 1024 (2^10) bytes. Using 0x0001000a gives me
> 2 fragments.
>
> Cu... Stefan
> --
> -* Stefan Westerfeld, stefan_AT_space.twc.de (PGP!), Hamburg/Germany
> KDE Developer, project infos at http://space.twc.de/~stefan/kde *-


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Sep 08 2000 - 14:10:55 EEST