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: 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:41:10 +0200	[thread overview]
Message-ID: <4E55EE86.6090400@canonical.com> (raw)
In-Reply-To: <CAN8ccibi-g_bXU3+FvmWF=FGx+w7hSzTfTAk7WmHgkgqhJ=zmA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3076 bytes --]

On 08/25/2011 08:25 AM, Raymond Yau wrote:
> 2011/8/25 David Henningsson<david.henningsson@canonical.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.
>
>
> /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

Hmm, does the attached patch solve the problem?


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

[-- Attachment #2: pa_check_version.patch --]
[-- Type: text/x-patch, Size: 663 bytes --]

diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index b0e52ab..c53d3c7 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -587,11 +587,16 @@ 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)
+#if defined(PA_CHECK_VERSION)
+#if PA_CHECK_VERSION(0,99,0)
+
 #define DEFAULT_HANDLE_UNDERRUN		1
 #define do_underrun_detect(pcm, p) \
 	((pcm)->written <= pa_stream_get_underflow_index(p))
-#else
+
+#endif
+#endif
+#ifndef DEFAULT_HANDLE_UNDERRUN
 #define DEFAULT_HANDLE_UNDERRUN		0
 #define do_underrun_detect(pcm, p)	1	/* always true */
 #endif

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2011-08-25  6:41 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
2011-08-25  6:25               ` Raymond Yau
2011-08-25  6:41                 ` David Henningsson [this message]
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=4E55EE86.6090400@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=superquad.vortex2@gmail.com \
    /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.