display: xlnx_dp: Provide sufficient bytes for silent audio channel
PATCH 1/1 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]>
--- hw/display/xlnx_dp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
hw/display/xlnx_dp.c +7 -2
@@ -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,
Signature · 1 line
2.7.4
Quoted 5 lines · Sai Pavan Boddu
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
Quoted 7 lines
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]>
Alistair
Quoted 33 lines
--- hw/display/xlnx_dp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)hw/display/xlnx_dp.c +7
-3@@ -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, --2.7.4
Cc'ing Gerd (Audio)
Quoted 41 lines · Sai Pavan Boddu
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]>--- hw/display/xlnx_dp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)hw/display/xlnx_dp.c +7
-2@@ -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,