[PATCH v3 06/15] jackaudio: use more jack audio buffers

Volker Rümelin posted 15 patches 3 years, 11 months ago
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, Christian Schoenebeck <qemu_oss@crudebyte.com>, Akihiko Odaki <akihiko.odaki@gmail.com>, Thomas Huth <huth@tuxfamily.org>
[PATCH v3 06/15] jackaudio: use more jack audio buffers
Posted by Volker Rümelin 3 years, 11 months ago
The next patch reduces the effective qemu playback buffer size
by timer-period. Increase the number of jack audio buffers by
one to preserve the total effective buffer size. The size of one
jack audio buffer is 512 samples. With audio defaults that's
512 samples / 44100 samples/s = 11.6 ms and only slightly larger
than the timer-period of 10 ms.

The larger jack audio buffer increases audio dropout safety,
because the high priority jack-audio worker threads can provide
audio data for a longer period of time as with a smaller buffer
and more audio data in the mixing engine buffer that they can't
access.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
 audio/jackaudio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/audio/jackaudio.c b/audio/jackaudio.c
index 317009e936..26246c3a8b 100644
--- a/audio/jackaudio.c
+++ b/audio/jackaudio.c
@@ -483,8 +483,8 @@ static int qjack_client_init(QJackClient *c)
         c->buffersize = 512;
     }
 
-    /* create a 2 period buffer */
-    qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 2);
+    /* create a 3 period buffer */
+    qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 3);
 
     qjack_client_connect_ports(c);
     c->state = QJACK_STATE_RUNNING;
-- 
2.34.1


Re: [PATCH v3 06/15] jackaudio: use more jack audio buffers
Posted by Christian Schoenebeck 3 years, 11 months ago
On Dienstag, 1. März 2022 20:13:02 CET Volker Rümelin wrote:
> The next patch reduces the effective qemu playback buffer size
> by timer-period. Increase the number of jack audio buffers by
> one to preserve the total effective buffer size. The size of one
> jack audio buffer is 512 samples. With audio defaults that's
> 512 samples / 44100 samples/s = 11.6 ms and only slightly larger
> than the timer-period of 10 ms.
> 
> The larger jack audio buffer increases audio dropout safety,
> because the high priority jack-audio worker threads can provide
> audio data for a longer period of time as with a smaller buffer
> and more audio data in the mixing engine buffer that they can't
> access.
> 
> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
> ---

I actually reviewed this patch already, but OK, then a 2nd time:

Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>

Best regards,
Christian Schoenebeck

>  audio/jackaudio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/audio/jackaudio.c b/audio/jackaudio.c
> index 317009e936..26246c3a8b 100644
> --- a/audio/jackaudio.c
> +++ b/audio/jackaudio.c
> @@ -483,8 +483,8 @@ static int qjack_client_init(QJackClient *c)
>          c->buffersize = 512;
>      }
> 
> -    /* create a 2 period buffer */
> -    qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 2);
> +    /* create a 3 period buffer */
> +    qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 3);
> 
>      qjack_client_connect_ports(c);
>      c->state = QJACK_STATE_RUNNING;
Re: [PATCH v3 06/15] jackaudio: use more jack audio buffers
Posted by Volker Rümelin 3 years, 11 months ago
> On Dienstag, 1. März 2022 20:13:02 CET Volker Rümelin wrote:
>> The next patch reduces the effective qemu playback buffer size
>> by timer-period. Increase the number of jack audio buffers by
>> one to preserve the total effective buffer size. The size of one
>> jack audio buffer is 512 samples. With audio defaults that's
>> 512 samples / 44100 samples/s = 11.6 ms and only slightly larger
>> than the timer-period of 10 ms.
>>
>> The larger jack audio buffer increases audio dropout safety,
>> because the high priority jack-audio worker threads can provide
>> audio data for a longer period of time as with a smaller buffer
>> and more audio data in the mixing engine buffer that they can't
>> access.
>>
>> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
>> ---
> I actually reviewed this patch already, but OK, then a 2nd time:
>
> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>

Oh, now that you write it, I remember this. Thank you.

With best regards,
Volker

> Best regards,
> Christian Schoenebeck
>
>>   audio/jackaudio.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/audio/jackaudio.c b/audio/jackaudio.c
>> index 317009e936..26246c3a8b 100644
>> --- a/audio/jackaudio.c
>> +++ b/audio/jackaudio.c
>> @@ -483,8 +483,8 @@ static int qjack_client_init(QJackClient *c)
>>           c->buffersize = 512;
>>       }
>>
>> -    /* create a 2 period buffer */
>> -    qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 2);
>> +    /* create a 3 period buffer */
>> +    qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 3);
>>
>>       qjack_client_connect_ports(c);
>>       c->state = QJACK_STATE_RUNNING;
>