summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell2021-06-18 10:54:42 +0200
committerPeter Maydell2021-06-18 10:54:42 +0200
commit3ccf6cd0e3e1dfd663814640b3b18b55715d7a75 (patch)
treeb2722bd6a7d1a2ba0749513ff8a59f43d4d7a6e1 /hw
parentMerge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into ... (diff)
parentcoreaudio: Fix output stream format settings (diff)
downloadqemu-3ccf6cd0e3e1dfd663814640b3b18b55715d7a75.tar.gz
qemu-3ccf6cd0e3e1dfd663814640b3b18b55715d7a75.tar.xz
qemu-3ccf6cd0e3e1dfd663814640b3b18b55715d7a75.zip
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20210617-pull-request' into staging
audio: bugfix collection. # gpg: Signature made Thu 17 Jun 2021 13:40:56 BST # gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138 # 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-20210617-pull-request: coreaudio: Fix output stream format settings audio: Fix format specifications of debug logs hw/audio/sb16: Avoid assertion by restricting I/O sampling rate range jackaudio: avoid that the client name contains the word (NULL) audio: move code to audio/audio.c paaudio: remove unused stream flags alsaaudio: remove #ifdef DEBUG to avoid bit rot Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/audio/sb16.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index 8b20700410..5cf121fe36 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -115,6 +115,9 @@ struct SB16State {
PortioList portio_list;
};
+#define SAMPLE_RATE_MIN 5000
+#define SAMPLE_RATE_MAX 45000
+
static void SB_audio_callback (void *opaque, int free);
static int magic_of_irq (int irq)
@@ -241,6 +244,17 @@ static void dma_cmd8 (SB16State *s, int mask, int dma_len)
int tmp = (256 - s->time_const);
s->freq = (1000000 + (tmp / 2)) / tmp;
}
+ if (s->freq < SAMPLE_RATE_MIN) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "sampling range too low: %d, increasing to %u\n",
+ s->freq, SAMPLE_RATE_MIN);
+ s->freq = SAMPLE_RATE_MIN;
+ } else if (s->freq > SAMPLE_RATE_MAX) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "sampling range too high: %d, decreasing to %u\n",
+ s->freq, SAMPLE_RATE_MAX);
+ s->freq = SAMPLE_RATE_MAX;
+ }
if (dma_len != -1) {
s->block_size = dma_len << s->fmt_stereo;