summary refs log tree commit diff stats
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-05-26 10:59:01 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-05-26 10:59:01 +0100
commit8f72c75cfc9b3c84a9b5e7a58ee5e471cb2f19c8 (patch)
tree01e4f31b2333d27d969322eb4cf9381733d817cc /hw
parentfea8f3ed739536fca027cf56af7f5576f37ef9cd (diff)
parentb3b8a1fea6ed5004bbad2f70833caee70402bf02 (diff)
downloadfocaccia-qemu-8f72c75cfc9b3c84a9b5e7a58ee5e471cb2f19c8.tar.gz
focaccia-qemu-8f72c75cfc9b3c84a9b5e7a58ee5e471cb2f19c8.zip
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20200526-pull-request' into staging
audio: add JACK client audiodev.
audio: bugfixes and cleanups.

# gpg: Signature made Tue 26 May 2020 08:56:21 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20200526-pull-request:
  hw/mips/mips_fulong2e: Remove unused 'audio/audio.h' include
  audio: Let capture_callback handler use const buffer argument
  audio: Let audio_sample_to_uint64() use const samples argument
  audio: fix wavcapture segfault
  audio/mixeng: fix clang 10+ warning
  audio/jack: add JACK client audiodev
  hw/audio/gus: Use AUDIO_HOST_ENDIANNESS definition from 'audio/audio.h'
  es1370: check total frame count against current frame

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/audio/es1370.c7
-rw-r--r--hw/audio/gus.c8
-rw-r--r--hw/mips/mips_fulong2e.c1
3 files changed, 6 insertions, 10 deletions
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index 89c4dabcd4..5f8a83ff56 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -643,6 +643,9 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
     int csc_bytes = (csc + 1) << d->shift;
     int cnt = d->frame_cnt >> 16;
     int size = d->frame_cnt & 0xffff;
+    if (size < cnt) {
+        return;
+    }
     int left = ((size - cnt + 1) << 2) + d->leftover;
     int transferred = 0;
     int temp = MIN (max, MIN (left, csc_bytes));
@@ -651,7 +654,7 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
     addr += (cnt << 2) + d->leftover;
 
     if (index == ADC_CHANNEL) {
-        while (temp) {
+        while (temp > 0) {
             int acquired, to_copy;
 
             to_copy = MIN ((size_t) temp, sizeof (tmpbuf));
@@ -669,7 +672,7 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
     else {
         SWVoiceOut *voice = s->dac_voice[index];
 
-        while (temp) {
+        while (temp > 0) {
             int copied, to_copy;
 
             to_copy = MIN ((size_t) temp, sizeof (tmpbuf));
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index eb4a803fb5..c8df2bde6b 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -41,12 +41,6 @@
 #define ldebug(...)
 #endif
 
-#ifdef HOST_WORDS_BIGENDIAN
-#define GUS_ENDIANNESS 1
-#else
-#define GUS_ENDIANNESS 0
-#endif
-
 #define TYPE_GUS "gus"
 #define GUS(obj) OBJECT_CHECK (GUSState, (obj), TYPE_GUS)
 
@@ -256,7 +250,7 @@ static void gus_realizefn (DeviceState *dev, Error **errp)
     as.freq = s->freq;
     as.nchannels = 2;
     as.fmt = AUDIO_FORMAT_S16;
-    as.endianness = GUS_ENDIANNESS;
+    as.endianness = AUDIO_HOST_ENDIANNESS;
 
     s->voice = AUD_open_out (
         &s->card,
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index ef02d54b33..05b9efa516 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -33,7 +33,6 @@
 #include "hw/mips/mips.h"
 #include "hw/mips/cpudevs.h"
 #include "hw/pci/pci.h"
-#include "audio/audio.h"
 #include "qemu/log.h"
 #include "hw/loader.h"
 #include "hw/ide/pci.h"