* [PULL 0/7] Audio 20201215 patches
@ 2020-12-15 13:48 Gerd Hoffmann
2020-12-15 13:48 ` [PULL 1/7] coreaudio: rename misnamed variable fake_as Gerd Hoffmann
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-12-15 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
The following changes since commit aa14de086675280206dbc1849da6f85b75f62f1b:
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/mips-20201213' int=
o staging (2020-12-14 18:53:30 +0000)
are available in the Git repository at:
git://git.kraxel.org/qemu tags/audio-20201215-pull-request
for you to fetch changes up to 06c8c375389a54d8e4457d967f4f0896caecefb2:
audio: add sanity check (2020-12-15 09:28:52 +0100)
----------------------------------------------------------------
audio: coreaudio playback state fixes.
audio: misc cleanups.
----------------------------------------------------------------
Eduardo Habkost (1):
cs4231: Get rid of empty property array
Gerd Hoffmann (1):
audio: add sanity check
Philippe Mathieu-Daud=C3=A9 (1):
audio: Simplify audio_bug() removing old code
Volker R=C3=BCmelin (4):
coreaudio: rename misnamed variable fake_as
coreaudio: don't start playback in init routine
coreaudio: always stop audio playback on shut down
audio: remove unused function audio_is_cleaning_up()
audio/audio.h | 1 -
audio/audio.c | 31 ++++-----------------------
audio/coreaudio.c | 53 +++++++++++++++++------------------------------
hw/audio/cs4231.c | 5 -----
4 files changed, 23 insertions(+), 67 deletions(-)
--=20
2.27.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PULL 1/7] coreaudio: rename misnamed variable fake_as
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
@ 2020-12-15 13:48 ` Gerd Hoffmann
2020-12-15 13:48 ` [PULL 2/7] coreaudio: don't start playback in init routine Gerd Hoffmann
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-12-15 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Volker Rümelin, Gerd Hoffmann, Howard Spoelstra
From: Volker Rümelin <vr_qemu@t-online.de>
While the variable once was used to fake audio settings, since
commit ed2a4a7941 "audio: proper support for float samples in
mixeng" this is no longer true. Rename the variable to obt_as.
This is the same naming scheme as in audio/sdlaudio.c
Tested-by: Howard Spoelstra <hsp.cat7@gmail.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 20201213130528.5863-1-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
audio/coreaudio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 4b4365660fcf..0ee85052c452 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -482,7 +482,7 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as,
Audiodev *dev = drv_opaque;
AudiodevCoreaudioPerDirectionOptions *cpdo = dev->u.coreaudio.out;
int frames;
- struct audsettings fake_as;
+ struct audsettings obt_as;
/* create mutex */
err = pthread_mutex_init(&core->mutex, NULL);
@@ -491,8 +491,8 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as,
return -1;
}
- fake_as = *as;
- as = &fake_as;
+ obt_as = *as;
+ as = &obt_as;
as->fmt = AUDIO_FORMAT_F32;
audio_pcm_init_info (&hw->info, as);
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL 2/7] coreaudio: don't start playback in init routine
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
2020-12-15 13:48 ` [PULL 1/7] coreaudio: rename misnamed variable fake_as Gerd Hoffmann
@ 2020-12-15 13:48 ` Gerd Hoffmann
2020-12-15 13:48 ` [PULL 3/7] coreaudio: always stop audio playback on shut down Gerd Hoffmann
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-12-15 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Volker Rümelin, Gerd Hoffmann, Howard Spoelstra
From: Volker Rümelin <vr_qemu@t-online.de>
Every emulated audio device has a way to enable audio playback. Don't
start playback until the guest enables the audio device to keep the
Core Audio device run state in sync with hw->enabled.
Tested-by: Howard Spoelstra <hsp.cat7@gmail.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 20201213130528.5863-2-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
audio/coreaudio.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 0ee85052c452..a5df95051461 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -584,17 +584,6 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as,
return -1;
}
- /* start Playback */
- if (!isPlaying(core->outputDeviceID)) {
- status = AudioDeviceStart(core->outputDeviceID, core->ioprocid);
- if (status != kAudioHardwareNoError) {
- coreaudio_logerr2 (status, typ, "Could not start playback\n");
- AudioDeviceDestroyIOProcID(core->outputDeviceID, core->ioprocid);
- core->outputDeviceID = kAudioDeviceUnknown;
- return -1;
- }
- }
-
return 0;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL 3/7] coreaudio: always stop audio playback on shut down
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
2020-12-15 13:48 ` [PULL 1/7] coreaudio: rename misnamed variable fake_as Gerd Hoffmann
2020-12-15 13:48 ` [PULL 2/7] coreaudio: don't start playback in init routine Gerd Hoffmann
@ 2020-12-15 13:48 ` Gerd Hoffmann
2020-12-15 13:48 ` [PULL 4/7] audio: remove unused function audio_is_cleaning_up() Gerd Hoffmann
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-12-15 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Volker Rümelin, Gerd Hoffmann, Howard Spoelstra
From: Volker Rümelin <vr_qemu@t-online.de>
Always stop audio playback and remove the playback callback when
QEMU exits.
On shut down the function coreaudio_fini_out() destroys the
coreaudio mutex but fails to stop audio playback and to remove the
audio playback callback, because function audio_is_cleaning_up()
always returns true when called from coreaudio_fini_out(). Now
there is a time window from pthread_mutex_destroy() to program
exit where Core Audio may call the audio playback callback which
tries to lock the destroyed coreaudio mutex. This leads to the
following error.
coreaudio: Could not lock voice for audioDeviceIOProc
Reason: Invalid argument
This bug was reported on the qemu-discuss mailing list.
https://lists.nongnu.org/archive/html/qemu-discuss/2020-10/msg00018.html
Tested-by: Howard Spoelstra <hsp.cat7@gmail.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 20201213130528.5863-3-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
audio/coreaudio.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index a5df95051461..79a9d40bf8ef 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -593,22 +593,20 @@ static void coreaudio_fini_out (HWVoiceOut *hw)
int err;
coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw;
- if (!audio_is_cleaning_up()) {
- /* stop playback */
- if (isPlaying(core->outputDeviceID)) {
- status = AudioDeviceStop(core->outputDeviceID, core->ioprocid);
- if (status != kAudioHardwareNoError) {
- coreaudio_logerr (status, "Could not stop playback\n");
- }
- }
-
- /* remove callback */
- status = AudioDeviceDestroyIOProcID(core->outputDeviceID,
- core->ioprocid);
+ /* stop playback */
+ if (isPlaying(core->outputDeviceID)) {
+ status = AudioDeviceStop(core->outputDeviceID, core->ioprocid);
if (status != kAudioHardwareNoError) {
- coreaudio_logerr (status, "Could not remove IOProc\n");
+ coreaudio_logerr(status, "Could not stop playback\n");
}
}
+
+ /* remove callback */
+ status = AudioDeviceDestroyIOProcID(core->outputDeviceID,
+ core->ioprocid);
+ if (status != kAudioHardwareNoError) {
+ coreaudio_logerr(status, "Could not remove IOProc\n");
+ }
core->outputDeviceID = kAudioDeviceUnknown;
/* destroy mutex */
@@ -633,13 +631,11 @@ static void coreaudio_enable_out(HWVoiceOut *hw, bool enable)
}
} else {
/* stop playback */
- if (!audio_is_cleaning_up()) {
- if (isPlaying(core->outputDeviceID)) {
- status = AudioDeviceStop(core->outputDeviceID,
- core->ioprocid);
- if (status != kAudioHardwareNoError) {
- coreaudio_logerr (status, "Could not pause playback\n");
- }
+ if (isPlaying(core->outputDeviceID)) {
+ status = AudioDeviceStop(core->outputDeviceID,
+ core->ioprocid);
+ if (status != kAudioHardwareNoError) {
+ coreaudio_logerr(status, "Could not pause playback\n");
}
}
}
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL 4/7] audio: remove unused function audio_is_cleaning_up()
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
` (2 preceding siblings ...)
2020-12-15 13:48 ` [PULL 3/7] coreaudio: always stop audio playback on shut down Gerd Hoffmann
@ 2020-12-15 13:48 ` Gerd Hoffmann
2020-12-15 13:48 ` [PULL 5/7] cs4231: Get rid of empty property array Gerd Hoffmann
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-12-15 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Volker Rümelin, Gerd Hoffmann, Howard Spoelstra
From: Volker Rümelin <vr_qemu@t-online.de>
The previous commit removed the last call site of
audio_is_cleaning_up(). Remove the now unused function.
Tested-by: Howard Spoelstra <hsp.cat7@gmail.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 20201213130528.5863-4-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
audio/audio.h | 1 -
audio/audio.c | 8 --------
2 files changed, 9 deletions(-)
diff --git a/audio/audio.h b/audio/audio.h
index b883ebfb1f8e..41b3ef04eae1 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -160,7 +160,6 @@ static inline void *advance (void *p, int incr)
int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
int freq, int bits, int nchannels);
-bool audio_is_cleaning_up(void);
void audio_cleanup(void);
void audio_sample_to_uint64(const void *samples, int pos,
diff --git a/audio/audio.c b/audio/audio.c
index 46578e4a583b..a21340927033 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1588,13 +1588,6 @@ static void audio_vm_change_state_handler (void *opaque, int running,
audio_reset_timer (s);
}
-static bool is_cleaning_up;
-
-bool audio_is_cleaning_up(void)
-{
- return is_cleaning_up;
-}
-
static void free_audio_state(AudioState *s)
{
HWVoiceOut *hwo, *hwon;
@@ -1647,7 +1640,6 @@ static void free_audio_state(AudioState *s)
void audio_cleanup(void)
{
- is_cleaning_up = true;
while (!QTAILQ_EMPTY(&audio_states)) {
AudioState *s = QTAILQ_FIRST(&audio_states);
QTAILQ_REMOVE(&audio_states, s, list);
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL 5/7] cs4231: Get rid of empty property array
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
` (3 preceding siblings ...)
2020-12-15 13:48 ` [PULL 4/7] audio: remove unused function audio_is_cleaning_up() Gerd Hoffmann
@ 2020-12-15 13:48 ` Gerd Hoffmann
2020-12-15 13:48 ` [PULL 6/7] audio: Simplify audio_bug() removing old code Gerd Hoffmann
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-12-15 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, Gerd Hoffmann, Eduardo Habkost
From: Eduardo Habkost <ehabkost@redhat.com>
An empty props array is unnecessary, we can just not call
device_class_set_props().
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-id: 20201211220529.2290218-2-ehabkost@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/audio/cs4231.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c
index 8e9554ce9bcd..209c05a0a0d5 100644
--- a/hw/audio/cs4231.c
+++ b/hw/audio/cs4231.c
@@ -160,17 +160,12 @@ static void cs4231_init(Object *obj)
sysbus_init_irq(dev, &s->irq);
}
-static Property cs4231_properties[] = {
- {.name = NULL},
-};
-
static void cs4231_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->reset = cs_reset;
dc->vmsd = &vmstate_cs4231;
- device_class_set_props(dc, cs4231_properties);
}
static const TypeInfo cs4231_info = {
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL 6/7] audio: Simplify audio_bug() removing old code
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
` (4 preceding siblings ...)
2020-12-15 13:48 ` [PULL 5/7] cs4231: Get rid of empty property array Gerd Hoffmann
@ 2020-12-15 13:48 ` Gerd Hoffmann
2020-12-15 13:48 ` [PULL 7/7] audio: add sanity check Gerd Hoffmann
2020-12-15 15:35 ` [PULL 0/7] Audio 20201215 patches Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-12-15 13:48 UTC (permalink / raw)
To: qemu-devel
Cc: Marc-André Lureau, Philippe Mathieu-Daudé,
Gerd Hoffmann, Gerd Hoffmann
From: Philippe Mathieu-Daudé <philmd@redhat.com>
This code (introduced in commit 1d14ffa97ea, Oct 2005)
is likely unused since years. Time to remove it. If
the condition is true, simply call abort().
Suggested-by: Gerd Hoffmann <gerd@kraxel.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20201210223506.263709-1-philmd@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
audio/audio.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/audio/audio.c b/audio/audio.c
index a21340927033..0fdb808d6a57 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -104,9 +104,6 @@ const struct mixeng_volume nominal_volume = {
static bool legacy_config = true;
-#ifdef AUDIO_IS_FLAWLESS_AND_NO_CHECKS_ARE_REQURIED
-#error No its not
-#else
int audio_bug (const char *funcname, int cond)
{
if (cond) {
@@ -119,25 +116,11 @@ int audio_bug (const char *funcname, int cond)
AUD_log (NULL, "I am sorry\n");
}
AUD_log (NULL, "Context:\n");
-
-#if defined AUDIO_BREAKPOINT_ON_BUG
-# if defined HOST_I386
-# if defined __GNUC__
- __asm__ ("int3");
-# elif defined _MSC_VER
- _asm _emit 0xcc;
-# else
- abort ();
-# endif
-# else
- abort ();
-# endif
-#endif
+ abort();
}
return cond;
}
-#endif
static inline int audio_bits_to_index (int bits)
{
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL 7/7] audio: add sanity check
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
` (5 preceding siblings ...)
2020-12-15 13:48 ` [PULL 6/7] audio: Simplify audio_bug() removing old code Gerd Hoffmann
@ 2020-12-15 13:48 ` Gerd Hoffmann
2020-12-15 15:35 ` [PULL 0/7] Audio 20201215 patches Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2020-12-15 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: dann frazier, Gerd Hoffmann
Check whenever we actually found the spiceaudio driver
before flipping the can_be_default field.
Fixes: f0c4555edfdd ("audio: remove qemu_spice_audio_init()")
Buglink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977301
Reported-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20201215081151.20095-1-kraxel@redhat.com>
---
audio/audio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/audio/audio.c b/audio/audio.c
index 0fdb808d6a57..b48471bb3f64 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1684,7 +1684,9 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
* backend and this can go away.
*/
driver = audio_driver_lookup("spice");
- driver->can_be_default = 1;
+ if (driver) {
+ driver->can_be_default = 1;
+ }
}
if (dev) {
--
2.27.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PULL 0/7] Audio 20201215 patches
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
` (6 preceding siblings ...)
2020-12-15 13:48 ` [PULL 7/7] audio: add sanity check Gerd Hoffmann
@ 2020-12-15 15:35 ` Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2020-12-15 15:35 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On Tue, 15 Dec 2020 at 13:50, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> The following changes since commit aa14de086675280206dbc1849da6f85b75f62f1b:
>
> Merge remote-tracking branch 'remotes/philmd-gitlab/tags/mips-20201213' int=
> o staging (2020-12-14 18:53:30 +0000)
>
> are available in the Git repository at:
>
> git://git.kraxel.org/qemu tags/audio-20201215-pull-request
>
> for you to fetch changes up to 06c8c375389a54d8e4457d967f4f0896caecefb2:
>
> audio: add sanity check (2020-12-15 09:28:52 +0100)
>
> ----------------------------------------------------------------
> audio: coreaudio playback state fixes.
> audio: misc cleanups.
>
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-12-15 15:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-15 13:48 [PULL 0/7] Audio 20201215 patches Gerd Hoffmann
2020-12-15 13:48 ` [PULL 1/7] coreaudio: rename misnamed variable fake_as Gerd Hoffmann
2020-12-15 13:48 ` [PULL 2/7] coreaudio: don't start playback in init routine Gerd Hoffmann
2020-12-15 13:48 ` [PULL 3/7] coreaudio: always stop audio playback on shut down Gerd Hoffmann
2020-12-15 13:48 ` [PULL 4/7] audio: remove unused function audio_is_cleaning_up() Gerd Hoffmann
2020-12-15 13:48 ` [PULL 5/7] cs4231: Get rid of empty property array Gerd Hoffmann
2020-12-15 13:48 ` [PULL 6/7] audio: Simplify audio_bug() removing old code Gerd Hoffmann
2020-12-15 13:48 ` [PULL 7/7] audio: add sanity check Gerd Hoffmann
2020-12-15 15:35 ` [PULL 0/7] Audio 20201215 patches Peter Maydell
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).