aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-09-05Merge pull request #244 from rohit-qc/chmap_mixer_supportdvdli
Chmap mixer support
2023-09-04mixer: add support for pcm device specific mixer controlsRohit kumar
Mixer control such as "Playback channel map" can be registered by multiple pcm device nodes and is distinguished by device in snd_ctl_elem_id. Add support to get the control handle associated with mixer ctl name and device number. Also, introduce API to get the device number associated with specific mixer_ctl handle.
2023-09-04Support pcm drain opsGuodong Hu
Signed-off-by: Guodong Hu <quic_guodhu@quicinc.com>
2022-07-26pcm: Propagate error message to the bad_pcm in case of failureRoman Stratiienko
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-05-24match the boundary type with kernel driverdvdli
1. Remove calculation of boundary and retrieve boundary from ALSA kernel. Also fix type when getting available and advance appl_ptr. 2. Fix avail in pcm_mmap_transfer getting overflow. 3. Fix typo.
2022-01-11include time.h before asound.hFabrice Fontaine
Include time.h before asound.h to avoid the following build failure on musl that was already fixed a long time with https://github.com/tinyalsa/tinyalsa/commit/c8333f8c7a4e4b9549abeef7530b2cd20a18e537 but reappeared on version 2.0.0: In file included from ../src/pcm_hw.c:42: /home/peko/autobuild/instance-1/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/sound/asound.h:444:18: error: field 'trigger_tstamp' has incomplete type 444 | struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ | ^~~~~~~~~~~~~~ Fixes: - http://autobuild.buildroot.org/results/a75e23dc585bd071f4d65face5489ed6ac22edbe Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-12-15add ioctl to read IEC958 datadvdli
2021-11-23insert null at end of strncpy target array.toge
2021-11-17fix strncpy warningstoge
2021-11-02mixer: fix index underflow when index=0Caleb Connolly
In mixer_get_ctl_by_name_and_index(), the post-fix decrement means that the index will be decremented after the comparison, but before the return, leading to an unsigned integer underflow. This causes a crash on platforms with -fsanitize=integer enabled. Fix this by avoiding decrementing index until after the return. Change-Id: I25a17ced4185bdebd500285bd30b342b16b4ac12
2021-07-15update NOTICE file and format license headerdvdli
2021-07-13fix the zero fd closing problemdvdli
The pcm_hw_close refused to close the zero fd. Add "equal to" condition and modify the type of fd to int to close the zero fd.
2021-06-02force pcm_open to open device with the non-blocking flagdvdli
When a client opens a PCM device whose substreams are all occupied without the non-blocking flag, the open function would be blocked in the kernel until the previous opened ones are closed. This would cause deadlock if they try to hold the same lock. Most of the ALSA PCM drivers on embedded systems are implemented with the ALSA SOC framework. Each PCM device has only one substream. This problem would happen frequently. To force pcm_open to open PCM devices with non-blocking flag is beneficial to resolve this problem. It returns the control to clients to try again later. The reason why we don't call pcm_open with PCM_NONBLOCK is that the PCM_NONBLOCK also affects the read and write behaviors. I also add a test case to test whether the pcm_open would be blocked.
2021-05-19remove range checking in mixer_ctl_set_valuedvdli
There are some drivers assigning wrong ranges of mixer control's values. Let ALSA drivers to check whether values are in ranges.
2021-05-19refine null parameters checking and add a unit test casedvdli
2021-05-19add pcm_prepare before pcm_startdvdli
2021-03-11add floating-point PCM supoort to tinyplaydvdli
This change also fixes overwriting the appl_ptr and avail_min when calling the pcm_state function.
2021-02-22support float config and float wave file playbackdvdli
2021-01-28Let pcm_mmap_read/write call pcm_readi/writeidvdli
The pcm_readi and pcm_writei also can deal with the mmap read/write. Also mark the pcm_mmap_read/write functions as deprecated functions and update the test case. Add mmap playback support to tinyplay
2021-01-28prepare in pcm_generic_transferdvdli
2021-01-12remove pcm_prepare in pcm_opendvdli
For the dynamic pcm device, it is valid to specify the backend after opening it. However, it is invalid to call prepare on a dynamic pcm device without connecting any backend device. We should not do pcm_prepare in pcm_open. See also: Issue #197
2020-12-09fix mmap-related functions' bugsdvdli
1. sync hw ptr before calculating the avail 2. return zero when reading or writing successfully
2020-12-09fix bugs in the pcm_open_* functionsdvdli
1. Align the document and the code. 2. Copy error messages to bad_pcm object for client to get more info when opening failed.
2020-12-02fix build breakageDavid Li
1. Add a missing field and a function 2. Disable the deprecated attribute in Android temporarily to allow us to use "pcm_read/write" which are deprecated upstream 3. Remove an unused define and an include in mixer.h 4. Add mixer_ctl_event and copy the snd_ctl_event to mixer_ctl_event 5. Add pcm_ioctl function and mark as deprecated function
2020-11-04Merge pull request #189 from wksuper/masterdvdli
Backward compatible for pcm_write() pcm_read()
2020-11-01Backward compatible for pcm_write() pcm_read()Kui Wang
Current return value of pcm_write()/pcm_read() comes from pcm_writei()/pcm_readi() which is the actual frames written/read. But the old pcm_write() /pcm_read() just returns 0 on success and a nagative value on error. This change will keep the pcm_write()/pcm_read() as the old behavior which has been already used by many applications, and is also matching the comment above each function. Signed-off-by: Kui Wang <wangkuisuper@hotmail.com>
2020-10-29AOSP CL "tinyalsa: check for NULL mmap_status"dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/62644f7a3c4cfa18d7935f731cf59b675669d17a commit 62644f7a3c4cfa18d7935f731cf59b675669d17a author Phil Burk <philburk@google.com> tinyalsa: check for NULL mmap_status pcm_mmap_get_hw_ptr() was not checking pcm->mmap_status and crashed when it was NULL. Bug: 64346189 Test: input_monitor.cpp, see bug report for repro steps Change-Id: I8436686a231eb01a82dd28ca2cce561d5460bcd6
2020-10-29AOSP CL "pcm: Fix usage of oops() function for use of strerror."dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/50028cd233f8cf8a084e950c951eefc01e1cd15c commit 50028cd233f8cf8a084e950c951eefc01e1cd15c author John Muir <muirj@google.com> pcm: Fix usage of oops() function for use of strerror. The oops() function expected errno to be passed in, but at some point it was broken to look at errno itself, and ignore the passed-in value. Fix the oops() function to check the passed-in value, and modify uses of oops() to actually pass in errno and not -errno or the return value from the errored function call. Bug: None Test: pcm error code printed correctly. Change-Id: I555e1eda0cdd0cc9b94e05423d341f1c08f8e485 (cherry picked from commit 2c1d902ace5f78dcff0c39740642d269b2e17dff) Note: the oops in pcm_mmap_transfer was removed.
2020-10-28AOSP CL "pcm: add API for MMAP NO IRQ mode"dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/5b15b4cbd9e779a4ecd87e0f757fb0f8f6b9bcb8 commit 5b15b4cbd9e779a4ecd87e0f757fb0f8f6b9bcb8 author Eric Laurent <elaurent@google.com> pcm: add API for MMAP NO IRQ mode Bug: 33398120 Test: build Change-Id: Iecb47f76337d98ceb01044ca488a04e1f350c6bc
2020-10-28AOSP CL "Add pcm_get_poll_fd"dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/b42510d55bafc96805a44bd6ac40faac28ebd219 commit b42510d55bafc96805a44bd6ac40faac28ebd219 author Dylan Reid <dgreid@chromium.org> Add pcm_get_poll_fd Similar to ALSA snd_pcm_get_poll_fd, this will allow a user to wait for a sound device to have data in a poll(2) call. The hotword thread will use this to wait for a message on its socket or for audio data to become ready. Change-Id: I61375a73d7a842b00362fc707c12f99aa18e0bdf Signed-off-by: Dylan Reid <dgreid@chromium.org>
2020-10-28AOSP CL "Export pcm_mmap_avail"dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/9074cfc4127cb841f0633b35895141f90da3f0d6 commit 9074cfc4127cb841f0633b35895141f90da3f0d6 author Dylan Reid <dgreid@chromium.org> Export pcm_mmap_avail This is useful for timer based wakeups and for checking how much data has been captured by a hotwording device. Change-Id: I409201a5c9ce73abc807a9dd767beb3a32810f06 Signed-off-by: Dylan Reid <dgreid@chromium.org>
2020-10-28AOSP CL "tinyalsa: channel status set as per IEC958"dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/49a61374fc18a0f39da0d9c11cc9ccc3e9c1ec3f commit 49a61374fc18a0f39da0d9c11cc9ccc3e9c1ec3f author Yogesh Agrawal <yagrawal@nvidia.com> tinyalsa: channel status set as per IEC958 Add support for modifying the IEC958 structure in a mixer_ctl. Bug: 9428304 Bug: 22576112 Change-Id: I8982340da9403a8a9e36b389fc97e9c635a9f681
2020-10-28AOSP CL "pcm: add support to set silence_size"dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/e25fe0b50ea717a9f347dcb927d396e8772e6362 commit e25fe0b50ea717a9f347dcb927d396e8772e6362 author Maneet Singh <mmaneetsingh@nvidia.com> pcm: add support to set silence_size Tinyalsa always set silence_size to zero. Add support to set this pcm software parameter as required. Bug: 20226809 Bug: 20300203 Change-Id: I25de43623dc04bf5a3ad4c6573bc2b8dad1eec5e
2020-10-28AOSP CL "Add pcm_params string conversion and format checking"dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/70530a69767a9a383c5bf546e6e803aac08a5a1e%5E!/ title: Add pcm_params string conversion and format checking commit 70530a69767a9a383c5bf546e6e803aac08a5a1e author Andy Hung <hunga@google.com>
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.