Avoid running audio ctl's when vm is not running
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6627 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
c6ba7bbc48
commit
978dd63540
@ -1127,6 +1127,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on)
|
|||||||
|
|
||||||
hw = sw->hw;
|
hw = sw->hw;
|
||||||
if (sw->active != on) {
|
if (sw->active != on) {
|
||||||
|
AudioState *s = &glob_audio_state;
|
||||||
SWVoiceOut *temp_sw;
|
SWVoiceOut *temp_sw;
|
||||||
SWVoiceCap *sc;
|
SWVoiceCap *sc;
|
||||||
|
|
||||||
@ -1134,9 +1135,11 @@ void AUD_set_active_out (SWVoiceOut *sw, int on)
|
|||||||
hw->pending_disable = 0;
|
hw->pending_disable = 0;
|
||||||
if (!hw->enabled) {
|
if (!hw->enabled) {
|
||||||
hw->enabled = 1;
|
hw->enabled = 1;
|
||||||
|
if (s->vm_running) {
|
||||||
hw->pcm_ops->ctl_out (hw, VOICE_ENABLE);
|
hw->pcm_ops->ctl_out (hw, VOICE_ENABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (hw->enabled) {
|
if (hw->enabled) {
|
||||||
int nb_active = 0;
|
int nb_active = 0;
|
||||||
@ -1170,13 +1173,16 @@ void AUD_set_active_in (SWVoiceIn *sw, int on)
|
|||||||
|
|
||||||
hw = sw->hw;
|
hw = sw->hw;
|
||||||
if (sw->active != on) {
|
if (sw->active != on) {
|
||||||
|
AudioState *s = &glob_audio_state;
|
||||||
SWVoiceIn *temp_sw;
|
SWVoiceIn *temp_sw;
|
||||||
|
|
||||||
if (on) {
|
if (on) {
|
||||||
if (!hw->enabled) {
|
if (!hw->enabled) {
|
||||||
hw->enabled = 1;
|
hw->enabled = 1;
|
||||||
|
if (s->vm_running) {
|
||||||
hw->pcm_ops->ctl_in (hw, VOICE_ENABLE);
|
hw->pcm_ops->ctl_in (hw, VOICE_ENABLE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
sw->total_hw_samples_acquired = hw->total_samples_captured;
|
sw->total_hw_samples_acquired = hw->total_samples_captured;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1623,6 +1629,7 @@ static void audio_vm_change_state_handler (void *opaque, int running,
|
|||||||
HWVoiceIn *hwi = NULL;
|
HWVoiceIn *hwi = NULL;
|
||||||
int op = running ? VOICE_ENABLE : VOICE_DISABLE;
|
int op = running ? VOICE_ENABLE : VOICE_DISABLE;
|
||||||
|
|
||||||
|
s->vm_running = running;
|
||||||
while ((hwo = audio_pcm_hw_find_any_enabled_out (s, hwo))) {
|
while ((hwo = audio_pcm_hw_find_any_enabled_out (s, hwo))) {
|
||||||
hwo->pcm_ops->ctl_out (hwo, op);
|
hwo->pcm_ops->ctl_out (hwo, op);
|
||||||
}
|
}
|
||||||
|
@ -192,6 +192,7 @@ struct AudioState {
|
|||||||
LIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
|
LIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
|
||||||
int nb_hw_voices_out;
|
int nb_hw_voices_out;
|
||||||
int nb_hw_voices_in;
|
int nb_hw_voices_in;
|
||||||
|
int vm_running;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct audio_driver no_audio_driver;
|
extern struct audio_driver no_audio_driver;
|
||||||
|
Loading…
Reference in New Issue
Block a user