diff options
author | Geoffrey McRae <geoff@hostfission.com> | 2020-06-13 14:05:13 +1000 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-06-17 14:44:51 +0200 |
commit | 36963ed116b625c6dcdf71002c804f893dc6fdc1 (patch) | |
tree | ae524d4522433723a602ef00a4465ff9bed0d811 /audio | |
parent | 5c24bce3056ff209a1ecc50ff4b7e65b85ad8e74 (diff) | |
download | qemu-36963ed116b625c6dcdf71002c804f893dc6fdc1.zip qemu-36963ed116b625c6dcdf71002c804f893dc6fdc1.tar.gz qemu-36963ed116b625c6dcdf71002c804f893dc6fdc1.tar.bz2 |
audio/jack: fix invalid minimum buffer size check
JACK does not provide us with the configured buffer size until after
activiation which was overriding this minimum value. JACK itself doesn't
have this minimum limitation, but the QEMU virtual hardware and as such
it must be enforced, failure to do so results in audio discontinuities.
Signed-off-by: Geoffrey McRae <geoff@hostfission.com>
Message-id: 20200613040518.38172-2-geoff@hostfission.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio')
-rw-r--r-- | audio/jackaudio.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 722ddb1..d0b6f74 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -434,17 +434,6 @@ static int qjack_client_init(QJackClient *c) jack_set_xrun_callback(c->client, qjack_xrun, c); jack_on_shutdown(c->client, qjack_shutdown, c); - /* - * ensure the buffersize is no smaller then 512 samples, some (all?) qemu - * virtual devices do not work correctly otherwise - */ - if (c->buffersize < 512) { - c->buffersize = 512; - } - - /* create a 2 period buffer */ - qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 2); - /* allocate and register the ports */ c->port = g_malloc(sizeof(jack_port_t *) * c->nchannels); for (int i = 0; i < c->nchannels; ++i) { @@ -468,6 +457,17 @@ static int qjack_client_init(QJackClient *c) jack_activate(c->client); c->buffersize = jack_get_buffer_size(c->client); + /* + * ensure the buffersize is no smaller then 512 samples, some (all?) qemu + * virtual devices do not work correctly otherwise + */ + if (c->buffersize < 512) { + c->buffersize = 512; + } + + /* create a 2 period buffer */ + qjack_buffer_create(&c->fifo, c->nchannels, c->buffersize * 2); + qjack_client_connect_ports(c); c->state = QJACK_STATE_RUNNING; return 0; |