From dfe454f484680924afe18c5f26533fec941237f9 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 10 Aug 2013 12:30:46 -0700 Subject: [PATCH] Adjust buffer size to around 48K, rename and reuse old buffer size macro accordingly. --- src/protocols/vnc/pulse.c | 4 ++-- src/protocols/vnc/pulse.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/protocols/vnc/pulse.c b/src/protocols/vnc/pulse.c index da357ed7..3480a8e8 100644 --- a/src/protocols/vnc/pulse.c +++ b/src/protocols/vnc/pulse.c @@ -128,8 +128,8 @@ static void __context_get_sink_info_callback(pa_context* context, spec.rate = GUAC_VNC_AUDIO_RATE; spec.channels = GUAC_VNC_AUDIO_CHANNELS; - attr.maxlength = GUAC_VNC_AUDIO_BUFFER_SIZE; - attr.fragsize = attr.maxlength; + attr.maxlength = -1; + attr.fragsize = GUAC_VNC_AUDIO_FRAGMENT_SIZE; /* Create stream */ stream = pa_stream_new(context, "Guacamole Audio", &spec, NULL); diff --git a/src/protocols/vnc/pulse.h b/src/protocols/vnc/pulse.h index 5074bc45..000b778e 100644 --- a/src/protocols/vnc/pulse.h +++ b/src/protocols/vnc/pulse.h @@ -39,15 +39,16 @@ #define __GUAC_VNC_PULSE_H /** - * The number of bytes to request for the PulseAudio buffers. + * The number of bytes to request for the audio fragments received from + * PulseAudio. */ -#define GUAC_VNC_AUDIO_BUFFER_SIZE 10240 +#define GUAC_VNC_AUDIO_FRAGMENT_SIZE 8192 /** * The minimum number of PCM bytes to wait for before flushing an audio - * packet. The current value is 24K, which works out to be around 140ms. + * packet. The current value is 48K, which works out to be around 280ms. */ -#define GUAC_VNC_PCM_WRITE_RATE 24576 +#define GUAC_VNC_PCM_WRITE_RATE 49152 /** * Rate of audio to stream, in Hz.