Skip to content

Commit 0f6ed88

Browse files
saipavakraxel
authored andcommitted
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 <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Message-id: [email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent 7ffc90f commit 0f6ed88

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hw/display/xlnx_dp.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -394,13 +394,18 @@ static void xlnx_dp_audio_callback(void *opaque, int avail)
394394
written = AUD_write(s->amixer_output_stream,
395395
&s->out_buffer[s->data_ptr], s->byte_left);
396396
} else {
397+
int len_to_copy;
397398
/*
398399
* There is nothing to play.. We don't have any data! Fill the
399400
* buffer with zero's and send it.
400401
*/
401402
written = 0;
402-
memset(s->out_buffer, 0, 1024);
403-
AUD_write(s->amixer_output_stream, s->out_buffer, 1024);
403+
while (avail) {
404+
len_to_copy = MIN(AUD_CHBUF_MAX_DEPTH, avail);
405+
memset(s->out_buffer, 0, len_to_copy);
406+
avail -= AUD_write(s->amixer_output_stream, s->out_buffer,
407+
len_to_copy);
408+
}
404409
}
405410
} else {
406411
written = AUD_write(s->amixer_output_stream,

0 commit comments

Comments
 (0)