[alsa-devel] [PATCH] alsa-plugins: Pulse: only underrun if no more data has been written

Raymond Yau superquad.vortex2 at gmail.com
Thu Aug 25 08:25:56 CEST 2011


2011/8/25 David Henningsson <david.henningsson at canonical.com>:
> On 08/25/2011 07:53 AM, Raymond Yau wrote:
>>
>> 2011/8/23 Takashi Iwai<tiwai at 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.


/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I..    -Wall -g -I/usr/include/alsa    -D_REENTRANT   -D_GNU_SOURCE
-O2 -Wall -W -pipe -g -MT pcm_pulse.lo -MD -MP -MF .deps/pcm_pulse.Tpo
-c -o pcm_pulse.lo pcm_pulse.c
 gcc -DHAVE_CONFIG_H -I. -I.. -Wall -g -I/usr/include/alsa
-D_REENTRANT -D_GNU_SOURCE -O2 -Wall -W -pipe -g -MT pcm_pulse.lo -MD
-MP -MF .deps/pcm_pulse.Tpo -c pcm_pulse.c  -fPIC -DPIC -o
.libs/pcm_pulse.o
pcm_pulse.c: In function ‘stream_success_cb’:
pcm_pulse.c:192: warning: unused parameter ‘p’
pcm_pulse.c:192: warning: unused parameter ‘success’
pcm_pulse.c: In function ‘stream_request_cb’:
pcm_pulse.c:578: warning: unused parameter ‘p’
pcm_pulse.c:578: warning: unused parameter ‘length’
pcm_pulse.c:590:50: error: missing binary operator before token "("
pcm_pulse.c: In function ‘stream_underrun_cb’:
pcm_pulse.c:599: warning: unused parameter ‘p’
pcm_pulse.c: In function ‘stream_latency_cb’:
pcm_pulse.c:612: warning: unused parameter ‘p’
pcm_pulse.c: In function ‘pulse_pcm_poll_revents’:
pcm_pulse.c:624: warning: unused parameter ‘pfd’
pcm_pulse.c:624: warning: unused parameter ‘nfds’
pcm_pulse.c: In function ‘pulse_hw_params’:
pcm_pulse.c:768: warning: unused parameter ‘params’
make: *** [pcm_pulse.lo] Error 1


More information about the Alsa-devel mailing list