* [PATCH] audio/mixeng: fix sw/hw mixup in audio_pcm_sw_init_
@ 2026-03-18 8:43 marcandre.lureau
2026-03-18 8:58 ` Christian Schoenebeck
2026-03-18 13:39 ` Dmitry Osipenko
0 siblings, 2 replies; 3+ messages in thread
From: marcandre.lureau @ 2026-03-18 8:43 UTC (permalink / raw)
To: qemu-devel; +Cc: dmitry.osipenko, Marc-André Lureau, Gerd Hoffmann
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Commit 42061a14358 ("audio/mixeng: replace redundant pcm_info fields
with AudioFormat") accidentally changed the conv/clip function selection
in audio_pcm_sw_init_ to use hw->info.af (the hardware voice format)
instead of sw->info.af (the software voice format). This causes audio
distortion when the software and hardware voices use different formats,
as the wrong conversion functions are applied to the audio data.
Fix by using sw->info.af, restoring the original behavior.
Fixes: 42061a14358c ("audio/mixeng: replace redundant pcm_info fields with AudioFormat")
Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
audio/audio_template.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/audio/audio_template.h b/audio/audio_template.h
index 228369cf9a1..f0b2458996a 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -172,7 +172,7 @@ static int glue (audio_pcm_sw_init_, TYPE) (
sw->empty = true;
#endif
- if (audio_format_is_float(hw->info.af)) {
+ if (audio_format_is_float(sw->info.af)) {
#ifdef DAC
sw->conv = mixeng_conv_float[sw->info.nchannels == 2]
[sw->info.swap_endianness];
@@ -187,9 +187,9 @@ static int glue (audio_pcm_sw_init_, TYPE) (
sw->clip = mixeng_clip
#endif
[sw->info.nchannels == 2]
- [audio_format_is_signed(hw->info.af)]
+ [audio_format_is_signed(sw->info.af)]
[sw->info.swap_endianness]
- [audio_format_to_index(hw->info.af)];
+ [audio_format_to_index(sw->info.af)];
}
sw->name = g_strdup (name);
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] audio/mixeng: fix sw/hw mixup in audio_pcm_sw_init_
2026-03-18 8:43 [PATCH] audio/mixeng: fix sw/hw mixup in audio_pcm_sw_init_ marcandre.lureau
@ 2026-03-18 8:58 ` Christian Schoenebeck
2026-03-18 13:39 ` Dmitry Osipenko
1 sibling, 0 replies; 3+ messages in thread
From: Christian Schoenebeck @ 2026-03-18 8:58 UTC (permalink / raw)
To: qemu-devel
Cc: dmitry.osipenko, Marc-André Lureau, Gerd Hoffmann,
marcandre.lureau
On Wednesday, 18 March 2026 09:43:01 CET marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Commit 42061a14358 ("audio/mixeng: replace redundant pcm_info fields
> with AudioFormat") accidentally changed the conv/clip function selection
> in audio_pcm_sw_init_ to use hw->info.af (the hardware voice format)
> instead of sw->info.af (the software voice format). This causes audio
> distortion when the software and hardware voices use different formats,
> as the wrong conversion functions are applied to the audio data.
>
> Fix by using sw->info.af, restoring the original behavior.
>
> Fixes: 42061a14358c ("audio/mixeng: replace redundant pcm_info fields with
> AudioFormat") Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/audio_template.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Haven't tested this, but those changes (hw instead of sw) were definitely
wrong and are likely to cause misbehaviours like the reported one. I also
haven't found further similar issues, so:
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
>
> diff --git a/audio/audio_template.h b/audio/audio_template.h
> index 228369cf9a1..f0b2458996a 100644
> --- a/audio/audio_template.h
> +++ b/audio/audio_template.h
> @@ -172,7 +172,7 @@ static int glue (audio_pcm_sw_init_, TYPE) (
> sw->empty = true;
> #endif
>
> - if (audio_format_is_float(hw->info.af)) {
> + if (audio_format_is_float(sw->info.af)) {
> #ifdef DAC
> sw->conv = mixeng_conv_float[sw->info.nchannels == 2]
> [sw->info.swap_endianness];
> @@ -187,9 +187,9 @@ static int glue (audio_pcm_sw_init_, TYPE) (
> sw->clip = mixeng_clip
> #endif
> [sw->info.nchannels == 2]
> - [audio_format_is_signed(hw->info.af)]
> + [audio_format_is_signed(sw->info.af)]
> [sw->info.swap_endianness]
> - [audio_format_to_index(hw->info.af)];
> + [audio_format_to_index(sw->info.af)];
> }
>
> sw->name = g_strdup (name);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] audio/mixeng: fix sw/hw mixup in audio_pcm_sw_init_
2026-03-18 8:43 [PATCH] audio/mixeng: fix sw/hw mixup in audio_pcm_sw_init_ marcandre.lureau
2026-03-18 8:58 ` Christian Schoenebeck
@ 2026-03-18 13:39 ` Dmitry Osipenko
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2026-03-18 13:39 UTC (permalink / raw)
To: marcandre.lureau, qemu-devel; +Cc: Gerd Hoffmann
On 3/18/26 11:43, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Commit 42061a14358 ("audio/mixeng: replace redundant pcm_info fields
> with AudioFormat") accidentally changed the conv/clip function selection
> in audio_pcm_sw_init_ to use hw->info.af (the hardware voice format)
> instead of sw->info.af (the software voice format). This causes audio
> distortion when the software and hardware voices use different formats,
> as the wrong conversion functions are applied to the audio data.
>
> Fix by using sw->info.af, restoring the original behavior.
>
> Fixes: 42061a14358c ("audio/mixeng: replace redundant pcm_info fields with AudioFormat")
> Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> audio/audio_template.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/audio/audio_template.h b/audio/audio_template.h
> index 228369cf9a1..f0b2458996a 100644
> --- a/audio/audio_template.h
> +++ b/audio/audio_template.h
> @@ -172,7 +172,7 @@ static int glue (audio_pcm_sw_init_, TYPE) (
> sw->empty = true;
> #endif
>
> - if (audio_format_is_float(hw->info.af)) {
> + if (audio_format_is_float(sw->info.af)) {
> #ifdef DAC
> sw->conv = mixeng_conv_float[sw->info.nchannels == 2]
> [sw->info.swap_endianness];
> @@ -187,9 +187,9 @@ static int glue (audio_pcm_sw_init_, TYPE) (
> sw->clip = mixeng_clip
> #endif
> [sw->info.nchannels == 2]
> - [audio_format_is_signed(hw->info.af)]
> + [audio_format_is_signed(sw->info.af)]
> [sw->info.swap_endianness]
> - [audio_format_to_index(hw->info.af)];
> + [audio_format_to_index(sw->info.af)];
> }
>
> sw->name = g_strdup (name);
Thanks a lot for the fix!
--
Best regards,
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-18 13:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 8:43 [PATCH] audio/mixeng: fix sw/hw mixup in audio_pcm_sw_init_ marcandre.lureau
2026-03-18 8:58 ` Christian Schoenebeck
2026-03-18 13:39 ` Dmitry Osipenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.