summaryrefslogtreecommitdiff
path: root/audio/audio.c
AgeCommit message (Collapse)AuthorFilesLines
2016-09-12Merge tag 'v2.7.0' into develop_qemu_2.7SeokYeon Hwang1-16/+20
v2.7.0 release Change-Id: Id5feb5a9404ab064f9ea3d0aa0d95eef17020fa3 Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
2016-08-08audio: clean up before monitor clean upMarc-André Lureau1-8/+18
Since aa5cb7f5e, the chardevs are being cleaned up when leaving qemu, before the atexit() handlers. audio_cleanup() may use the monitor to notify of changes. For compatibility reasons, let's clean up audio before the monitor so it keeps emitting monitor events. The audio_atexit() function is made idempotent (so it can be called multiple times), and renamed to audio_cleanup(). Since coreaudio backend is using a 'isAtexit' code path, change it to check audio_is_cleaning_up() instead, so the path is taken during normal exit. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20160801112343.29082-3-marcandre.lureau@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-06-20coccinelle: Remove unnecessary variables for function return valueEduardo Habkost1-8/+2
Use Coccinelle script to replace 'ret = E; return ret' with 'return E'. The script will do the substitution only when the function return type and variable type are the same. Manual fixups: * audio/audio.c: coding style of "read (...)" and "write (...)" * block/qcow2-cluster.c: wrap line to make it shorter * block/qcow2-refcount.c: change indentation of wrapped line * target-tricore/op_helper.c: fix coding style of "remainder|quotient" * target-mips/dsp_helper.c: reverted changes because I don't want to argue about checkpatch.pl * ui/qemu-pixman.c: fix line indentation * block/rbd.c: restore blank line between declarations and statements Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1465855078-19435-4-git-send-email-ehabkost@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Unused Coccinelle rule name dropped along with a redundant comment; whitespace touched up in block/qcow2-cluster.c; stale commit message paragraph deleted] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-06-20Merge tag 'v2.6.0' into developSeokYeon Hwang1-11/+5
v2.6.0 release Change-Id: I76aaeae2ace35ddf6dbbd4c11436724688b01929 Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
2016-03-22util: move declarations out of qemu-common.hVeronia Bahaa1-0/+1
Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h) Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22Replaced get_tick_per_sec() by NANOSECONDS_PER_SECONDRutuja Shah1-2/+1
This patch replaces get_ticks_per_sec() calls with the macro NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec() is then removed. This replacement improves the readability and understandability of code. For example, timer_mod(fdctrl->result_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50)); NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns matches the unit of the expression on the right side of the plus. Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-08audio: support audio hot-plug event for WindowsByeongki Shin1-2/+12
Because dsound audio doesn't support audio endpoint event, it has failed to initialize without speaker or mic connection. Now, dsound supports audio endpoint event. Therefore, emulator can play sound even if a speaker is connected to host lately. - Because the COM initialization requires for each thread, in order to share the object, a thread is used as init and event handler. - When event occurs, the notification callback sends it to init thread. If we handle the event in notification callback, it would make deadlock. Change-Id: Iaeef62d6c5b0952f77f0040abea9bfc7778be536 Signed-off-by: Byeongki Shin <bk0121.shin@samsung.com>
2016-02-02audio: Clean up includesPeter Maydell1-0/+1
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1453138432-8324-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-01-13audio: Clean up inappropriate and unreachable use of hw_error()Markus Armbruster1-9/+2
audio_init() should not use hw_error(), because dumping CPU registers is unhelpful there, and aborting is wrong, because it can be called called from an audio device's realize() method. The two uses of hw_error() come from commit 0d9acba: * When qemu_new_timer() fails. It couldn't fail back then, and it can't fail now. Drop the unreachable error handling. * When no_audio_driver can't be initialized. It couldn't fail back then, and it can't fail now. Replace the error handling by an assertion. Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Markus Armbruster <armbru@pond.sub.org> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2015-10-30audio: remove W/A codes for winwaveaudiobk0121.shin1-31/+0
When sound is played without connecting of speaker on Windows, because winwaveaudio made process lock-up, the W/A were applied. However, qemu of tizen_3.0 does not support winwaveaudio, but, dsoundaudio for Windows host. And, as audio codes of qemu are updated, the W/A is no more valid code. Therefore, the W/A codes are removed. Change-Id: I63f4d73646f09b2af41238ce34102667f05f1d5e Signed-off-by: bk0121.shin <bk0121.shin@samsung.com>
2015-08-25upstream: some API was renamed and renewedSeokYeon Hwang1-1/+1
Change-Id: I6ec4c1eb026574b8a2ac96bdb128e84145aa16af Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
2015-08-24Merge tag 'v2.4.0' into tizen_3.0_qemu_2.4SeokYeon Hwang1-36/+3
v2.4.0 release Change-Id: Icc7e11d212e4628dc751ca77e17716c7253984e5 Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
2015-06-15audio: remove pliveKővágó, Zoltán1-12/+0
It was useless even 3 years ago, so it can probably safely go away: https://lists.nongnu.org/archive/html/qemu-devel/2012-03/msg02427.html Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15audio: remove LOG_TO_MONITOR along with default_monKővágó, Zoltán1-20/+3
Setting QEMU_AUDIO_LOG_TO_MONITOR=1 can crash qemu (if qemu tries to log to the monitor before it's being initialized), and also nothing else in qemu logs to the monitor. This log to monitor feature was the last thing that used the default_mon variable, so I removed it too (as using it can cause problems). Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-12-10Merge 'v2.2.0' into tizen_next_qemu_2.2SeokYeon Hwang1-2/+1
v2.2.0 release Conflicts: blockdev.c configure cpu-exec.c exec.c hw/Makefile.objs hw/i386/pc_piix.c qom/object.c target-i386/translate.c util/oslib-posix.c util/oslib-win32.c vl.c xen-hvm.c Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com> Change-Id: I0f708eddfb51b98b9a7453e6e92f20c90a8b5aaf
2014-05-14savevm: Remove all the unneeded version_minimum_id_old (rest)Juan Quintela1-2/+1
After previous Peter patch, they are redundant. This way we don't assign them except when needed. Once there, there were lots of case where the ".fields" indentation was wrong: .fields = (VMStateField []) { and .fields = (VMStateField []) { Change all the combinations to: .fields = (VMStateField[]){ The biggest problem (appart from aesthetics) was that checkpatch complained when we copy&pasted the code from one place to another. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2014-04-21Merge branch 'upstream_qemu_2.0' into tizenSeokYeon Hwang1-1/+1
Initial merge Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com> Conflicts: .gitignore Makefile.target block/raw-win32.c configure cpu-exec.c cpus.c hw/9pfs/virtio-9p-device.c hw/i386/pc_piix.c include/exec/cpu-defs.h include/qemu-common.h include/sysemu/sysemu.h include/ui/console.h tcg/i386/tcg-target.c tcg/tcg.h ui/console.c ui/input.c util/oslib-posix.c vl.c Change-Id: I52df9052942eea8d541bde75fd936e58a9f2f8ff
2013-12-11Merge branch 'upstream-1.7' into tizen_qemu_1.7SeokYeon Hwang1-3/+4
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com> Conflicts: VERSION block/cow.c block/raw-win32.c block/stream.c block/vmdk.c blockdev.c exec.c hw/i386/pc_piix.c hw/scsi/scsi-bus.c include/qom/cpu.h include/sysemu/kvm.h qemu-img.c tcg/tcg.c tcg/tcg.h vl.c Change-Id: Ib8de93ad2c05150934e17e63d7f8e90ffdfccc62
2013-12-09audio: Lower default wakeup rate to 100 times / secondHans de Goede1-1/+1
This is more then plenty to keep audio card fifos filles / emptied. This drops host cpu-load for audio playback inside a linux vm from 13% to 9%. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-10-23audio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* secondHans de Goede1-1/+2
Now that we no longer have MIN_REARM_TIMER_NS a bug in the audio subsys has clearly shown it self by trying to make a timer fire every nano second. Note we have a similar problem in 1.6, 1.5 and older but there MIN_REARM_TIMER_NS limits the wakeups caused by audio being active to 4000 times / second. This still causes a host cpu load of 50 % for simply playing audio, where as with this patch git master is at 13%, so we should backport this to 1.5 and 1.6 too. Note this will not apply to 1.5 and 1.6 as is. Cc: qemu-stable@nongnu.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-08-22aio / timers: Switch entire codebase to the new timer APIAlex Bligh1-3/+3
This is an autogenerated patch using scripts/switch-timer-api. Switch the entire code base to using the new timer API. Note this patch may introduce some line length issues. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-07-02Merge 'qemu 1.5.1' into tizen_qemu_1.5.1test1-5/+6
Conflicts: Makefile arch_init.h block/raw-win32.c blockdev.c configure console.h cpu-defs.h cpu-exec.c cpus.c default-configs/arm-softmmu.mak exec-all.h exec.c fpu/softfloat.h hw/9pfs/virtio-9p-device.c hw/Makefile.objs hw/acpi_piix4.c hw/apic_common.c hw/arm/Makefile.objs hw/exynos4210.c hw/exynos4210.h hw/exynos4210_fimd.c hw/exynos4210_gic.c hw/exynos4210_uart.c hw/pc.c hw/pc_sysfw.c hw/pci-hotplug.c hw/pci.c hw/pci.h hw/pl050.c hw/ps2.c hw/qdev-properties.c hw/qdev.c hw/qdev.h hw/vga-pci.c hw/vga-pci.h hw/vga_int.h hw/virtio-balloon.c hw/virtio-balloon.h hw/virtio-blk.c hw/virtio-blk.h hw/virtio-net.c hw/virtio-net.h hw/virtio-pci.c hw/virtio-pci.h hw/virtio-serial-bus.c hw/virtio-serial.h hw/virtio.c hw/virtio.h input.c kvm.h main-loop.c main-loop.h os-win32.c oslib-posix.c oslib-win32.c qemu-char.c qemu-options.hx qemu-sockets.c softmmu_defs.h softmmu_template.h sysemu.h tcg/i386/tcg-target.c tcg/tcg.c tcg/tcg.h vl.c
2013-01-16audio: Replace non-portable asprintf in debug code by g_strdup_printfStefan Weil1-2/+3
sw->name already uses the correct g_free to free the allocated memory. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19monitor: move include files to include/monitor/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-08Merge tag 'v1.2.0' into tizen-armEvgeny Voevodin1-0/+1
Tag for 1.2.0
2012-07-16audio: Unbreak capturing in mixemu casemalc1-0/+1
Signed-off-by: malc <av1474@comtv.ru>
2012-06-15Upgrade to upstream v1.1.0.Evgeny Voevodin1-7/+31
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
2012-05-24audio: Always call fini on exitJan Kiszka1-4/+8
Not only clean up enabled voices but any registered one. Backends like pulsaudio rely on unconditional fini handler invocations. This fixes "Memory pool destroyed but not all memory blocks freed!" warnings on VM shutdowns when pa is used and lockups of QEMU on shutdown as it got stuck on some pa-internal synchronization point. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: malc <av1474@comtv.ru>
2012-05-08[Title] Merge release-1.0 into develop branch to support hax feature.Kitae Kim1-0/+34
[Type] [Module] emulator [Priority] Major [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase]
2012-04-17audio: don't apply volume effect if backend has VOICE_VOLUME_CAPMarc-André Lureau1-2/+7
If the audio backend is capable of volume control, don't apply software volume (mixeng_volume ()), but instead, rely on backend volume control. This will allow guest to have full range volume control. Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
2012-04-17audio: add VOICE_VOLUME ctlMarc-André Lureau1-0/+12
Add a new PCM control operation to update the stream volume on the audio backend. The argument given is a SWVoiceOut/SWVoiceIn. v4: - verified other backends didn't fail/assert on this new control they randomly return 0 or -1, but we ignore return value. Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
2012-02-25audio: Add some fall through commentsStefan Weil1-0/+3
Static code analysers expect these comments for case statements without a break statement. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: malc <av1474@comtv.ru>
2011-12-14Fix spelling in comments, documentation and messagesStefan Weil1-1/+1
accidently->accidentally annother->another choosen->chosen consideres->considers decriptor->descriptor developement->development paramter->parameter preceed->precede preceeding->preceding priviledge->privilege propogation->propagation substraction->subtraction throught->through upto->up to usefull->useful Fix also grammar in posix-aio-compat.c Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-15Replace the VMSTOP macros with a proper state typeLuiz Capitulino1-1/+1
Today, when notifying a VM state change with vm_state_notify(), we pass a VMSTOP macro as the 'reason' argument. This is not ideal because the VMSTOP macros tell why qemu stopped and not exactly what the current VM state is. One example to demonstrate this problem is that vm_start() calls vm_state_notify() with reason=0, which turns out to be VMSTOP_USER. This commit fixes that by replacing the VMSTOP macros with a proper state type called RunState. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15Replace the VMSTOP macros with a proper state typeLuiz Capitulino1-1/+1
Today, when notifying a VM state change with vm_state_notify(), we pass a VMSTOP macro as the 'reason' argument. This is not ideal because the VMSTOP macros tell why qemu stopped and not exactly what the current VM state is. One example to demonstrate this problem is that vm_start() calls vm_state_notify() with reason=0, which turns out to be VMSTOP_USER. This commit fixes that by replacing the VMSTOP macros with a proper state type called RunState. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-15/+15
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-15/+15
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-21change all other clock references to use nanosecond resolution accessorsPaolo Bonzini1-2/+2
This was done with: sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. There was exactly one false positive in qemu_run_timers: - current_time = qemu_get_clock (clock); + current_time = qemu_get_clock_ns (clock); which is of course not in this patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21change all other clock references to use nanosecond resolution accessorsPaolo Bonzini1-2/+2
This was done with: sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. There was exactly one false positive in qemu_run_timers: - current_time = qemu_get_clock (clock); + current_time = qemu_get_clock_ns (clock); which is of course not in this patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-01-12audio: split sample conversion and volume mixingMichael Walle1-5/+6
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>
2011-01-12audio: split sample conversion and volume mixingMichael Walle1-5/+6
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>
2010-11-18audio: Only use audio timer when necessarymalc1-14/+10
Originally proposed by Gerd Hoffmann. Signed-off-by: malc <av1474@comtv.ru> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-18audio: Only use audio timer when necessarymalc1-14/+10
Originally proposed by Gerd Hoffmann. Signed-off-by: malc <av1474@comtv.ru> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-09spice: add audioGerd Hoffmann1-0/+3
Add support for the spice audio interface. With this patch applied audio can be forwarded over the network from/to the spice client. Both recording and playback is supported. The driver is first in the driver list, but the can_be_default flag is set only in case spice is active. So if you have the spice protocol enabled the spice audio driver is the default one, otherwise whatever comes first after spice in the list. Overriding the default using QEMU_AUDIO_DRV works in any case. [ v2: audio codestyle: add spaces before open parenthesis ] [ v2: add const to silence array ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Cc: malc <av1474@comtv.ru> Signed-off-by: malc <av1474@comtv.ru>
2010-11-09spice: add audioGerd Hoffmann1-0/+3
Add support for the spice audio interface. With this patch applied audio can be forwarded over the network from/to the spice client. Both recording and playback is supported. The driver is first in the driver list, but the can_be_default flag is set only in case spice is active. So if you have the spice protocol enabled the spice audio driver is the default one, otherwise whatever comes first after spice in the list. Overriding the default using QEMU_AUDIO_DRV works in any case. [ v2: audio codestyle: add spaces before open parenthesis ] [ v2: add const to silence array ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Cc: malc <av1474@comtv.ru> Signed-off-by: malc <av1474@comtv.ru>
2010-07-06savevm: Add DeviceState paramAlex Williamson1-1/+1
When available, we'd like to be able to access the DeviceState when registering a savevm. For buses with a get_dev_path() function, this will allow us to create more unique savevm id strings. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06savevm: Add DeviceState paramAlex Williamson1-1/+1
When available, we'd like to be able to access the DeviceState when registering a savevm. For buses with a get_dev_path() function, this will allow us to create more unique savevm id strings. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-16monitor: Separate "default monitor" and "current monitor" cleanlyMarkus Armbruster1-2/+2
Commits 376253ec..731b0364 introduced global variable cur_mon, which points to the "default monitor" (if any), except during execution of monitor_read() or monitor_control_read() it points to the monitor from which we're reading instead (the "current monitor"). Monitor command handlers run within monitor_read() or monitor_control_read(). Default monitor and current monitor are really separate things, and squashing them together is confusing and error-prone. For instance, usb_host_scan() can run both in "info usbhost" and periodically via usb_host_auto_check(). It prints to cur_mon, which is what we want in the former case: the monitor executing "info usbhost". But since that's the default monitor in the latter case, it periodically spams the default monitor there. A few places use cur_mon to log stuff to the default monitor. If we ever log something while cur_mon points to current monitor instead of default monitor, the log temporarily "jumps" to another monitor. Whether that can or cannot happen isn't always obvious. Maybe logging to the default monitor (which may not even exist) is a bad idea, and we should log to stderr or a logfile instead. But that's outside the scope of this commit. Change cur_mon to point to the current monitor. Create new default_mon to point to the default monitor. Update users of cur_mon accordingly. This fixes the periodical spamming of the default monitor by usb_host_scan(). It also stops "log jumping", should that problem exist.