All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: Raymond Yau <superquad.vortex2@gmail.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>
Subject: Re: [PATCH] alsa-plugins: Pulse: only underrun if no more data has been written
Date: Thu, 25 Aug 2011 08:17:17 +0200	[thread overview]
Message-ID: <4E55E8ED.8010106@canonical.com> (raw)
In-Reply-To: <CAN8cciZ046qj=2aaa0ETgCXtrOhu5Z8+p_dFNPjJ199vXtA7RQ@mail.gmail.com>

On 08/25/2011 07:53 AM, Raymond Yau wrote:
> 2011/8/23 Takashi Iwai<tiwai@suse.de>:
>   be enough just to have a
>> boolean for underrun_detect yes/no.
>>
>> So, the patch would be like below.
>>
>> What do you think?
>>
>>
>> Takashi
>>
>> ---
>> diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
>> index d6c6792..b0e52ab 100644
>> --- a/pulse/pcm_pulse.c
>> +++ b/pulse/pcm_pulse.c
>> @@ -42,6 +42,7 @@ typedef struct snd_pcm_pulse {
>>         int handle_underrun;
>>
>>         size_t offset;
>> +       int64_t written;
>>
>>         pa_stream *stream;
>>
>> @@ -460,6 +461,7 @@ static snd_pcm_sframes_t pulse_write(snd_pcm_ioplug_t * io,
>>
>>         /* Make sure the buffer pointer is in sync */
>>         pcm->last_size -= writebytes;
>> +       pcm->written += writebytes;
>>         ret = update_ptr(pcm);
>>         if (ret<  0)
>>                 goto finish;
>> @@ -585,6 +587,15 @@ static void stream_request_cb(pa_stream * p, size_t length, void *userdata)
>>         update_active(pcm);
>>   }
>>
>> +#if defined(PA_CHECK_VERSION)&&  PA_CHECK_VERSION(0,99,0)
>
> compile fail at these line since PA_CHECK_VERSION is not defined in
> pulseaudio 0.9.14

I don't have PA 0.9.14 available, but that's why the line starts with 
"if defined(PA_CHECK_VERSION)" so that the second part should never be 
evaluated.

> seem that pcm->wriiten is application pointer of pulse device in bytes
>
> does it mean that pa_stream_get_underflow_index(0 is the hardware pointer ?
>
> does it mean that pulse device no longer can be run 7 x 24 non-stop
> since pcm->written may overflow ?

Hmm. It's an int64, so your computer is likely to break down before 
there is a wraparound, but perhaps there is a slight chance that the 
comparision will be wrong if there is an underrun at the exact 
wraparound moment.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

  reply	other threads:[~2011-08-25  6:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 15:06 [PATCH] alsa-plugins: Pulse: only underrun if no more data has been written David Henningsson
2011-08-19  7:43 ` Takashi Iwai
2011-08-19  9:49   ` David Henningsson
2011-08-19 12:46     ` Takashi Iwai
2011-08-23 11:56       ` David Henningsson
2011-08-23 13:40         ` Takashi Iwai
2011-08-23 13:57           ` David Henningsson
2011-08-23 15:07             ` Takashi Iwai
2011-08-25  5:53           ` Raymond Yau
2011-08-25  6:17             ` David Henningsson [this message]
2011-08-25  6:25               ` Raymond Yau
2011-08-25  6:41                 ` David Henningsson
2011-08-26  7:46               ` Takashi Iwai
2011-09-22  6:12                 ` Raymond Yau

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=4E55E8ED.8010106@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=superquad.vortex2@gmail.com \
    --cc=tiwai@suse.de \
    /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.