Adjust buffer size to around 48K, rename and reuse old buffer size macro accordingly.

This commit is contained in:
Michael Jumper 2013-08-10 12:30:46 -07:00
parent 3bb4c8fec5
commit dfe454f484
2 changed files with 7 additions and 6 deletions

View File

@ -128,8 +128,8 @@ static void __context_get_sink_info_callback(pa_context* context,
spec.rate = GUAC_VNC_AUDIO_RATE; spec.rate = GUAC_VNC_AUDIO_RATE;
spec.channels = GUAC_VNC_AUDIO_CHANNELS; spec.channels = GUAC_VNC_AUDIO_CHANNELS;
attr.maxlength = GUAC_VNC_AUDIO_BUFFER_SIZE; attr.maxlength = -1;
attr.fragsize = attr.maxlength; attr.fragsize = GUAC_VNC_AUDIO_FRAGMENT_SIZE;
/* Create stream */ /* Create stream */
stream = pa_stream_new(context, "Guacamole Audio", &spec, NULL); stream = pa_stream_new(context, "Guacamole Audio", &spec, NULL);

View File

@ -39,15 +39,16 @@
#define __GUAC_VNC_PULSE_H #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 * 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. * Rate of audio to stream, in Hz.