summaryrefslogtreecommitdiffstats
path: root/hw/display/xlnx_dp.c
diff options
context:
space:
mode:
authorSai Pavan Boddu2019-11-15 16:56:48 +0100
committerGerd Hoffmann2019-11-21 07:12:28 +0100
commit0f6ed883e74f3fd9eb3eedfe0e61be66e4834fc9 (patch)
tree63f6f26dff2643b2f31a3759d1d4f20943262737 /hw/display/xlnx_dp.c
parentaudio: fix audio recording (diff)
downloadqemu-0f6ed883e74f3fd9eb3eedfe0e61be66e4834fc9.tar.gz
qemu-0f6ed883e74f3fd9eb3eedfe0e61be66e4834fc9.tar.xz
qemu-0f6ed883e74f3fd9eb3eedfe0e61be66e4834fc9.zip
display: xlnx_dp: Provide sufficient bytes for silent audio channel
Fill the audio channel with required number of bytes to cover the elapsed time. This prevents rate control reset, and avoids debug prints like below log: Resetting rate control (65692 samples) ... Resetting rate control (65721 samples) ... Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 1573833408-2388-1-git-send-email-sai.pavan.boddu@xilinx.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display/xlnx_dp.c')
-rw-r--r--hw/display/xlnx_dp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index fde3b21ea5..7058443797 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -394,13 +394,18 @@ static void xlnx_dp_audio_callback(void *opaque, int avail)
written = AUD_write(s->amixer_output_stream,
&s->out_buffer[s->data_ptr], s->byte_left);
} else {
+ int len_to_copy;
/*
* There is nothing to play.. We don't have any data! Fill the
* buffer with zero's and send it.
*/
written = 0;
- memset(s->out_buffer, 0, 1024);
- AUD_write(s->amixer_output_stream, s->out_buffer, 1024);
+ while (avail) {
+ len_to_copy = MIN(AUD_CHBUF_MAX_DEPTH, avail);
+ memset(s->out_buffer, 0, len_to_copy);
+ avail -= AUD_write(s->amixer_output_stream, s->out_buffer,
+ len_to_copy);
+ }
}
} else {
written = AUD_write(s->amixer_output_stream,