summaryrefslogtreecommitdiffstats
path: root/audio/paaudio.c
Commit message (Collapse)AuthorAgeFilesLines
* paaudio: fix possible resource leakKővágó, Zoltán2015-06-151-1/+5
| | | | | | | | qpa_audio_init did not clean up resources properly if the initialization failed. This hopefully fixes it. Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* paaudio: do not use global variablesKővágó, Zoltán2015-06-151-46/+52
| | | | | Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio: expose drv_opaque to init_out and init_inKővágó, Zoltán2015-06-151-2/+3
| | | | | | | | | | | Currently the opaque pointer returned by audio_driver's init is only exposed to the driver's fini, but not to audio_pcm_ops. This way if someone wants to share a variable with the driver and the pcm, he must use global variables. This patch fixes it by adding a third parameter to audio_pcm_op's init_out and init_in. Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* audio: adjust pulse to 100Hz wakeup rateGerd Hoffmann2013-12-091-4/+4
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* fix build with pulseaudio versions older than 0.9.11Gerd Hoffmann2012-05-041-1/+29
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
* fix paaudio.c warningsGerd Hoffmann2012-04-251-2/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
* Allow controlling volume with PulseAudio backendMarc-André Lureau2012-04-171-5/+94
| | | | | Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
* Do not use pa_simple PulseAudio APIMarc-André Lureau2012-04-171-38/+339
| | | | | | | | | | | | Unfortunately, pa_simple is a limited API which doesn't let us retrieve the associated pa_stream. It is needed to control the volume of the stream. In v4: - add missing braces Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-4/+4
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pulseaudio: tweak configGerd Hoffmann2011-01-251-9/+1
| | | | | | | | Zap unused divisor field. Raise the buffer size default. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
* pulseaudio: setup buffer attrsGerd Hoffmann2011-01-251-1/+11
| | | | | | | | | Request reasonable buffer sizes from pulseaudio. Without this pa_simple_write() can block quite long and lead to dropouts, especially with guests which use small audio ring buffers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
* pulseaudio: process 1/4 buffer max at onceGerd Hoffmann2011-01-251-13/+9
| | | | | | | | | | | | | | | | | | | | | | | Limit the size of data pieces processed by the pulseaudio worker threads. Never ever process more than 1/4 of the buffer at once. Background: The buffer area currently processed by the pulseaudio thread is blocked, i.e. the main thread (or iothread) can't fill in more data there. The buffer processing time is roughly real-time due to the pa_simple_write() call blocking when the output queue to the pulse server is full. Thus processing big chunks at once means blocking a large part of the buffer for a long time. This brings high latency and can lead to dropouts. When processing the buffer in smaller chunks the rpos handling becomes a problem though. The thread reads hw->rpos without knowing whenever qpa_run_out has already seen the last (small) chunk processed and updated rpos accordingly. There is no point in reading hw->rpos though, pa->rpos can be used instead. We just need to take care to initialize pa->rpos before kicking the thread. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
* audio: split sample conversion and volume mixingMichael Walle2011-01-121-1/+1
| | | | | | | | | Refactor the volume mixing, so it can be reused for capturing devices. Additionally, it removes superfluous multiplications with the nominal volume within the hardware voice code path. Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: malc <av1474@comtv.ru>
* pulse-audio: fix bug on updating rposWu Fengguang2010-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a rpos coordination bug between qpa_run_out() and qpa_thread_out(), which shows up as playback noises. qpa_run_out() qpa_thread_out loop N critical section 1 qpa_run_out() qpa_thread_out loop N doing pa_simple_write() qpa_run_out() qpa_thread_out loop N doing pa_simple_write() qpa_thread_out loop N critical section 2 qpa_thread_out loop N+1 critical section 1 qpa_run_out() qpa_thread_out loop N+1 doing pa_simple_write() In the above scheme, "qpa_thread_out loop N+1 critical section 1" will get the same rpos as the one used by "qpa_thread_out loop N critical section 1". So it will be reading dead samples from the old rpos. The rpos can only be updated back to qpa_thread_out when there is a qpa_run_out() run between two qpa_thread_out loops. normal sequence: qpa_thread_out: hw->rpos (X0) => local rpos => pa->rpos (X1) qpa_run_out: pa->rpos (X1) => hw->rpos (X1) qpa_thread_out: hw->rpos (X1) => local rpos => pa->rpos (X2) buggy sequence: qpa_thread_out: hw->rpos (X0) => local rpos => pa->rpos (X1) qpa_thread_out: hw->rpos (X0) => local rpos => pa->rpos (X1') Obviously qpa_run_out() shall be called at least once between any two qpa_thread_out loops (after pa->rpos is set), in order for the new qpa_thread_out loop to see the updated rpos. Setting pa->live to 0 does the trick. The next loop will have to wait for one qpa_run_out() invocation in order to get a non-zero pa->live and proceed. Signed-off-by: malc <av1474@comtv.ru> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
* qemu: allow pulseaudio to be the defaultMichael S. Tsirkin2009-10-131-1/+1
| | | | | | | | | | | | | | | | We're seeing various issues with the SDL audio backend and want to switch to the pulseaudio backend. See e.g. https://bugzilla.redhat.com/495964 https://bugzilla.redhat.com/519540 https://bugzilla.redhat.com/496627 The pulseaudio backend seems to work well, so we should allow it to be selected as the default. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
* audio: internal API changemalc2009-09-181-3/+2
| | | | | | | | | pcm_ops.run_out now takes number of live samples (which will be always greater than zero) as a second argument, every driver was calling audio_pcm_hw_get_live_out anyway with exception of fmod which used audio_pcm_hw_get_live_out2 for no good reason. Signed-off-by: malc <av1474@comtv.ru>
* Aestheticsmalc2009-08-111-20/+30
| | | | | | | Reformat to make item borders more visible Fix cases of stray tabs and vertical misalignments Signed-off-by: malc <av1474@comtv.ru>
* use C99 initializers for all audio/*Juan Quintela2009-08-111-5/+2
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* use C99 initializers for audio_pcm_opsJuan Quintela2009-08-111-10/+11
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* Use C99 initializers for audio_optionJuan Quintela2009-08-111-16/+21
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* Use proper struct initializers and remove INIT_FIELD() macroJuan Quintela2009-08-111-11/+11
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* fix qemu_alloc/qemu_free for audio subsystemJean-Christophe Dubois2009-06-191-2/+2
| | | | Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
* Make audio violate POSIX lessmalc2008-12-031-5/+5
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5864 c046a42c-6fe2-441c-8c8c-71466251a162
* Prepare for changing audio_pcm_ops dynamically (partially revert r5422)blueswir12008-10-061-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5435 c046a42c-6fe2-441c-8c8c-71466251a162
* Make audio_pcm_opsstatic constblueswir12008-10-051-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5422 c046a42c-6fe2-441c-8c8c-71466251a162
* Pulseaudio drivermalc2008-07-021-0/+515
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4827 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud