[alsa-devel] Still have choppy audio using 1.0.17
tiwai at suse.de
Wed Jul 16 17:30:32 CEST 2008
At Wed, 16 Jul 2008 11:19:02 -0300,
Gustavo da Silva Serra wrote:
> stan escreveu:
> > Gustavo da Silva Serra wrote:
> >>> _______________________________________________
> >> It silences a whole period because the pointer inside aloop behaves like
> >> that. Logging the pointer inside aloop I discovered that it is
> >> incremented so fast inside timer function that when pointer function is
> >> called, the pointer is not being incremented anymore. It is like a
> >> concurrency issue: first the pointer will be incremented many times,
> >> after that, the pointer function will be called many times with the same
> >> pointer value. Later, the pointer will be incremented some more, and so
> >> on...
> >> I wonder if this is not the problem, logging the pointer for my sound
> >> card I see a different behavior: the pointer function return offset
> >> between two periods.
> >> _______________________________________________
> > Sounds like this is a critical section that has no
> > protection. So the sequence is messed up. In the
> > regular sound card, there must be a semaphore or block
> > to prevent this kind of behavior. You could probably
> > add the logic from the regular card to the aloop
> > function and fix it.
> > _______________________________________________
> > Alsa-devel mailing list
> > Alsa-devel at alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> I will add that to the list of things I am trying, thanks : )
> I wish I could understand the silencer function seems to fills the
> buffer with zeroes to the left of the playback offset. Why it doesn't
> care where is the capture pointer. Very strange.
Because the PCM core doesn't assume that any access is there after the
playback. It's the area that should be cleared.
That said: aloop is buggy and racy. It has to serialize the playback
and capture streams in the right order, and make sure that the data is
surely copied before silencing.
More information about the Alsa-devel