Age | Commit message (Collapse) | Author |
|
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
|
|
|
|
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.
|
|
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.
|
|
There are some drivers assigning wrong ranges of mixer control's values.
Let ALSA drivers to check whether values are in ranges.
|
|
|
|
|
|
This change also fixes overwriting the appl_ptr and avail_min when calling
the pcm_state function.
|
|
|
|
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
|
|
|
|
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
|
|
1. sync hw ptr before calculating the avail
2. return zero when reading or writing successfully
|
|
1. Align the document and the code.
2. Copy error messages to bad_pcm object for client to get more info
when opening failed.
|
|
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
|
|
Backward compatible for pcm_write() pcm_read()
|
|
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>
|
|
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
|
|
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.
|
|
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
|
|
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>
|
|
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>
|
|
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
|
|
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
|
|
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>
|
|
Fix mixer set/get for tlv based controls
|
|
|
|
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.
|
|
TTstamp ops is called from pcm_open. Update state check
to avoid failure.
|
|
|
|
PCM state is currently not updated in plugin.
Add support to update the state variable.
|
|
|
|
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
|
|
|
|
Mixer event plugin update
|
|
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.
|
|
snd_ctl_event is needed by client to get details of event received.
Introduce mixer_read_event() with plugin support to support this.
|
|
mixer_consume_event consumes subscribed events from the mixer
in order to allow monitoring of mixer control value changed.
|
|
MAP_FILE is a non-standard mmap flag, and has no effect on conformant
systems.
|
|
There does not really seem to be an usage for these dummy string,
so let's remove them.
|
|
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.
|
|
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>
|
|
pcm: avoid calling pcm_hw->close() twice
|
|
sterror() surely doesn't appreciate that:
cannot set hw params: Unknown error -22
where it should've been:
cannot set hw params: Invalid argument
|
|
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)
|
|
Plugin support
|
|
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>
|
|
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>
|
|
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>
|
|
pcm: Allow to wait if capture is not running
|