From: Gustavo da Silva Serra <gustavo.serra@tet.com.br>
To: alsa-devel@alsa-project.org
Subject: Re: Still have choppy audio using 1.0.17
Date: Wed, 16 Jul 2008 12:43:18 -0300 [thread overview]
Message-ID: <487E1716.2080808@tet.com.br> (raw)
In-Reply-To: <s5hzlohzw13.wl%tiwai@suse.de>
Takashi Iwai escreveu:
> 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@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.
>
>
> Takashi
Thanks so much!
About the first statment I only have a question: if both capture and
playback pointers are moving to the right, shouldn't the silence too be
to the right of the playback pointer? I don't know how it works, but it
seems to me that the silence is set to the left of playback and to the
right of capture, thus, capture would read silence sometime. Something like:
Audio buffer:
+-----------------------------------------------------------+
| | | | | | |
+-----------------------------------------------------------+
^ ^ ^
capture silence playback
( I hope that font configurations mess the drawing, I used monospaced
fonts). So this is what I think that happens, but that doesn't make
sense to me.
Thanks again, Takashi.
prev parent reply other threads:[~2008-07-16 15:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-16 20:04 Still have choppy audio using 1.0.17 Gustavo da Silva Serra
2008-06-18 18:24 ` Gustavo da Silva Serra
2008-06-18 19:44 ` Gustavo da Silva Serra
2008-06-19 13:01 ` Gustavo da Silva Serra
2008-06-20 19:07 ` Gustavo da Silva Serra
2008-06-25 11:24 ` Gustavo da Silva Serra
2008-06-25 16:06 ` Takashi Iwai
2008-06-25 18:34 ` Gustavo da Silva Serra
2008-07-01 18:28 ` Gustavo da Silva Serra
2008-07-04 12:40 ` Gustavo da Silva Serra
2008-07-14 17:57 ` Gustavo da Silva Serra
2008-07-15 0:50 ` stan
2008-07-15 11:56 ` Gustavo da Silva Serra
2008-07-15 18:40 ` Gustavo da Silva Serra
2008-07-15 21:31 ` stan
2008-07-16 14:19 ` Gustavo da Silva Serra
2008-07-16 15:30 ` Takashi Iwai
2008-07-16 15:43 ` Gustavo da Silva Serra [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=487E1716.2080808@tet.com.br \
--to=gustavo.serra@tet.com.br \
--cc=alsa-devel@alsa-project.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.