From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
Kővágó@redhat.com, "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Michael Walle" <michael@walle.cc>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
Zoltán <DirtY.iCE.hu@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL 10/15] audio: do not run each backend in audio_run
Date: Tue, 13 Aug 2019 13:18:04 +0200 [thread overview]
Message-ID: <20190813111809.3141-11-kraxel@redhat.com> (raw)
In-Reply-To: <20190813111809.3141-1-kraxel@redhat.com>
From: Kővágó, Zoltán <dirty.ice.hu@gmail.com>
audio_run is called manually by alsa and oss backends when polling.
In this case only the requesting backend should be run, not all of them.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 6bde77dcba080901bedf42beca3c9d71822fc261.1564925486.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
audio/audio_int.h | 2 +-
audio/alsaaudio.c | 7 +++++--
audio/audio.c | 14 +++++---------
audio/ossaudio.c | 12 ++++++------
4 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/audio/audio_int.h b/audio/audio_int.h
index 9f01f6ad002c..7e00c1332e16 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -221,7 +221,7 @@ int audio_pcm_hw_clip_out (HWVoiceOut *hw, void *pcm_buf,
int audio_bug (const char *funcname, int cond);
void *audio_calloc (const char *funcname, int nmemb, size_t size);
-void audio_run (const char *msg);
+void audio_run(AudioState *s, const char *msg);
#define VOICE_ENABLE 1
#define VOICE_DISABLE 2
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 6b9e0f06af47..3daa7c8f8f02 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -39,6 +39,7 @@ struct pollhlp {
struct pollfd *pfds;
int count;
int mask;
+ AudioState *s;
};
typedef struct ALSAVoiceOut {
@@ -199,11 +200,11 @@ static void alsa_poll_handler (void *opaque)
break;
case SND_PCM_STATE_PREPARED:
- audio_run ("alsa run (prepared)");
+ audio_run(hlp->s, "alsa run (prepared)");
break;
case SND_PCM_STATE_RUNNING:
- audio_run ("alsa run (running)");
+ audio_run(hlp->s, "alsa run (running)");
break;
default:
@@ -749,6 +750,7 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsettings *as,
return -1;
}
+ alsa->pollhlp.s = hw->s;
alsa->handle = handle;
alsa->dev = dev;
return 0;
@@ -850,6 +852,7 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
return -1;
}
+ alsa->pollhlp.s = hw->s;
alsa->handle = handle;
alsa->dev = dev;
return 0;
diff --git a/audio/audio.c b/audio/audio.c
index cb0222ab4a87..07b35ffa0351 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -835,7 +835,7 @@ static void audio_timer (void *opaque)
}
s->timer_last = now;
- audio_run("timer");
+ audio_run(s, "timer");
audio_reset_timer(s);
}
@@ -1237,15 +1237,11 @@ static void audio_run_capture (AudioState *s)
}
}
-void audio_run (const char *msg)
+void audio_run(AudioState *s, const char *msg)
{
- AudioState *s;
-
- QTAILQ_FOREACH(s, &audio_states, list) {
- audio_run_out(s);
- audio_run_in(s);
- audio_run_capture(s);
- }
+ audio_run_out(s);
+ audio_run_in(s);
+ audio_run_capture(s);
#ifdef DEBUG_POLL
{
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 29139ef1f5cd..456fba748064 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -110,28 +110,28 @@ static void oss_anal_close (int *fdp)
static void oss_helper_poll_out (void *opaque)
{
- (void) opaque;
- audio_run ("oss_poll_out");
+ AudioState *s = opaque;
+ audio_run(s, "oss_poll_out");
}
static void oss_helper_poll_in (void *opaque)
{
- (void) opaque;
- audio_run ("oss_poll_in");
+ AudioState *s = opaque;
+ audio_run(s, "oss_poll_in");
}
static void oss_poll_out (HWVoiceOut *hw)
{
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
- qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);
+ qemu_set_fd_handler(oss->fd, NULL, oss_helper_poll_out, hw->s);
}
static void oss_poll_in (HWVoiceIn *hw)
{
OSSVoiceIn *oss = (OSSVoiceIn *) hw;
- qemu_set_fd_handler (oss->fd, oss_helper_poll_in, NULL, NULL);
+ qemu_set_fd_handler(oss->fd, oss_helper_poll_in, NULL, hw->s);
}
static int oss_write (SWVoiceOut *sw, void *buf, int len)
--
2.18.1
next prev parent reply other threads:[~2019-08-13 11:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-13 11:17 [Qemu-devel] [PULL 00/15] Audio 20190813 patches Gerd Hoffmann
2019-08-13 11:17 ` [Qemu-devel] [PULL 01/15] audio: reduce glob_audio_state usage Gerd Hoffmann
2019-08-13 11:17 ` [Qemu-devel] [PULL 02/15] audio: basic support for multi backend audio Gerd Hoffmann
2019-08-13 11:17 ` [Qemu-devel] [PULL 03/15] audio: add audiodev property to vnc and wav_capture Gerd Hoffmann
2019-08-13 11:17 ` [Qemu-devel] [PULL 04/15] audio: add audiodev properties to frontends Gerd Hoffmann
2019-08-13 11:17 ` [Qemu-devel] [PULL 05/15] paaudio: prepare for multiple audiodev Gerd Hoffmann
2019-08-13 11:18 ` [Qemu-devel] [PULL 06/15] audio: audiodev= parameters no longer optional when -audiodev present Gerd Hoffmann
2019-08-13 11:18 ` [Qemu-devel] [PULL 07/15] paaudio: do not move stream when sink/source name is specified Gerd Hoffmann
2019-08-13 11:18 ` [Qemu-devel] [PULL 08/15] paaudio: properly disconnect streams in fini_* Gerd Hoffmann
2019-08-13 11:18 ` [Qemu-devel] [PULL 09/15] audio: remove audio_MIN, audio_MAX Gerd Hoffmann
2019-08-13 11:18 ` Gerd Hoffmann [this message]
2019-08-13 11:18 ` [Qemu-devel] [PULL 11/15] paaudio: fix playback glitches Gerd Hoffmann
2019-08-13 11:18 ` [Qemu-devel] [PULL 12/15] audio: remove read and write pcm_ops Gerd Hoffmann
2019-08-13 11:18 ` [Qemu-devel] [PULL 13/15] audio: use size_t where makes sense Gerd Hoffmann
2019-08-13 11:18 ` [Qemu-devel] [PULL 14/15] audio: fix memory leak reported by ASAN Gerd Hoffmann
2019-08-13 11:18 ` [Qemu-devel] [PULL 15/15] audio: Add missing fall through comments Gerd Hoffmann
2019-08-13 11:22 ` [Qemu-devel] [PULL 00/15] Audio 20190813 patches Peter Maydell
2019-08-13 11:53 ` Gerd Hoffmann
2019-08-16 10:10 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190813111809.3141-11-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=DirtY.iCE.hu@gmail.com \
--cc=Kővágó@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=michael@walle.cc \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).