aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2020-09-21Merge pull request #173 from rohkkumar/mixer_fixSimon Wilson
Fix mixer set/get for tlv based controls
2020-09-16Fix Makefile dependenciesGlenn Kasten
2020-09-04mixer: Fix invalid size check in mixer_ctl_set/get_arrayRohit kumar
For TLV based mixer controls, mixer_ctl_set/get_array adds TLV headers in the API itself. Size check for count need not include tlv header size addition. Remove it to fix size check.
2020-09-03pcm_plugin: Update pcm state check in ttstamp opsRohit kumar
TTstamp ops is called from pcm_open. Update state check to avoid failure.
2020-09-03tinyalsa: add plugin support for mmap/poll opsRohit kumar
2020-08-25pcm_plugin: Update pcm state in sync_ptr opsRohit kumar
PCM state is currently not updated in plugin. Add support to update the state variable.
2020-08-12Fixed boundary check for enumTaylor Holberton
2020-06-05cmake: specify c99Ethan Sommer
Set standard to c99, require it, disable language extensions. Define _POSIX_C_SOURCE to 200809L so time.h declares struct timespec. Add -Wpedantic to find use of language extensions. snd_card_plugin.c: remove one unnecessary ';' to make -Wpedantic work
2020-06-03Fix memory leakTaylor Holberton
2020-06-03Merge pull request #159 from rohkkumar/plugin_updateTaylor Holberton
Mixer event plugin update
2020-06-02mixer: Fix memory leak and other issues in mixer eventRohit kumar
Fix memory leak in mixer_wait_event(). Also, poll should be unblocked after increasing event_cnt in mixer_plugin, otherwise event_cnt can become negative during read_event. Fix the same.
2020-06-02mixer: Add plugin support for mixer_consume/read_eventRohit kumar
snd_ctl_event is needed by client to get details of event received. Introduce mixer_read_event() with plugin support to support this.
2020-06-02tinyalsa: add mixer_consume_eventAndrew Chant
mixer_consume_event consumes subscribed events from the mixer in order to allow monitoring of mixer control value changed.
2020-05-24src/pcm.c: remove MAP_FILE mmap flagEthan Sommer
MAP_FILE is a non-standard mmap flag, and has no effect on conformant systems.
2020-04-24tinyalsa: mixer_plugin: remove dummy strings for sound cardMinecrell
There does not really seem to be an usage for these dummy string, so let's remove them.
2020-04-23tinyalsa: use strncpy instead of memcpy to copy string constantMinecrell
memcpy() is arguably wrong when copying these string constants. The string constants will usually just be as long as necessary, so we might copy some random memory behind it and eventually crash. Use strncpy() instead to avoid copying characters after the null terminator. For some reason the strings in snd_ctl_card_info use unsigned chars, so we need a cast to char* to make it compile unfortunately... This fixes the following compile error on ppc64le: In function 'mixer_plug_get_card_info', inlined from 'mixer_plug_ioctl' at mixer_plugin.c:371:15: mixer_plugin.c:333:5: error: 'memcpy' forming offset [9, 16] is out of the bounds [0, 8] [-Werror=array-bounds] 333 | memcpy(card_info->id, "card_id", sizeof(card_info->id)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Not sure why that warning does not exist on other architectures.
2020-04-18pcm_hw_close: avoid SIGSEGV when pcm_hw_open failMiguel GAIO
Prevent the call to pcm->ops-close() if pcm->ops->open() fail. Fix memory leak in pcm_hw_open() in case of failure. * thread #1, name = 'ut', stop reason = signal SIGSEGV: invalid address (fault address: 0x8) frame #0: 0x00007ffff7f863e8 libtinyalsa.so.1`pcm_hw_close(data=0x0000000000000000) at pcm_hw.c:61:21 58 { 59 struct pcm_hw_data *hw_data = data; 60 -> 61 if (hw_data->fd > 0) 62 close(hw_data->fd); 63 64 free(hw_data); (lldb) bt * thread #1, name = 'ut', stop reason = signal SIGSEGV: invalid address (fault address: 0x8) * frame #0: 0x00007ffff7f863e8 libtinyalsa.so.1`pcm_hw_close(data=0x0000000000000000) at pcm_hw.c:61:21 frame #1: 0x00007ffff7f8491c libtinyalsa.so.1`pcm_close(pcm=0x0000000000a9eba0) at pcm.c:820:5 frame #2: 0x00007ffff7f84e0a libtinyalsa.so.1`pcm_open(card=128, device=0, flags=13, config=0x00007fffffffd000) at pcm.c:957:5 Signed-off-by: Miguel GAIO <mgaio35@gmail.com>
2020-04-10Merge pull request #148 from lkundrak/lr/double-freeTaylor Holberton
pcm: avoid calling pcm_hw->close() twice
2020-04-10pcm: do not negate errnoLubomir Rintel
sterror() surely doesn't appreciate that: cannot set hw params: Unknown error -22 where it should've been: cannot set hw params: Invalid argument
2020-04-10pcm: avoid calling pcm_hw->close() twiceLubomir Rintel
It would result in a double free: $ tinyplay example.wav failed to open for pcm 0,0 *** glibc detected *** ./utils/tinyplay: double free or corruption (fasttop): 0x402dc258 *** Aborted $ The crash happens here: Program received signal SIGABRT, Aborted. 0x40070e78 in raise () from /lib/libc.so.6 Missing separate debuginfos, use: debuginfo-install glibc-2.16-34.olpc.0.fc18.armv7hl libgcc-4.7.2-8.fc18.armv7hl (gdb) bt #0 0x40070e78 in raise () from /lib/libc.so.6 #1 0x400724b8 in abort () from /lib/libc.so.6 #2 0x400ad6e0 in ?? () from /lib/libc.so.6 #3 0x400b54e8 in ?? () from /lib/libc.so.6 #4 0x2a00486c in pcm_hw_close () #5 0x2a0032e0 in pcm_close () #6 0x2a0016b0 in ctx_init () #7 0x2a000c98 in main () (gdb) The previous free was done here: Breakpoint 1, 0x400b8b8c in free () from /lib/libc.so.6 (gdb) bt #0 0x400b8b8c in free () from /lib/libc.so.6 #1 0x2a00486c in pcm_hw_close () #2 0x2a003674 in pcm_open () #3 0x2a0015e8 in ctx_init () #4 0x2a000c98 in main () (gdb)
2020-02-11Merge pull request #137 from codeauroraforum/plugin-supportTaylor Holberton
Plugin support
2020-02-07tinyalsa: add support for mixer pluginsBhalchandra Gajare
Update the mixer framework to support plugins. Add ability for physical card to have either kernel registered mixer controls or plugin registered mixer control or both. Split mixer controls into two groups, one for kernel registered (hw_grp) and the other for plugin registered (virtual_grp). Signed-off-by: Rohit kumar <rohitkr@codeaurora.org> Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2020-02-07tinyalsa: add support for PCM pluginsBhalchandra Gajare
Update the pcm framework to support plugins. Resolve the pcm device node to be either kernel device or virtual device and setup function pointers accordingly. Implement framework functionality for pcm_plugin.c for ease of plugin development. Plugin itself is compiled as shared object (.so) and dynamically linked from pcm_plugin.c. Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org> Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
2020-02-06pcm: Set SW params.avail_min to period sizeMiguel GAIO
Using MMAP APIs, this parameter wake up application when 'avail_min' samples are availables. When audio processing expects exactly a full period size samples, the default parameter to 1 burns CPU until the full period available. Fix SW params.avail parameter to period size value. Signed-off-by: Miguel GAIO <mgaio35@gmail.com>
2019-07-07Merge pull request #131 from pasqualirb/masterTaylor Holberton
pcm: Allow to wait if capture is not running
2019-05-11makefile: Don't overwrite CROSS_COMPILE variableLucas Tanure
Signed-off-by: Lucas Tanure <tanure@linux.com>
2019-04-24pcm: Allow to wait if capture is not runningRicardo Biehl Pasquali
This allows starting capture from another thread. See the commit 932a81519572 ("ALSA: pcm: Comment why read blocks when PCM is not running") in Linux kernel. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-04-13Merge pull request #128 from alexonea/masterTaylor Holberton
Easier Version Specification
2019-04-12pcm: Remove setting unnecessary parametersRicardo Biehl Pasquali
SUBFORMAT is always zero. SAMPLE_BITS and FRAME_BITS are refined by ALSA based on the already set FORMAT and CHANNELS. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-04-12Fix integer division issue in int_to_percent functionDaniela-Marinela Bistrean
Changed order of operations to preserve the precision during the division.
2019-04-09Initial version-bump.shAlexandru N. Onea
2019-01-08pcm: Check for error after setting appl_ptrRicardo Biehl Pasquali
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Cleanup control/status when setup failsRicardo Biehl Pasquali
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Replace 'underruns' with 'xruns'Ricardo Biehl Pasquali
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Create generic transferRicardo Biehl Pasquali
Group read/write transfer into pcm_rw_transfer(). Create pcm_generic_transfer() for read/write and mmap transfer modes. This recovers from xrun and suspended. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Put transfer functions togetherRicardo Biehl Pasquali
A generic transfer function will be created. Put together functions related to it. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Remove 'running' variable from pcm structureRicardo Biehl Pasquali
It is not needed. As the pcm structure is opaque to user it can be safely removed. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Rewrite pcm_mmap_transfer() for compatibilityRicardo Biehl Pasquali
Make pcm_mmap_transfer() compatible with read/write IO. start_threshold check was not valid for capture. pcm->running checks were removed. NOIRQ fallback was removed. Clocks of sound devices may differ from the system, leading to desynchronization. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Exit loop when there are no available framesRicardo Biehl Pasquali
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Put mmap functions togetherRicardo Biehl Pasquali
pcm_mmap_transfer() will be rewritten. Put together functions related to mmap transfer. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Rewrite pcm_get_htimestamp()Ricardo Biehl Pasquali
Use pcm_avail_update(), check avail for timestamp coherence. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Move pcm_get_htimestamp()Ricardo Biehl Pasquali
pcm_get_htimestamp() will be rewritten. Place it after pcm_avail_update(), which will be used in the rewrite. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Get values from kernel in avail_updateRicardo Biehl Pasquali
Instead of sending appl_ptr and avail_min to the kernel, get them. This is the behavior of alsa-lib. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Call HWSYNC ioctl when status is mmapedRicardo Biehl Pasquali
When hardware pointer update is requested and status structure is mmaped, call HWSYNC ioctl. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Remove HWSYNC before available calculationRicardo Biehl Pasquali
Hardware pointer should not be updated in available calculation. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Do not set values after control/status mmapRicardo Biehl Pasquali
It's not necessary to send appl_ptr or avail_min to the kernel here. In prepare action, called later in pcm_open(), appl_ptr becomes zero. avail_min is already defined in software parameters. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Get appl_ptr and avail_min after prepareRicardo Biehl Pasquali
appl_ptr becomes zero in prepare action. avail_min is the same as when it was set in software parameters. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Remove 'prepared' variable from pcm structureRicardo Biehl Pasquali
It is not needed. As the pcm structure is opaque to user it can be safely removed. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Remove prepare before startRicardo Biehl Pasquali
Prepare is done in pcm_open(). Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08pcm: Remove start before readRicardo Biehl Pasquali
Start is done by kernel when start_threshold or more frames are requested. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>