On Thu, 1 Nov 2001, Abramo Bagnara wrote:

> Jaroslav Kysela wrote:
> >
> > On Wed, 31 Oct 2001, Paul Davis wrote:
> >
> > > >there is something wrong with either the pcm.c example or with the
> > > >documentation in alsa-lib/src/pcm/pcm.c.
> > > >
> > > >the documentation says about snd_pcm_mmap_commit:
> > > >
> > > > 'To call this with offset/frames values different from that returned by
> > > >  snd_pcm_mmap_begin has undefined effects and it has to be avoided.'
> > >
> > > IMHO. the documentation is wrong. it should say that you cannot call
> > > it with a value greater than the one returned by snd_pcm_mmap_begin().
> > >
> > > all the commit does it to move forward the driver's notion of the "s/w
> > > pointer", used for tracking xruns etc. its fine to move it less than
> > > it could possibly be moved, but not OK to move it more.
> >
> > The documentation is correct, but the check in the pcm.c example is really
> > not necessary, because mmap_begin guarantees that the returned count of
> > frames is less or equal to the requested count. I corrected the
> > documentation. Using the same value as for mmap_begin is not necessary in
> > the current implementation, but we can rely on the same value in the
> > future, so please, follow the documentation to create "bug-free"
> > and clean applications.
>
> I have to partially disagree, nothing inhibits to do:
>
> frames = buffer_size;
> snd_pcm_mmap_begin(pcm, areas, &offset, &frames);
>
> and then reduce the number of frames to call snd_pcm_mmap_commit with.
>
> Perhaps it's useless, but this is how I designed this API.

Yes, while we have the mmap_begin function limiting the transfer count and
application knows how many samples should be filled, the reducing the
counf of channel is really not necessary. I think that it would be better
to avoid to do this by programmers, because we can use the mmap_commit
size count for some internal purposes (a temporary buffer for frames
freeing etc..) in future. It's not really any pain from the developer
view, but if you don't agree with my, I'm ready to change your (or
me?) comment for the mmap_commit function.

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
SuSE Linux    http://www.suse.com
ALSA project  http://www.alsa-project.org



_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to