summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-loop.c
AgeCommit message (Collapse)AuthorFilesLines
2019-05-13alsa-transaction: simplify the cleanupThierry Bultel1-1/+1
This simplifies the invocation of cleanup, by only using AlsaMixerTransactionDelete that performs the 3 actions of cleanup, removal from list, and memory freeing. Fixes a bug at MixerExit, because the first transaction was not removed from the list and led to a double free error. Also added a boolean parameter to AlsaMixerTransactionObjectDelete (was AlsaMixerTransactionObjectForget before), that decides wether or not the found object must be destroyed with its destructor (for most of the cases) or simply freed in memory (which is needed for loop device). Change-Id: I2eacbf80a22e3d556dc432d393a1807fcd7c47fb Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2019-04-09Updates for latest libavirt, adds avirt cleanupguppy_7.0.1guppy/7.0.17.0.1Mark Farrugia1-3/+8
Cleanup for avirt is introduced. There are still some issues with this when invoked whilst a PCM is active, This now allows 4A to be restarted without a reboot. Loops must be deleted last to avoid any cleanup issues, so to enforce this a new transaction API is added: AlsaMixerTransactionObjectAddTail. Change-Id: Ide4bbb319e8c6a2f4209ab957d80a54690f76de4 Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-04-05Fix a SIGSEGV during initializationJosé Bollo1-10/+8
During the initialisation of 4a-softmixer, when the function 'ProcessOneAvirtSubdev' fails, the function 'AttachOneLoop' was crashing because it tried to call 'snd_ctl_close' with a NULL pointer. This change fixes it. A test is introduced because depending on the kind of loop, the order of initialization of control versus subdevs differs. At the same time, some gotos are improved to avoid a dummy test -this are also virtual fixes-. Also a tiny refactor of the 3 times declared variable 'subdev' is expected to improve the readability. Bug-AGL: SPEC-2287 Change-Id: Ie5231a1064090d772ea0ea7d86ad8c8d79b38d72 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-10Add support for AVIRTMark Farrugia1-73/+235
Leverage the new AVIRT driver for a more secure, more dynamically configurable loopback sound driver. To use, replace the file smixer-4a-default.json with smixer-4a-avirt.json, at /usr/libexec/agl/smixer/etc The existing snd-aloop configuration is not broken by this change. The submodule libavirt is temporary, and will be transformed into a library. Change-Id: I827636656c109a7393ad77997e05069a2462ea46 Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-12-22Implemented the bug cleanup at application exitStephane Desneux1-19/+43
Fixes most memory leaks in softmixer. The concept of 'transaction' for dynamic streams has been generalized to the objects created at startup. The cleanup is done via a handle set through a atexit() call. Also added a missing strdup in alsa-api-loop, that fixes a double free. Warning, the bluez-alsa PCM are not closed in this version. This is intentional due to a BUG in the bluealsa ioplug PCM, that crashes upon close (pthread_cancel is used to terminate the io_thread and things get very bad. I have a pending fix for that, relying on a cancellation pipe, but deeper testing must be done). As an effect, only one phone call can be made, else 4a needs to be restarted Change-Id: Idb84cafe15f17c0ef02fcc70296d541dc55a2dcf Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh> Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
2018-12-19Add support for bluetooth telephonyguppy_6.99.3guppy/6.99.36.99.3Thierry Bultel1-69/+178
This adds support for bluetooth telephony. A big rework in the softmixer internals has been mandatory, in order to support dynamic streams creation and deletions. Bluetooth telephony relies on the recent evolutions of bluez-alsa, the most important one being the support of HFP over Ofono. The softmixer opens PCM ioplugs provided by bluez-alsa. Bluetooth SCO needs 2 streams, one for listening and the other for talking. These streams are created upon requests sent by the hal-manager. The hal manager subscribes for bluez-alsa events and request the list of availalble transports. For each "attach" transaction verb, the softmixer maintains a list of the all created objects (sources, sinks, zones, ramps, streams, and more) Additionnally, it creates a new verb when the attach succeeds, that verb is typically something like "sco_XX:XX:XX:XX:XX:XX", and the only supported action at the present time is {"action":"remove"}, that performs all the cleanup of the registered objects. Change-Id: I1b119e6c079e60daf771e63c083a1ef33a39f379 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-11-08Fix the error string of attach actionsThierry Bultel1-5/+9
Fixes the "syntax-error" to something more explicit (SPEC-1906) Change-Id: I9d4c81ee1d62dcfb99799480c6dc910e2019a791 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-08-31Added bluez sound playback supportThierry Bultel1-0/+1
This adds sound playback for incoming sound from connected bluetooth devices. In this version, the softmixer relies on a modified bluez-alsa version (https://github.com/iotbzh/bluez-alsa), that provides an ioplug PCM bluezalsa connection proxy. The softmixer api has a new verb to dynamically set the device to listen to: afb-client-demo ws://localhost:1234/api?token=\uuid=123 smixer bluezalsa_dev '{"interface":"hci0", "device":"F6:32:15:2A:80:70", "profile":"a2dp"}' In this way it is possible to switch from a bluezalsa audio source to another without any further configuration. For now, only interface hci0 is supported. This commit also migrates the softmixer binding to API v3 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-10Added stream/ramp return to fit HAL attach requestfulup1-2/+0
2018-06-10Cleanup and added return of previous volume when setting new valuefulup1-6/+6
2018-06-04Fixed json parsing format errorsThierry Bultel1-2/+2
The expected format did not match the parameters Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-04Move to Dynamic Mixer API (work in progress)Fulup Ar Foll1-0/+205