aboutsummaryrefslogtreecommitdiff
path: root/audio/audio_legacy.c
diff options
context:
space:
mode:
authorVolker Rümelin <vr_qemu@t-online.de>2019-04-01 20:59:20 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-04-02 07:50:49 +0200
commitbe1092afa07794e5247eb504095fb5f2ae421ec6 (patch)
treea4fb40da0802ff9dc2f14cad533c0298ade7f3a5 /audio/audio_legacy.c
parentb396733df3554688c58678f454c34d5c07dd5ca2 (diff)
audio: fix audio timer rate conversion bug
Currently the default audio timer frequency is 10000Hz instead of a period of 10000us. Also the audiodev timer-period property gets converted like a frequency. Only handling of the legacy QEMU_AUDIO_TIMER_PERIOD environment variable is correct because it's actually a frequency. With this patch the property timer-period is really a timer period and QEMU_AUDIO_TIMER_PERIOD remains a frequency. Fixes: 71830221fb "-audiodev command line option basic implementation." Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Zoltán Kővágó <DirtY.iCE.hu@gmail.com> Message-id: 90b95e4f-39ef-2b01-da6a-857ebaee1ec5@t-online.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/audio_legacy.c')
-rw-r--r--audio/audio_legacy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c
index 6d140119d9..2fd58cb8ef 100644
--- a/audio/audio_legacy.c
+++ b/audio/audio_legacy.c
@@ -26,6 +26,7 @@
#include "audio_int.h"
#include "qemu-common.h"
#include "qemu/cutils.h"
+#include "qemu/timer.h"
#include "qapi/error.h"
#include "qapi/qapi-visit-audio.h"
#include "qapi/visitor-impl.h"
@@ -338,8 +339,13 @@ static AudiodevListEntry *legacy_opt(const char *drvname)
handle_per_direction(audio_get_pdo_in(e->dev), "QEMU_AUDIO_ADC_");
handle_per_direction(audio_get_pdo_out(e->dev), "QEMU_AUDIO_DAC_");
+ /* Original description: Timer period in HZ (0 - use lowest possible) */
get_int("QEMU_AUDIO_TIMER_PERIOD",
&e->dev->timer_period, &e->dev->has_timer_period);
+ if (e->dev->has_timer_period && e->dev->timer_period) {
+ e->dev->timer_period = NANOSECONDS_PER_SECOND / 1000 /
+ e->dev->timer_period;
+ }
switch (e->dev->driver) {
case AUDIODEV_DRIVER_ALSA: