summaryrefslogtreecommitdiffstats
path: root/audio/jackaudio.c
Commit message (Collapse)AuthorAgeFilesLines
* audio: Add spaces around operator/delete redundant spacesZhang Han2021-01-151-1/+1
| | | | | | | | | | | | Fix problems about spaces: -operator needs spaces around it, add them. -somespaces are redundant, remove them. Signed-off-by: Zhang Han <zhanghan64@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20210115012431.79533-1-zhanghan64@huawei.com Message-Id: <20210115012431.79533-3-zhanghan64@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio: split pcm_ops function get_buffer_inVolker Rümelin2021-01-151-0/+1
| | | | | | | | | | | | | Split off pcm_ops function run_buffer_in from get_buffer_in and call run_buffer_in before get_buffer_in. The next patch only needs the generic buffer management part from audio_generic_get_buffer_in(). Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-8-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio/jack: fix use after free segfaultGeoffrey McRae2020-11-131-13/+37
| | | | | | | | | | | | This change registers a bottom handler to close the JACK client connection when a server shutdown signal is received. Without this libjack2 attempts to "clean up" old clients and causes a use after free segfault. Signed-off-by: Geoffrey McRae <geoff@hostfission.com> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <20201108063351.35804-2-geoff@hostfission.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* qemu/atomic.h: rename atomic_ to qatomic_Stefan Hajnoczi2020-09-231-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang's C11 atomic_fetch_*() functions only take a C11 atomic type pointer argument. QEMU uses direct types (int, etc) and this causes a compiler error when a QEMU code calls these functions in a source file that also included <stdatomic.h> via a system header file: $ CC=clang CXX=clang++ ./configure ... && make ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid) Avoid using atomic_*() names in QEMU's atomic.h since that namespace is used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h and <stdatomic.h> can co-exist. I checked /usr/include on my machine and searched GitHub for existing "qatomic_" users but there seem to be none. This patch was generated using: $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \ sort -u >/tmp/changed_identifiers $ for identifier in $(</tmp/changed_identifiers); do sed -i "s%\<$identifier\>%q$identifier%g" \ $(git grep -I -l "\<$identifier\>") done I manually fixed line-wrap issues and misaligned rST tables. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
* audio/jack: simplify the re-init code pathGeoffrey McRae2020-06-171-6/+6
| | | | | | | | | | Instead of checking for the audodev state in each code path, centralize the check into the initialize function itself to make it safe to call it at any time. Signed-off-by: Geoffrey McRae <geoff@hostfission.com> Message-id: 20200613040518.38172-7-geoff@hostfission.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio/jack: honour the enable state of the audio deviceGeoffrey McRae2020-06-171-8/+21
| | | | | | | | | | | | | | | | | When the guest closes the audio device we must start dropping input samples from JACK and zeroing the output buffer samples. Failure to do so causes sound artifacts during operations such as guest OS reboot, and causes a hang of the input pipeline breaking it until QEMU is restated. Closing and reconnecting to JACK was tested during these enable/disable calls which works well for Linux guests, however Windows re-opens the audio hardware repeatedly even when doing simple tasks like playing a system sounds. As such it was decided it is better to feed silence to JACK while the device is disabled. Signed-off-by: Geoffrey McRae <geoff@hostfission.com> Message-id: 20200613040518.38172-6-geoff@hostfission.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio/jack: do not remove ports when finishingGeoffrey McRae2020-06-171-3/+0Star
| | | | | | | | | | | | | This fixes a hang when there is a communications issue with the JACK server. Simply closing the connection is enough to completely clean up and as such we do not need to remove the ports first. As JACK uses a socket based protocol that relies on the `select` call, if there is a communication breakdown with the server the client library waits forever for a response to the unregister request. Signed-off-by: Geoffrey McRae <geoff@hostfission.com> Message-id: 20200613040518.38172-5-geoff@hostfission.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio/jack: remove invalid set of input support boolGeoffrey McRae2020-06-171-3/+0Star
| | | | | | | | | | | | | Initial code for JACK did not support audio input and as such this boolean was set to let QEMU know, however JACK ended up including input support making this invalid. Further investigation shows it was invalid to set it in the first instance anyway due to a failure on my part understand properly what this was for when the audodev was initially developed. Signed-off-by: Geoffrey McRae <geoff@hostfission.com> Message-id: 20200613040518.38172-4-geoff@hostfission.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio/jack: remove unused stopped stateGeoffrey McRae2020-06-171-4/+0Star
| | | | | | Signed-off-by: Geoffrey McRae <geoff@hostfission.com> Message-id: 20200613040518.38172-3-geoff@hostfission.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio/jack: fix invalid minimum buffer size checkGeoffrey McRae2020-06-171-11/+11
| | | | | | | | | | | 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>
* audio/jack: add JACK client audiodevGeoffrey McRae2020-05-251-0/+667
This commit adds a new audiodev backend to allow QEMU to use JACK as both an audio sink and source. Signed-off-by: Geoffrey McRae <geoff@hostfission.com> Message-Id: <20200512101603.E3DB73A038E@moya.office.hostfission.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>