At Thu, 25 Aug 2011 08:17:17 +0200, David Henningsson wrote:
On 08/25/2011 07:53 AM, Raymond Yau wrote:
2011/8/23 Takashi Iwaitiwai@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.
It actually is. gcc gives an error when it's not available. The preprocessor is not C, so it's a slightly different rule.
I committed the build fix patch below.
thanks,
Takashi
--- From: Takashi Iwai tiwai@suse.de Subject: [PATCH] pulse - Define a dummy PA_CHECK_VERSION() when not available
An old version of PA doesn't define this macro, and gives a build error.
Signed-off-by: Takashi Iwai tiwai@suse.de --- pulse/pcm_pulse.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c index b0e52ab..e0fbd4c 100644 --- a/pulse/pcm_pulse.c +++ b/pulse/pcm_pulse.c @@ -587,7 +587,11 @@ 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) +#ifndef PA_CHECK_VERSION +#define PA_CHECK_VERSION(x, y, z) 0 +#endif + +#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))