Skip to contentSkip to conversation

Fix audio voices tests

PATCH New Helge Konetzka 1 participant 3 messages Oct 12, 2022

lore
Share & tools
lore
#0 lore raw

v2 cover Fix audio voices tests

Changes for v2:
* Sent by git send-email to keep correct format

Fix to remove obsolete warning on -audiodev ...,in.voices=0 and improvement for better readability of audio out.voices test

Helge Konetzka (2):
audio: fix in.voices test
audio: improve out.voices test

 audio/audio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.38.0
#1 lore raw

PATCH v2 1/2 audio: fix in.voices test

Calling qemu with valid -audiodev ...,in.voices=0 results in an obsolete warning:
audio: Bogus number of capture voices 0, setting to 0
This patch fixes the in.voices test.

---
 audio/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
audio/audio.c +1 -1
index cfa4119c05..8a0ade4052 100644
@@ -1756,7 +1756,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
         s->nb_hw_voices_out = 1;
     }
 
-    if (s->nb_hw_voices_in <= 0) {
+    if (s->nb_hw_voices_in < 0) {
         dolog ("Bogus number of capture voices %d, setting to 0\n",
                s->nb_hw_voices_in);
         s->nb_hw_voices_in = 0;
Signature · 1 line
2.38.0
#2 lore raw

PATCH v2 2/2 audio: improve out.voices test

In reply to Helge Konetzka

Improve readability of audio out.voices test:
If 1 is logged and set after positive test, 1 should be tested.

---
 audio/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
audio/audio.c +1 -1
index 8a0ade4052..912b456058 100644
@@ -1750,7 +1750,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
     s->nb_hw_voices_out = audio_get_pdo_out(dev)->voices;
     s->nb_hw_voices_in = audio_get_pdo_in(dev)->voices;
 
-    if (s->nb_hw_voices_out <= 0) {
+    if (s->nb_hw_voices_out < 1) {
         dolog ("Bogus number of playback voices %d, setting to 1\n",
                s->nb_hw_voices_out);
         s->nb_hw_voices_out = 1;
Signature · 1 line
2.38.0