Browse Source

audio: replace vm_running with runstate_is_running()

AudioBackend had a vm_running field which was set in
audio_vm_change_state_handler().

The state change handler "bool running" argument is true when
vm_prepare_start() calls it, and the VM runstate is either SUSPENDED or
RUNNING.

Audio hw voices shouldn't be running when the VM is suspended, but only
when running. Thus replacing the vm_running field with a call to
runstate_is_running() is both simpler and more correct.

Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
master
Marc-André Lureau 2 months ago
parent
commit
67af2055d8
  1. 5
      audio/audio.c
  2. 1
      audio/audio_int.h

5
audio/audio.c

@ -933,7 +933,7 @@ void AUD_set_active_out(SWVoiceOut *sw, bool on)
hw->pending_disable = 0;
if (!hw->enabled) {
hw->enabled = true;
if (s->vm_running) {
if (runstate_is_running()) {
if (hw->pcm_ops->enable_out) {
hw->pcm_ops->enable_out(hw, true);
}
@ -979,7 +979,7 @@ void AUD_set_active_in(SWVoiceIn *sw, bool on)
if (on) {
if (!hw->enabled) {
hw->enabled = true;
if (s->vm_running) {
if (runstate_is_running()) {
if (hw->pcm_ops->enable_in) {
hw->pcm_ops->enable_in(hw, true);
}
@ -1598,7 +1598,6 @@ static void audio_vm_change_state_handler (void *opaque, bool running,
HWVoiceOut *hwo = NULL;
HWVoiceIn *hwi = NULL;
s->vm_running = running;
while ((hwo = audio_pcm_hw_find_any_enabled_out(s, hwo))) {
if (hwo->pcm_ops->enable_out) {
hwo->pcm_ops->enable_out(hwo, running);

1
audio/audio_int.h

@ -252,7 +252,6 @@ typedef struct AudioBackend {
QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
int nb_hw_voices_out;
int nb_hw_voices_in;
int vm_running;
int64_t period_ticks;
bool timer_running;

Loading…
Cancel
Save