* [Qemu-devel] [PATCH] spice: add audio
@ 2010-11-09 16:29 Gerd Hoffmann
2010-11-09 16:36 ` [Qemu-devel] " malc
2010-11-09 20:55 ` malc
0 siblings, 2 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-11-09 16:29 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Add support for the spice audio interface. With this patch applied
audio can be forwarded over the network from/to the spice client. Both
recording and playback is supported.
The driver is first in the driver list, but the can_be_default flag is
set only in case spice is active. So if you have the spice protocol
enabled the spice audio driver is the default one, otherwise whatever
comes first after spice in the list. Overriding the default using
QEMU_AUDIO_DRV works in any case.
[ v2: audio codestyle: add spaces before open parenthesis ]
[ v2: add const to silence array ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: malc <av1474@comtv.ru>
---
Makefile.objs | 1 +
audio/audio.c | 3 +
audio/audio_int.h | 1 +
audio/spiceaudio.c | 327 ++++++++++++++++++++++++++++++++++++++++++++++++++++
ui/qemu-spice.h | 1 +
ui/spice-core.c | 1 +
6 files changed, 334 insertions(+), 0 deletions(-)
create mode 100644 audio/spiceaudio.c
diff --git a/Makefile.objs b/Makefile.objs
index faf485e..15569af 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -102,6 +102,7 @@ common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o ui/spice-display.
audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
audio-obj-$(CONFIG_SDL) += sdlaudio.o
audio-obj-$(CONFIG_OSS) += ossaudio.o
+audio-obj-$(CONFIG_SPICE) += spiceaudio.o
audio-obj-$(CONFIG_COREAUDIO) += coreaudio.o
audio-obj-$(CONFIG_ALSA) += alsaaudio.o
audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o
diff --git a/audio/audio.c b/audio/audio.c
index ad51077..ade342e 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -44,6 +44,9 @@
that we generate the list.
*/
static struct audio_driver *drvtab[] = {
+#ifdef CONFIG_SPICE
+ &spice_audio_driver,
+#endif
CONFIG_AUDIO_DRIVERS
&no_audio_driver,
&wav_audio_driver
diff --git a/audio/audio_int.h b/audio/audio_int.h
index d8560b6..d66f2c3 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -209,6 +209,7 @@ extern struct audio_driver coreaudio_audio_driver;
extern struct audio_driver dsound_audio_driver;
extern struct audio_driver esd_audio_driver;
extern struct audio_driver pa_audio_driver;
+extern struct audio_driver spice_audio_driver;
extern struct audio_driver winwave_audio_driver;
extern struct mixeng_volume nominal_volume;
diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c
new file mode 100644
index 0000000..51ba53a
--- /dev/null
+++ b/audio/spiceaudio.c
@@ -0,0 +1,327 @@
+#include "hw/hw.h"
+#include "qemu-timer.h"
+#include "ui/qemu-spice.h"
+
+#define AUDIO_CAP "spice"
+#include "audio.h"
+#include "audio_int.h"
+
+#define LINE_IN_SAMPLES 1024
+#define LINE_OUT_SAMPLES 1024
+
+typedef struct SpiceRateCtl {
+ int64_t start_ticks;
+ int64_t bytes_sent;
+} SpiceRateCtl;
+
+typedef struct SpiceVoiceOut {
+ HWVoiceOut hw;
+ SpicePlaybackInstance sin;
+ SpiceRateCtl rate;
+ int active;
+ uint32_t *frame;
+ uint32_t *fpos;
+ uint32_t fsize;
+} SpiceVoiceOut;
+
+typedef struct SpiceVoiceIn {
+ HWVoiceIn hw;
+ SpiceRecordInstance sin;
+ SpiceRateCtl rate;
+ int active;
+ uint32_t samples[LINE_IN_SAMPLES];
+} SpiceVoiceIn;
+
+static const SpicePlaybackInterface playback_sif = {
+ .base.type = SPICE_INTERFACE_PLAYBACK,
+ .base.description = "playback",
+ .base.major_version = SPICE_INTERFACE_PLAYBACK_MAJOR,
+ .base.minor_version = SPICE_INTERFACE_PLAYBACK_MINOR,
+};
+
+static const SpiceRecordInterface record_sif = {
+ .base.type = SPICE_INTERFACE_RECORD,
+ .base.description = "record",
+ .base.major_version = SPICE_INTERFACE_RECORD_MAJOR,
+ .base.minor_version = SPICE_INTERFACE_RECORD_MINOR,
+};
+
+static void *spice_audio_init (void)
+{
+ if (!using_spice) {
+ return NULL;
+ }
+ return &spice_audio_init;
+}
+
+static void spice_audio_fini (void *opaque)
+{
+ /* nothing */
+}
+
+static void rate_start (SpiceRateCtl *rate)
+{
+ memset (rate, 0, sizeof (*rate));
+ rate->start_ticks = qemu_get_clock (vm_clock);
+}
+
+static int rate_get_samples (struct audio_pcm_info *info, SpiceRateCtl *rate)
+{
+ int64_t now;
+ int64_t ticks;
+ int64_t bytes;
+ int64_t samples;
+
+ now = qemu_get_clock (vm_clock);
+ ticks = now - rate->start_ticks;
+ bytes = muldiv64 (ticks, info->bytes_per_second, get_ticks_per_sec ());
+ samples = (bytes - rate->bytes_sent) >> info->shift;
+ if (samples < 0 || samples > 65536) {
+ fprintf (stderr, "Resetting rate control (%" PRId64 " samples)\n", samples);
+ rate_start (rate);
+ samples = 0;
+ }
+ rate->bytes_sent += samples << info->shift;
+ return samples;
+}
+
+/* playback */
+
+static int line_out_init (HWVoiceOut *hw, struct audsettings *as)
+{
+ SpiceVoiceOut *out = container_of (hw, SpiceVoiceOut, hw);
+ struct audsettings settings;
+
+ settings.freq = SPICE_INTERFACE_PLAYBACK_FREQ;
+ settings.nchannels = SPICE_INTERFACE_PLAYBACK_CHAN;
+ settings.fmt = AUD_FMT_S16;
+ settings.endianness = AUDIO_HOST_ENDIANNESS;
+
+ audio_pcm_init_info (&hw->info, &settings);
+ hw->samples = LINE_OUT_SAMPLES;
+ out->active = 0;
+
+ out->sin.base.sif = &playback_sif.base;
+ qemu_spice_add_interface (&out->sin.base);
+ return 0;
+}
+
+static void line_out_fini (HWVoiceOut *hw)
+{
+ SpiceVoiceOut *out = container_of (hw, SpiceVoiceOut, hw);
+
+ spice_server_remove_interface (&out->sin.base);
+}
+
+static int line_out_run (HWVoiceOut *hw, int live)
+{
+ SpiceVoiceOut *out = container_of (hw, SpiceVoiceOut, hw);
+ int rpos, decr;
+ int samples;
+
+ if (!live) {
+ return 0;
+ }
+
+ decr = rate_get_samples (&hw->info, &out->rate);
+ decr = audio_MIN (live, decr);
+
+ samples = decr;
+ rpos = hw->rpos;
+ while (samples) {
+ int left_till_end_samples = hw->samples - rpos;
+ int len = audio_MIN (samples, left_till_end_samples);
+
+ if (!out->frame) {
+ spice_server_playback_get_buffer (&out->sin, &out->frame, &out->fsize);
+ out->fpos = out->frame;
+ }
+ if (out->frame) {
+ len = audio_MIN (len, out->fsize);
+ hw->clip (out->fpos, hw->mix_buf + rpos, len);
+ out->fsize -= len;
+ out->fpos += len;
+ if (out->fsize == 0) {
+ spice_server_playback_put_samples (&out->sin, out->frame);
+ out->frame = out->fpos = NULL;
+ }
+ }
+ rpos = (rpos + len) % hw->samples;
+ samples -= len;
+ }
+ hw->rpos = rpos;
+ return decr;
+}
+
+static int line_out_write (SWVoiceOut *sw, void *buf, int len)
+{
+ return audio_pcm_sw_write (sw, buf, len);
+}
+
+static int line_out_ctl (HWVoiceOut *hw, int cmd, ...)
+{
+ SpiceVoiceOut *out = container_of (hw, SpiceVoiceOut, hw);
+
+ switch (cmd) {
+ case VOICE_ENABLE:
+ if (out->active) {
+ break;
+ }
+ out->active = 1;
+ rate_start (&out->rate);
+ spice_server_playback_start (&out->sin);
+ break;
+ case VOICE_DISABLE:
+ if (!out->active) {
+ break;
+ }
+ out->active = 0;
+ if (out->frame) {
+ memset (out->fpos, 0, out->fsize << 2);
+ spice_server_playback_put_samples (&out->sin, out->frame);
+ out->frame = out->fpos = NULL;
+ }
+ spice_server_playback_stop (&out->sin);
+ break;
+ }
+ return 0;
+}
+
+/* record */
+
+static int line_in_init (HWVoiceIn *hw, struct audsettings *as)
+{
+ SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
+ struct audsettings settings;
+
+ settings.freq = SPICE_INTERFACE_RECORD_FREQ;
+ settings.nchannels = SPICE_INTERFACE_RECORD_CHAN;
+ settings.fmt = AUD_FMT_S16;
+ settings.endianness = AUDIO_HOST_ENDIANNESS;
+
+ audio_pcm_init_info (&hw->info, &settings);
+ hw->samples = LINE_IN_SAMPLES;
+ in->active = 0;
+
+ in->sin.base.sif = &record_sif.base;
+ qemu_spice_add_interface (&in->sin.base);
+ return 0;
+}
+
+static void line_in_fini (HWVoiceIn *hw)
+{
+ SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
+
+ spice_server_remove_interface (&in->sin.base);
+}
+
+static int line_in_run (HWVoiceIn *hw)
+{
+ SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
+ int num_samples;
+ int ready;
+ int len[2];
+ uint64_t delta_samp;
+ const uint32_t *samples;
+
+ if (!(num_samples = hw->samples - audio_pcm_hw_get_live_in (hw))) {
+ return 0;
+ }
+
+ delta_samp = rate_get_samples (&hw->info, &in->rate);
+ num_samples = audio_MIN (num_samples, delta_samp);
+
+ ready = spice_server_record_get_samples (&in->sin, in->samples, num_samples);
+ samples = in->samples;
+ if (ready == 0) {
+ static const uint32_t silence[LINE_IN_SAMPLES];
+ samples = silence;
+ ready = LINE_IN_SAMPLES;
+ }
+
+ num_samples = audio_MIN (ready, num_samples);
+
+ if (hw->wpos + num_samples > hw->samples) {
+ len[0] = hw->samples - hw->wpos;
+ len[1] = num_samples - len[0];
+ } else {
+ len[0] = num_samples;
+ len[1] = 0;
+ }
+
+ hw->conv (hw->conv_buf + hw->wpos, samples, len[0], &nominal_volume);
+
+ if (len[1]) {
+ hw->conv (hw->conv_buf, samples + len[0], len[1],
+ &nominal_volume);
+ }
+
+ hw->wpos = (hw->wpos + num_samples) % hw->samples;
+
+ return num_samples;
+}
+
+static int line_in_read (SWVoiceIn *sw, void *buf, int size)
+{
+ return audio_pcm_sw_read (sw, buf, size);
+}
+
+static int line_in_ctl (HWVoiceIn *hw, int cmd, ...)
+{
+ SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
+
+ switch (cmd) {
+ case VOICE_ENABLE:
+ if (in->active) {
+ break;
+ }
+ in->active = 1;
+ rate_start (&in->rate);
+ spice_server_record_start (&in->sin);
+ break;
+ case VOICE_DISABLE:
+ if (!in->active) {
+ break;
+ }
+ in->active = 0;
+ spice_server_record_stop (&in->sin);
+ break;
+ }
+ return 0;
+}
+
+static struct audio_option audio_options[] = {
+ { /* end of list */ },
+};
+
+static struct audio_pcm_ops audio_callbacks = {
+ .init_out = line_out_init,
+ .fini_out = line_out_fini,
+ .run_out = line_out_run,
+ .write = line_out_write,
+ .ctl_out = line_out_ctl,
+
+ .init_in = line_in_init,
+ .fini_in = line_in_fini,
+ .run_in = line_in_run,
+ .read = line_in_read,
+ .ctl_in = line_in_ctl,
+};
+
+struct audio_driver spice_audio_driver = {
+ .name = "spice",
+ .descr = "spice audio driver",
+ .options = audio_options,
+ .init = spice_audio_init,
+ .fini = spice_audio_fini,
+ .pcm_ops = &audio_callbacks,
+ .max_voices_out = 1,
+ .max_voices_in = 1,
+ .voice_size_out = sizeof (SpiceVoiceOut),
+ .voice_size_in = sizeof (SpiceVoiceIn),
+};
+
+void qemu_spice_audio_init (void)
+{
+ spice_audio_driver.can_be_default = 1;
+}
diff --git a/ui/qemu-spice.h b/ui/qemu-spice.h
index 063c7dc..0e3ad9b 100644
--- a/ui/qemu-spice.h
+++ b/ui/qemu-spice.h
@@ -29,6 +29,7 @@ extern int using_spice;
void qemu_spice_init(void);
void qemu_spice_input_init(void);
+void qemu_spice_audio_init(void);
void qemu_spice_display_init(DisplayState *ds);
int qemu_spice_add_interface(SpiceBaseInstance *sin);
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 82fbaec..b7fa031 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -361,6 +361,7 @@ void qemu_spice_init(void)
using_spice = 1;
qemu_spice_input_init();
+ qemu_spice_audio_init();
qemu_free(x509_key_file);
qemu_free(x509_cert_file);
--
1.7.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-09 16:29 [Qemu-devel] [PATCH] spice: add audio Gerd Hoffmann
@ 2010-11-09 16:36 ` malc
2010-11-09 16:56 ` Gerd Hoffmann
2010-11-09 20:55 ` malc
1 sibling, 1 reply; 12+ messages in thread
From: malc @ 2010-11-09 16:36 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Tue, 9 Nov 2010, Gerd Hoffmann wrote:
> Add support for the spice audio interface. With this patch applied
> audio can be forwarded over the network from/to the spice client. Both
> recording and playback is supported.
>
> The driver is first in the driver list, but the can_be_default flag is
> set only in case spice is active. So if you have the spice protocol
> enabled the spice audio driver is the default one, otherwise whatever
> comes first after spice in the list. Overriding the default using
> QEMU_AUDIO_DRV works in any case.
>
> [ v2: audio codestyle: add spaces before open parenthesis ]
> [ v2: add const to silence array ]
Is this somehow testable?
[..snip..]
--
mailto:av1474@comtv.ru
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-09 16:36 ` [Qemu-devel] " malc
@ 2010-11-09 16:56 ` Gerd Hoffmann
2010-11-09 17:35 ` malc
0 siblings, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2010-11-09 16:56 UTC (permalink / raw)
To: malc; +Cc: qemu-devel
On 11/09/10 17:36, malc wrote:
> On Tue, 9 Nov 2010, Gerd Hoffmann wrote:
>
>> Add support for the spice audio interface. With this patch applied
>> audio can be forwarded over the network from/to the spice client. Both
>> recording and playback is supported.
>>
>> The driver is first in the driver list, but the can_be_default flag is
>> set only in case spice is active. So if you have the spice protocol
>> enabled the spice audio driver is the default one, otherwise whatever
>> comes first after spice in the list. Overriding the default using
>> QEMU_AUDIO_DRV works in any case.
>>
>> [ v2: audio codestyle: add spaces before open parenthesis ]
>> [ v2: add const to silence array ]
>
> Is this somehow testable?
/me guesses there are no pre-built spice packages for your linux system,
so you have to build spice yourself. In short:
* Fetch, build + install celt, version 0.5.1 is needed.
* Fetch, build + install spice-protocol
* Fetch, build + install spice
You can download the bits from:
http://www.celt-codec.org/
http://www.spice-space.org/
With this in place you should be able to build qemu with spice support
(configure should detect it).
The add '-spice port=$number,disable-ticketing' to your qemu command
line. Start spice client (part of the spice package) this way:
spicec -h localhost -p $number
Note that spice doesn't work (yet) on bigendian machines, so don't try
that on your ppc box.
cheers,
Gerd
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-09 16:56 ` Gerd Hoffmann
@ 2010-11-09 17:35 ` malc
0 siblings, 0 replies; 12+ messages in thread
From: malc @ 2010-11-09 17:35 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Tue, 9 Nov 2010, Gerd Hoffmann wrote:
> On 11/09/10 17:36, malc wrote:
> > On Tue, 9 Nov 2010, Gerd Hoffmann wrote:
> >
> > > Add support for the spice audio interface. With this patch applied
> > > audio can be forwarded over the network from/to the spice client. Both
> > > recording and playback is supported.
> > >
> > > The driver is first in the driver list, but the can_be_default flag is
> > > set only in case spice is active. So if you have the spice protocol
> > > enabled the spice audio driver is the default one, otherwise whatever
> > > comes first after spice in the list. Overriding the default using
> > > QEMU_AUDIO_DRV works in any case.
> > >
> > > [ v2: audio codestyle: add spaces before open parenthesis ]
> > > [ v2: add const to silence array ]
> >
> > Is this somehow testable?
>
> /me guesses there are no pre-built spice packages for your linux system, so
> you have to build spice yourself. In short:
>
> * Fetch, build + install celt, version 0.5.1 is needed.
> * Fetch, build + install spice-protocol
> * Fetch, build + install spice
>
> You can download the bits from:
>
> http://www.celt-codec.org/
> http://www.spice-space.org/
>
> With this in place you should be able to build qemu with spice support
> (configure should detect it).
>
> The add '-spice port=$number,disable-ticketing' to your qemu command line.
> Start spice client (part of the spice package) this way:
>
> spicec -h localhost -p $number
>
> Note that spice doesn't work (yet) on bigendian machines, so don't try that on
> your ppc box.
>
Thanks.
--
mailto:av1474@comtv.ru
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-09 16:29 [Qemu-devel] [PATCH] spice: add audio Gerd Hoffmann
2010-11-09 16:36 ` [Qemu-devel] " malc
@ 2010-11-09 20:55 ` malc
1 sibling, 0 replies; 12+ messages in thread
From: malc @ 2010-11-09 20:55 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Tue, 9 Nov 2010, Gerd Hoffmann wrote:
> Add support for the spice audio interface. With this patch applied
> audio can be forwarded over the network from/to the spice client. Both
> recording and playback is supported.
>
> The driver is first in the driver list, but the can_be_default flag is
> set only in case spice is active. So if you have the spice protocol
> enabled the spice audio driver is the default one, otherwise whatever
> comes first after spice in the list. Overriding the default using
> QEMU_AUDIO_DRV works in any case.
>
Applied.
[..snip..]
--
mailto:av1474@comtv.ru
^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20101109211021.45EC22A34D@zimbra14-e2.priv.proxad.net>]
* Re: [Qemu-devel] Re: [PATCH] spice: add audio
[not found] <20101109211021.45EC22A34D@zimbra14-e2.priv.proxad.net>
@ 2010-11-09 22:27 ` François Revol
2010-11-09 23:31 ` malc
2010-11-10 9:48 ` Gerd Hoffmann
0 siblings, 2 replies; 12+ messages in thread
From: François Revol @ 2010-11-09 22:27 UTC (permalink / raw)
To: qemu-devel
>
>> Add support for the spice audio interface. With this patch applied
>> audio can be forwarded over the network from/to the spice client. Both
>> recording and playback is supported.
>>
>> The driver is first in the driver list, but the can_be_default flag is
>> set only in case spice is active. So if you have the spice protocol
>> enabled the spice audio driver is the default one, otherwise whatever
>> comes first after spice in the list. Overriding the default using
>> QEMU_AUDIO_DRV works in any case.
>>
>
> Applied.
Seems there is more interest than twolame :^)
Now, if only VNC had standardized audio passthrough yet...
I guess I'd have to propose...
François.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-09 22:27 ` François Revol
@ 2010-11-09 23:31 ` malc
2010-11-10 9:48 ` Gerd Hoffmann
1 sibling, 0 replies; 12+ messages in thread
From: malc @ 2010-11-09 23:31 UTC (permalink / raw)
To: François Revol; +Cc: qemu-devel
On Tue, 9 Nov 2010, Fran?ois Revol wrote:
> >
> >> Add support for the spice audio interface. With this patch applied
> >> audio can be forwarded over the network from/to the spice client. Both
> >> recording and playback is supported.
> >>
> >> The driver is first in the driver list, but the can_be_default flag is
> >> set only in case spice is active. So if you have the spice protocol
> >> enabled the spice audio driver is the default one, otherwise whatever
> >> comes first after spice in the list. Overriding the default using
> >> QEMU_AUDIO_DRV works in any case.
> >>
> >
> > Applied.
>
> Seems there is more interest than twolame :^)
The main point is that this thing is unimplementable via wav driver or
audio capture support (none of those deals with recording).
>
> Now, if only VNC had standardized audio passthrough yet...
> I guess I'd have to propose...
>
> Fran?ois.
--
mailto:av1474@comtv.ru
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-09 22:27 ` François Revol
2010-11-09 23:31 ` malc
@ 2010-11-10 9:48 ` Gerd Hoffmann
2010-11-10 10:36 ` Daniel P. Berrange
1 sibling, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2010-11-10 9:48 UTC (permalink / raw)
To: François Revol; +Cc: qemu-devel
Hi,
> Now, if only VNC had standardized audio passthrough yet...
> I guess I'd have to propose...
The qemu vnc server has support already, and I think Daniel (added to
Cc:) has some experimental patches for the gtk-vnc widget.
cheers,
Gerd
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-10 9:48 ` Gerd Hoffmann
@ 2010-11-10 10:36 ` Daniel P. Berrange
2010-11-10 11:37 ` Gerd Hoffmann
0 siblings, 1 reply; 12+ messages in thread
From: Daniel P. Berrange @ 2010-11-10 10:36 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: François Revol, qemu-devel
On Wed, Nov 10, 2010 at 10:48:39AM +0100, Gerd Hoffmann wrote:
> Hi,
>
> >Now, if only VNC had standardized audio passthrough yet...
> >I guess I'd have to propose...
>
> The qemu vnc server has support already, and I think Daniel (added to
> Cc:) has some experimental patches for the gtk-vnc widget.
Yes I do have patches, but I'm yet to get it to work reliably enough for
anyone to use for real. eg any time there are large frambuffer updates
due to, say, dragging a window around, audio will drop out. Until I can
prove that it is even semi-reliable I'm not going to include the code in
gtk-vnc, because I don't want to commit to supporting something that may
well be fundamentally broken/unusable for live audio playback.
Regards,
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-10 10:36 ` Daniel P. Berrange
@ 2010-11-10 11:37 ` Gerd Hoffmann
2010-11-10 11:50 ` Daniel P. Berrange
0 siblings, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2010-11-10 11:37 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: François Revol, qemu-devel
On 11/10/10 11:36, Daniel P. Berrange wrote:
> On Wed, Nov 10, 2010 at 10:48:39AM +0100, Gerd Hoffmann wrote:
>> The qemu vnc server has support already, and I think Daniel (added to
>> Cc:) has some experimental patches for the gtk-vnc widget.
>
> Yes I do have patches, but I'm yet to get it to work reliably enough for
> anyone to use for real. eg any time there are large frambuffer updates
> due to, say, dragging a window around, audio will drop out. Until I can
> prove that it is even semi-reliable I'm not going to include the code in
> gtk-vnc, because I don't want to commit to supporting something that may
> well be fundamentally broken/unusable for live audio playback.
Do you know where the dropouts come from?
I think one issue are latencies within qemu. The qemu vnc server is
busy for a while when doing bulky screen updates and blocks other stuff
while it runs. I've seen dropouts with vnc + bulky screen updates too.
The smaller the audio buffers used by the device/guest are the more
visible this effect is. When enabling the threaded vnc server this
becomes alot better, did you try that?
Another problem might be the outgoing tcp pipeline being flooded with
screen updates, leading to high network latencies for the audio data as
vnc (unlike spice) sends everything over the same tcp connection.
Finally it could be gtk-vnc itself being busy with something and not
playing audio in a timely manner (not very likely IMHO).
cheers,
Gerd
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-10 11:37 ` Gerd Hoffmann
@ 2010-11-10 11:50 ` Daniel P. Berrange
2010-11-10 13:21 ` Gerd Hoffmann
0 siblings, 1 reply; 12+ messages in thread
From: Daniel P. Berrange @ 2010-11-10 11:50 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: François Revol, qemu-devel
On Wed, Nov 10, 2010 at 12:37:04PM +0100, Gerd Hoffmann wrote:
> On 11/10/10 11:36, Daniel P. Berrange wrote:
> >On Wed, Nov 10, 2010 at 10:48:39AM +0100, Gerd Hoffmann wrote:
> >>The qemu vnc server has support already, and I think Daniel (added to
> >>Cc:) has some experimental patches for the gtk-vnc widget.
> >
> >Yes I do have patches, but I'm yet to get it to work reliably enough for
> >anyone to use for real. eg any time there are large frambuffer updates
> >due to, say, dragging a window around, audio will drop out. Until I can
> >prove that it is even semi-reliable I'm not going to include the code in
> >gtk-vnc, because I don't want to commit to supporting something that may
> >well be fundamentally broken/unusable for live audio playback.
>
> Do you know where the dropouts come from?
Not entirely, it is still rather work in progress to debug it.
Part of the issues is that even QEMU + one of the standard
pulseaudio/alsa/sdl audio backends doesn't seem very reliable
to me, so I've not got a reliable benchmark to compare VNC
audio against. Just testing with mpg123 in the guest, audio
will often simply stop after a few seconds of playback to the
host.
> I think one issue are latencies within qemu. The qemu vnc server is
> busy for a while when doing bulky screen updates and blocks other stuff
> while it runs. I've seen dropouts with vnc + bulky screen updates too.
> The smaller the audio buffers used by the device/guest are the more
> visible this effect is. When enabling the threaded vnc server this
> becomes alot better, did you try that?
It looks like the threaded server is disabled by default, so I've
not been using it thus far. I'll give it a try though.
Is there a particular audio device that is considered to work 'best' ?
I've been using ac97 mostly, but if your new ICH6 device is thought
to be significantly better I'll try that instead.
Regards,
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] spice: add audio
2010-11-10 11:50 ` Daniel P. Berrange
@ 2010-11-10 13:21 ` Gerd Hoffmann
0 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-11-10 13:21 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: François Revol, qemu-devel
On 11/10/10 12:50, Daniel P. Berrange wrote:
> On Wed, Nov 10, 2010 at 12:37:04PM +0100, Gerd Hoffmann wrote:
>> Do you know where the dropouts come from?
>
> Not entirely, it is still rather work in progress to debug it.
> Part of the issues is that even QEMU + one of the standard
> pulseaudio/alsa/sdl audio backends doesn't seem very reliable
> to me, so I've not got a reliable benchmark to compare VNC
> audio against.
Well, on a standard fedora install alsa ends up being routed to
pulseaudio anyway. Not sure what happens with SDL, I suspect it goes
via alsa to pulseaudio too.
So I've bothered with pulseaudio (and spice) only in my testing.
Came up with these patches for pulseaudio:
http://cgit.freedesktop.org/spice/qemu/log/?h=pulse
These patches make pulseaudio work alot better for me.
They are waiting to be reviewed by Fengguang right now.
> Just testing with mpg123 in the guest, audio
> will often simply stop after a few seconds of playback to the
> host.
Fedora 14 + rhythmbox works rock solid for me.
Win7 + media player works too but has dropouts now and then, I think
this is because win7 uses a very small dma buffer for the audio data. I
don't see the sound stopping altogether.
> Is there a particular audio device that is considered to work 'best' ?
> I've been using ac97 mostly, but if your new ICH6 device is thought
> to be significantly better I'll try that instead.
Naturally I'm testing with the new intel-hda device ;)
It has some advantages, for example it just got MSI support so it
doesn't has to share the IRQ line with other devices (when the guest
supports it). I think there is nothing which makes a major difference
compared to ac97. I don't know ac97 that well though.
cheers,
Gerd
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-11-10 13:21 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09 16:29 [Qemu-devel] [PATCH] spice: add audio Gerd Hoffmann
2010-11-09 16:36 ` [Qemu-devel] " malc
2010-11-09 16:56 ` Gerd Hoffmann
2010-11-09 17:35 ` malc
2010-11-09 20:55 ` malc
[not found] <20101109211021.45EC22A34D@zimbra14-e2.priv.proxad.net>
2010-11-09 22:27 ` François Revol
2010-11-09 23:31 ` malc
2010-11-10 9:48 ` Gerd Hoffmann
2010-11-10 10:36 ` Daniel P. Berrange
2010-11-10 11:37 ` Gerd Hoffmann
2010-11-10 11:50 ` Daniel P. Berrange
2010-11-10 13:21 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).