]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
audio: move period tick initialization
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 13 Oct 2025 19:44:47 +0000 (23:44 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 30 Oct 2025 09:30:06 +0000 (13:30 +0400)
Part of QOM-ification.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
audio/audio.c

index 087e1946e76ea904ab9792c39225aeb9668d8ff8..43db7380f06160f4b2165e523185c57aa3956892 100644 (file)
@@ -1582,6 +1582,13 @@ static bool audio_driver_init(AudioState *s, struct audio_driver *drv,
     audio_init_nb_voices_out(s, drv, 1);
     audio_init_nb_voices_in(s, drv, 0);
     s->drv = drv;
+
+    if (dev->timer_period <= 0) {
+        s->period_ticks = 1;
+    } else {
+        s->period_ticks = dev->timer_period * (int64_t)SCALE_US;
+    }
+
     return true;
 }
 
@@ -1768,12 +1775,6 @@ static AudioState *audio_init(Audiodev *dev, Error **errp)
         }
     }
 
-    if (dev->timer_period <= 0) {
-        s->period_ticks = 1;
-    } else {
-        s->period_ticks = dev->timer_period * (int64_t)SCALE_US;
-    }
-
     vmse = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);
     if (!vmse) {
         dolog ("warning: Could not register change state handler\n"