[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 00/23] next round of audio patches

From: Volker Rümelin
Subject: [PATCH 00/23] next round of audio patches
Date: Sun, 10 Jan 2021 11:01:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

A mix of bug fixes and improvements.

Patches 01/23 - 11/23 have a few SDL fixes and add audio recording
functions to the SDL audio backend.

Patch 12/23 removes unnecessary code from audio/audio.c.

Patches 13/23 - 16/23 fix a few PulseAudio backend bugs.

Patch 17/23 shows a PulseAudio backend bug. So far I don't think I
broke any fine tuned user settings and I don't want to do it here.

Patches 18/23 - 19/23 are the first steps towards glitch free and
lower latency PulseAudio playback and recording. Currently qemu
uses incredibly large buffers in the PulseAudio backend. For
playback this just increases the playback latency but doesn't
improve dropout safety, because PulseAudio can't access this buffer
directly. With these patches it's possible to move the large qemu
buffer to the PulseAudio server side and just keep a small buffer
on the qemu side. On the PulseAudio server side PulseAudio tries
to place a part of these buffers directly on the hardware and
PulseAudio runs with a higher priority than qemu, so it has a
better chance to deliver audio data in time.

Here is an example to show how this works:
-device intel-hda -device hda-duplex,audiodev=audio0
-machine pcspk-audiodev=audio0 -audiodev pa,id=audio0,

Due to a bug in the PulseAudio backend, these command line options
actually decrease the playback latency compared to current defaults.
For playback with defaults (16 bits, stereo, 44100 samples/s)
we have a 15ms server side buffer + 2 * 46.44ms qemu audio buffer
+ 23.22ms hda codec buffer = 131.1ms latency. With my example it's
46.44ms + 2 * 14ms + 23.22ms = 97.66ms latency and I guess you
won't hear any drop outs. Btw.: 14ms = 10ms timer-period + 4ms
additional playback data the hda codec can produce in timer-period

Patches 20/23 - 23/23 fix small issues with DirectSound.

Volker Rümelin (23):
  sdlaudio: remove leftover SDL1.2 code
  audio: fix bit-rotted code
  sdlaudio: add -audiodev sdl,out.buffer-count option
  sdlaudio: don't start playback in init routine
  sdlaudio: always clear the sample buffer
  sdlaudio: fill remaining sample buffer with silence
  sdlaudio: replace legacy functions with modern ones
  audio: split pcm_ops function get_buffer_in
  sdlaudio: add recording functions
  audio: break generic buffer dependency on mixing-engine
  sdlaudio: enable (in|out).mixing-engine=off
  audio: remove remaining unused plive code
  paaudio: avoid to clip samples multiple times
  paaudio: wait for PA_STREAM_READY in qpa_write()
  paaudio: wait until the playback stream is ready
  paaudio: remove unneeded code
  paaudio: comment bugs in functions qpa_init_*
  paaudio: limit minreq to 75% of audio timer_rate
  paaudio: send recorded data in smaller chunks
  dsoundaudio: replace GetForegroundWindow()
  dsoundaudio: rename dsound_open()
  dsoundaudio: enable f32 audio sample format
  dsoundaudio: fix log message

 audio/alsaaudio.c       |   3 +-
 audio/audio.c           |  48 +++----
 audio/audio_int.h       |   2 +
 audio/audio_legacy.c    |   3 +-
 audio/audio_template.h  |   2 +-
 audio/audio_win_int.c   |  73 ++++++----
 audio/dsound_template.h |   2 +-
 audio/dsoundaudio.c     |   6 +-
 audio/jackaudio.c       |   1 +
 audio/noaudio.c         |   1 +
 audio/ossaudio.c        |   1 +
 audio/paaudio.c         |  71 ++++++++--
 audio/sdlaudio.c        | 305 ++++++++++++++++++++++++++++------------
 audio/spiceaudio.c      |   1 +
 qapi/audio.json         |  33 ++++-
 qemu-options.hx         |   8 +-
 16 files changed, 399 insertions(+), 161 deletions(-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]