diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2017-09-01 15:14:09 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-09-18 13:13:32 +0200 |
commit | 4bb3893908385836410346725dd9e584dcd24836 (patch) | |
tree | 6ed326c9e1bbcf87e09958f1fd42db12672fc657 /hw/audio | |
parent | f75637badd76ae0f3bd51a128e1a2da0d2bb1d6b (diff) | |
download | qemu-4bb3893908385836410346725dd9e584dcd24836.zip qemu-4bb3893908385836410346725dd9e584dcd24836.tar.gz qemu-4bb3893908385836410346725dd9e584dcd24836.tar.bz2 |
wm8750: add record buffer underrun check
Reported-by: niuguoxiang@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170901131409.6712-1-kraxel@redhat.com
Diffstat (limited to 'hw/audio')
-rw-r--r-- | hw/audio/wm8750.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index f8b5beb..d2bf2e1 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -680,8 +680,12 @@ uint32_t wm8750_adc_dat(void *opaque) WM8750State *s = (WM8750State *) opaque; uint32_t *data; - if (s->idx_in >= sizeof(s->data_in)) + if (s->idx_in >= sizeof(s->data_in)) { wm8750_in_load(s); + if (s->idx_in >= sizeof(s->data_in)) { + return 0x80008000; /* silence in AUD_FMT_S16 sample format */ + } + } data = (uint32_t *) &s->data_in[s->idx_in]; s->req_in -= 4; |