mirror of https://github.com/xemu-project/xemu.git
pulseaudio: setup buffer attrs
Request reasonable buffer sizes from pulseaudio. Without this pa_simple_write() can block quite long and lead to dropouts, especially with guests which use small audio ring buffers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
This commit is contained in:
parent
6315633b25
commit
e6d16fa439
|
@ -289,6 +289,7 @@ static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
static pa_sample_spec ss;
|
static pa_sample_spec ss;
|
||||||
|
static pa_buffer_attr ba;
|
||||||
struct audsettings obt_as = *as;
|
struct audsettings obt_as = *as;
|
||||||
PAVoiceOut *pa = (PAVoiceOut *) hw;
|
PAVoiceOut *pa = (PAVoiceOut *) hw;
|
||||||
|
|
||||||
|
@ -296,6 +297,15 @@ static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as)
|
||||||
ss.channels = as->nchannels;
|
ss.channels = as->nchannels;
|
||||||
ss.rate = as->freq;
|
ss.rate = as->freq;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* qemu audio tick runs at 250 Hz (by default), so processing
|
||||||
|
* data chunks worth 4 ms of sound should be a good fit.
|
||||||
|
*/
|
||||||
|
ba.tlength = pa_usec_to_bytes (4 * 1000, &ss);
|
||||||
|
ba.minreq = pa_usec_to_bytes (2 * 1000, &ss);
|
||||||
|
ba.maxlength = -1;
|
||||||
|
ba.prebuf = -1;
|
||||||
|
|
||||||
obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness);
|
obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness);
|
||||||
|
|
||||||
pa->s = pa_simple_new (
|
pa->s = pa_simple_new (
|
||||||
|
@ -306,7 +316,7 @@ static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as)
|
||||||
"pcm.playback",
|
"pcm.playback",
|
||||||
&ss,
|
&ss,
|
||||||
NULL, /* channel map */
|
NULL, /* channel map */
|
||||||
NULL, /* buffering attributes */
|
&ba, /* buffering attributes */
|
||||||
&error
|
&error
|
||||||
);
|
);
|
||||||
if (!pa->s) {
|
if (!pa->s) {
|
||||||
|
|
Loading…
Reference in New Issue