Commit graph

364 commits

Author SHA1 Message Date
Peter Ujfalusi
cbebb86a56 aplay: Print '=== PAUSE ===' only if it is supported
Instead of printing the '=== PAUSE ===' unconditionally before calling
do_pause(), move it to the function and only print it if the stream can
be paused.

If the stream cannot be paused that the '=== PAUSE ===' will be replaced
by `PAUSE command ignored (no hw support)` immediately, which is not
observable by users but automation scripts will catch the '=== PAUSE ==='
and might think that the stream is indeed got paused.

Move the print into do_pause() function after the snd_pcm_pause() have
returned without error to make sure it is only printed if the stream is
paused and we are waiting for the pause release from user to proceed.

Closes: https://github.com/alsa-project/alsa-utils/pull/271
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-08-06 18:37:51 +02:00
Peter Suti
9cdcbe0e93 aplay: fix S24_LE wav header
S24_LE is 32 bits in width storing 24 bits of data and 8 bits of padding
So wav header needs to be 32 bits not 24

Closes: https://github.com/alsa-project/alsa-utils/pull/260
Signed-off-by: Peter Suti <peter.suti@streamunlimited.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-04-17 12:05:59 +02:00
Jaroslav Kysela
827905c002 aplay: status dumps are called only in verbose mode
Do not enable timestamps for the normal operation.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-12 15:07:22 +01:00
Pierre-Louis Bossart
35f45c50ee aplay: enable timestamps by default
When the '-v' or '--test-position' options are used, the 'tstamp' is
shown as zero. Unconditionally enable the timestamps and choose the
timestamp time based on the 'monotonic' variable.

Example log:

Status(R/W) (standalone avail=36 delay=924):
  state       : RUNNING
  trigger_time: 2045.504937
  tstamp      : 2190.754602
  delay       : 924
  avail       : 36
  avail_max   : 444
Status(R/W) (standalone avail=44 delay=912):
  state       : RUNNING
  trigger_time: 2045.504937
  tstamp      : 2190.754852
  delay       : 912
  avail       : 48
  avail_max   : 48
underrun!!! (at least 471.161 ms long)
Status:
  state       : XRUN
  trigger_time: 2190.786234
  tstamp      : 2191.257392
  delay       : 0
  avail       : 1412
  avail_max   : 1412
aplay: xrun:1690: fatal underrun: Success

Closes: https://github.com/alsa-project/alsa-utils/pull/242
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-12 14:25:37 +01:00
Pierre-Louis Bossart
6e9be2a3f3 aplay: log pcm status before reporting a fatal error
When the --fatal-errors happen, nothing is provided to the user even
when the '-v' verbose option is specified. This patch adds the fatal
error exit after dumping the logs. No functionality change, just
better information on what just happened.

Closes: https://github.com/alsa-project/alsa-utils/pull/242
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-12 14:25:23 +01:00
Jaroslav Kysela
8e6351f19d aplay: allow to compile with older alsa-lib (subformat)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-12 13:47:03 +01:00
Cezary Rojewski
d55cd9fcd9 aplay: Add option for specifying subformat
Make subformat first-class citizen by allowing users to specify it just
like it is the case for the format. Default to SND_PCM_SUBFORMAT_STD so
they are no surprises.

Closes: https://github.com/alsa-project/alsa-utils/pull/228
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-12 12:44:03 +01:00
Mingjie Shen
4ce6a0a4af aplay: fix buffer overflow and tainted format string
Prior this commit, memcpy from names[0] to format[] will overwrite if
strlen(names[0]) is greater than 1024. Also, the length of malloc()ed
names[channel] is insufficient, leading to another buffer overwriting
when calling sprintf(). Moreover, the format string of sprintf()
can be controlled by user input. An attacker can exploit this weakness
to crash the program, disclose information or even execute arbitrary
code.

Fix by allocating enough space for arrays and using constant expressions
as the format strings.

Fixes: https://github.com/alsa-project/alsa-utils/pull/246/
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-08 20:00:13 +01:00
Jaroslav Kysela
37447085c6 aplay: use stdint.h types instead u_int/u_short/u_char
Closes: https://github.com/alsa-project/alsa-utils/pull/234
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-10-17 13:45:42 +02:00
Jaroslav Kysela
df0b85aa4f aplay: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:34:36 +02:00
Tj
42bba8ac61 arecord: use correct duration
When a duration is specified but the the capture device cannot use the
requested sample rate and an alternative rate is used the duration
sample count must be (re)calculated.

Fixes: https://github.com/alsa-project/alsa-utils/pull/200
Signed-off-by: Tj <hacker@iam.tj>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-03 16:26:22 +02:00
SASANO Takayoshi
613372dc7c Add OpenBSD support
- ERESTART not supported platform: use EINTR instead
- add include/os_compat.h, well-used OS specific definition
- copied include/bswap.h from alsa-lib

- EPIPE and ESTRPIPE are different usage, but currently
  EPIPE is used when ESTRPIPE is not defined.

  To fix this problem, assign ESPIPE instead.

Fixes: https://github.com/alsa-project/alsa-utils/pull/186
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-02-03 13:08:44 +01:00
Khem Raj
4e3843d0ed aplay,axfer: Replace off64_t with off_t
Also replace lseek64 with lseek.

_FILE_OFFSET_BITS=64 is passed to needed platforms since configure uses
AC_SYS_LARGEFILE macro. Therefore off_t is already 64-bit and lseek is
same as lseek64.

Additionally this fixes buils with latest musl where these lfs64
functions are moved out from _GNU_SOURCE and under _LARGEFILE64_SOURCE
macro alone. This makes the builds fail on 32-bit platforms even though
default off_t on musl is 64-bit always.

Fixes: https://github.com/alsa-project/alsa-utils/pull/183
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-23 19:04:07 +01:00
Amadeusz Sławiński
4f7e1af85a aplay: Fix parsing of format with WAV_FMT_EXTENSIBLE header
WAV_FMT_EXTENSIBLE header contains valid bits per sample, which can be
different than bits per sample. Make sure it is taken into account when
parsing headers and choosing playback format.

BugLink: https://github.com/alsa-project/alsa-utils/pull/178
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-23 19:00:34 +01:00
Jaroslav Kysela
62cd05a929 aplay: remove wrongly merged UCM code
The code origin comes from me. Unfortunately, it was merged
by mistake to another commit. Remove it for now.

Fixes: https://github.com/alsa-project/alsa-utils/issues/153
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-03 22:46:47 +02:00
Jaroslav Kysela
6ee086363a aplay: fix the capture file length regression
The commit 4b959a4 ("aplay: Fix for arecord recording ghost data")
intruduced a regression (file may contain more samples than
expected). Correct this.

Fixes: https://github.com/alsa-project/alsa-utils/issues/163
Fixes: 4b959a4 ("aplay: Fix for arecord recording ghost data")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-03 22:10:05 +02:00
Amadeusz Sławiński
4b959a447a aplay: Fix for arecord recording ghost data
When recording we should only write the amount of data read to output
file instead of copying whole buffer. This fixes glitches appearing at
the end of recorded file, when stopping recording.

Fixes: https://github.com/alsa-project/alsa-utils/pull/150
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 14:09:29 +02:00
Matthias Braun
cbf0a2fa58 aplay: fix a typo in warning (inaudiable -> inaudible)
From: Matthias Braun (https://github.com/mb720)
Fixes: https://github.com/alsa-project/alsa-utils/pull/143
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 13:28:26 +02:00
Ranjani Sridharan
90f5967178 topology: pre-processor: Move the call to expand variables
Remove the call to snd_config_expand_custom() to expand the top-level
input config. And replace it with calls to snd_config_evaluate_string()
for each non-compound config while processing individual objects. This
will allow retreving variable definitions from object attribute values
and global definitions.

Add a new field "current_obj_cfg" to hold the current object config
being pre-processed.

This will facilitate adding simple math expressions for computing
attribute values for objects based on other attributes. For ex: we can
set the expression for buffer size as follows:

buffer_size "$[($in_channels * 48) * 4]"

The buffer_size attribute value will be computed with the attribute
value "in_channels" based on the expression above. So if $in_channels =
2, buffer_size will be evaluated to 384.

Additionally this change also permits computing attribute values based
on previously computed values. For example:

buffer_size "$[($in_channels * 48) * 4]"
dma_buffer_size "$[$buffer_size * 2]"

dma_buffer_size will be computed as 768. Note that the order of
definitions for buffer_size and dma_buffer_size matters because the
evaluation for dma_buffer_size depends on the evaluation of buffer_size.
In order to conform to this, the tplg_object_copy_and_add_param() is
modified to add attribute configs from class config to an object using
snd_config_before() instead of snd_config_add().

With this change, we no longer need to set the auto_attr_updater for
buffer type widget objects. So remove it.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-12-19 20:32:38 +01:00
Takashi Iwai
dea51861a8 aplay: Fix out-of-bound access in stereo VU meter drawing
The left channel drawing of a stereo VU meter has a bug where it may
access a negative array index.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-24 10:06:05 +02:00
Takashi Iwai
2efe124c31 aplay: Handle upper bound in peak calculations
Make sure that the calculated max_peak[] won't go beyond the sample
max resolution.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-24 10:00:26 +02:00
Takashi Iwai
d9b3133815 aplay: Don't pass most negative integer to abs() in peak calculations
The return value from abs() for the most negative integer is
undefined.  Cap it properly for the 32bit sample handling.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-24 09:58:29 +02:00
Takashi Iwai
5c4bf63a94 aplay: Handle 16bit sample negative overflow in peak calculations
The handling of 16bit samples in the peak calculations has a bug when
a sample with 0x8000 is passed.  As abs() treats 32bit int, it returns
0x8000.  And yet the code stores back into 16bit value again.

To fix that overflow, use 32bit value (i.e. val instead of sval) for
the further calculations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-24 09:53:53 +02:00
Takashi Iwai
0ea7bfea83 aplay: Fix conversion of unsigned samples in peak calculation
The XOR with the mask has to be applied before calculating abs value.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-24 09:51:39 +02:00
Jaroslav Kysela
fc7500c3c7 arecord: Inform users when 8-bit sampling is used on tty
When we reverted 0c5948e ("aplay: try to use 16-bit format to
increase capture quality"), we should also handle the original
problem somehow. This code shows a warning with a hint to
the right parameter.

Fixes: https://github.com/alsa-project/alsa-utils/issues/96
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-14 12:25:10 +02:00
Jaroslav Kysela
f35b66d8f1 Revert "aplay: try to use 16-bit format to increase capture quality"
This reverts commit 0c5948e98a.

Link: https://github.com/alsa-project/alsa-utils/issues/96
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-14 12:02:51 +02:00
Andreas Pape
c9e9a79c6c aplay: avoid any further PCM writing if in abort
Terminating stream with CTRL-C will set in_aborting flag which is used to leave any
write/read loop on the ALSA device.
After ending the read/write loop aplay tries to drain the stream which is not required and can also lead to malfunctions:
-If user interrupts a blocked/non responsive PCM (e.g. usb uac2 gadget which does not consume data
due to stream stopped by host) it will successfully terminate the write loop but will hang again in drain call.
This would require to hit CTRL-C again to unblock which should be avoided.
Aplay currently anyhow allows signal handler to get invoked only once.

Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-19 12:53:39 +01:00
Jaroslav Kysela
bccebc59a0 aplay: fix the wrong pointer dereference in playbackv_go()
BugLink: https://github.com/alsa-project/alsa-utils/issues/70
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:29:33 +01:00
Jaroslav Kysela
b8a1e95773 aplay: fix the test position test for playback (avail > delay)
The avail > delay condition is invalid only for capture, of course.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-19 12:37:34 +01:00
Jaroslav Kysela
05ebe64b2d aplay: add avail > delay checks to --test-position
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:09:12 +01:00
Jaroslav Kysela
76bc37aeb7 aplay: add test code for snd_pcm_status() to --test-position
We need to test also snd_pcm_status() values.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 17:19:07 +01:00
Jaroslav Kysela
c1b92db5ef aplay: fix the CPU busy loop in the pause handler
Use the standard poll mechanism to ensure that there's
something in the input to avoid busy loop on the file
descriptor with the non-block mode set.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-11-08 19:11:22 +01:00
Jaroslav Kysela
986a1bd3d2 aplay: cosmetic code fix in xrun()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-23 12:05:59 +02:00
Hui Wang
0c5948e98a aplay: try to use 16-bit format to increase capture quality
Recently users reported a bug, I tested it and found it is a common
issue on Laptop or Desktop machines.

The issue is users plug a headset and use "arecord test.wav" to
record a sound with default input volume, the recorded sound has
poor quality and nearly can't distinguish it is the sound we want
to record.

This is because the input volume is low and the default format is U8.
The driver records sound with 16bit, because the input volume is low,
most of samples are within (-256,+256), when converting 16bit to U8,
those samples will be 0x7f. This is called quantization noise and we
could only workaround it by increase the input volume or adding -f to
arecord.

But users want to record a better quality sound with default input
volume (after installing a new OS, the volume is the default volume),
and they don't want to add parameters to the arecord because most of
new linux users just use "arecord test.wav".

So this patch tries to change the default format from U8 to S16_LE/BE.
If the machine doesn't support S16_LE/BE, it still uses U8 as default
format.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-23 11:39:52 +02:00
Jaroslav Kysela
246e132b80 aplay: fix the wrong count in compute_max_peak() for 16bit+ sample widths
The count argument was renamed to samples to correctly represent
the value meaning. Also, remove the wrong count recalculation lines
for 16-bit, 24-bit and 32-bit samples.

BugLink: https://github.com/alsa-project/alsa-utils/issues/57
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-15 13:14:39 +02:00
YetAnotherNerd
ae9d8cc974 minor aplay man page correction
Fix a minor typo for the '-f cdr' description.

Fixes: 55cd025f18 ("aplay -- update the man file")

BugLink: https://github.com/alsa-project/alsa-utils/pull/34
From: YetAnotherNerd <YetAnotherNerd@users.noreply.github.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:19:00 +02:00
Olivier Humbert
789a307cf9 aplay: Fix typo in error message
BugLink: https://github.com/alsa-project/alsa-utils/pull/44
From: Olivier Humbert <trebmuh@users.noreply.github.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:10:54 +02:00
Samanta Navarro
825d1d6359 treewide: fix typos in manual pages
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:07:29 +02:00
Marcin Rajwa
9b02b42db4 aplay: capture: write only the amount of read frames
This patch changes the way aborted stream is being saved. Currently when
abort signal happens the write back of read samples is skipped but there
is no reason to not save them. Also, we need to know how much frames have
been read and write only those.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 12:58:20 +02:00
Marcin Rajwa
5e87e2e021 aplay: pcm_read(): return read samples instead of requested upon abort
This patch changes the logic of pcm_read() when abort signal has been
detected. During such condition we should return the amount of frames
actually read instead of the size requested by caller.

Currently functions pcm_read() and pcm_readv() when aborted (in_aborting
flag set) return the amount of requested frames instead of those actually
read prior to interrupt. The consequence of this is repetition of recent X
frames where X stands for amount of frames in one period. This problem is
barely visible or rather audible when the period is small like few
milliseconds because repetition of 1 [ms] of data is not-noticeable
however if we use buffer and period sizes in seconds then the problem
becomes apparent.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 12:58:20 +02:00
Marcin Rajwa
bc7a944c50 aplay: pcm_readv(): return read samples instead of requested upon abort
This patch changes the logic of pcm_readv() when abort signal has been
detected. During such condition we should return the amount of frames
actually read instead of the size requested by caller.

Currently functions pcm_read() and pcm_readv() when aborted (in_aborting
flag set) return the amount of requested frames instead of those actually
read prior to interrupt. The consequence of this is repetition of recent X
frames where X stands for amount of frames in one period. This problem is
barely visible or rather audible when the period is small like few
milliseconds because repetition of 1 [ms] of data is not-noticeable
however if we use buffer and period sizes in seconds then the problem
becomes apparent.

Example issue -> thesofproject/sof#3189

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 12:58:20 +02:00
Jaroslav Kysela
651ca88a99 aplay: fix possible string overflow (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-09 10:27:40 +02:00
Michael Forney
62a765087e Avoid pointer arithmetic on void *
The pointer operand to the binary `+` operator must be to a complete
object type.

Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-02-10 12:38:52 +01:00
Michael Forney
f80a290153 Use __func__ instead of __FUNCTION__
They are equivalent, but __func__ is in C99. __FUNCTION__ exists only
for backwards compatibility with old gcc versions.

Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-02-10 12:38:28 +01:00
Rosen Penev
c9dc401264 aplay: Limit VUMeter progress bar to 100 for negative as well
While the progress bar cannot be negative, GCC concludes that it can be
and assumes tmp can be written past the end. Fixes this GCC warning:

aplay.c:1747:18: warning: '%02d' directive writing between 2 and 11 bytes
 into a region of size 4 [-Wformat-overflow=]
 1747 |    sprintf(tmp, "%02d%%", maxperc[c]);

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 22:01:26 +01:00
Rosen Penev
ac82b65167 aplay: Adjust buffer sizes to fix snprintf warnings
It also reduces compiled size slightly.

aplay.c: In function 'capture':
aplay.c:3055:34: error: '-01' directive output may be truncated writing 3
bytes into a region of size between 1 and 4097 [-Werror=format-truncation=
]
 3055 |    snprintf(namebuf, namelen, "%s-01", buf);
      |                                  ^~~
aplay.c:3055:4: note: 'snprintf' output between 4 and 4100 bytes into a
destination of size 4097
 3055 |    snprintf(namebuf, namelen, "%s-01", buf);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3053:34: error: '-01.' directive output may be truncated writing 4
bytes into a region of size between 1 and 4097 [-Werror=format-truncation=
]
 3053 |    snprintf(namebuf, namelen, "%s-01.%s", buf, s);
      |                                  ^~~~
aplay.c:3053:4: note: 'snprintf' output 5 or more bytes (assuming 4101)
into a destination of size 4097
 3053 |    snprintf(namebuf, namelen, "%s-01.%s", buf, s);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3065:34: error: '%02i' directive output may be truncated writing
between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror=
format-truncation=]
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |                                  ^~~~
aplay.c:3065:30: note: directive argument in the range [1, 2147483647]
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |                              ^~~~~~~~~
aplay.c:3065:3: note: 'snprintf' output between 4 and 4108 bytes into a
destination of size 4097
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3063:34: error: '%02i' directive output may be truncated writing
between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror=
format-truncation=]
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
      |                                  ^~~~
aplay.c:3063:30: note: directive argument in the range [1, 2147483647]
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
      |                              ^~~~~~~~~~~~
aplay.c:3063:3: note: 'snprintf' output 5 or more bytes (assuming 4109)
into a destination of size 4097
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:46:55 +01:00
Rosen Penev
80fd81f4a8 treewide: Fix printf formats
Found with cppcheck

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:46:17 +01:00
Rosen Penev
5e6df5ae4b treewide: sys/poll to poll
Fixes warning on musl:

warning redirecting incorrect #include <sys/poll.h> to <poll.h>

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:44:02 +01:00
chunxu.li
d40e724905 aplay: fix memory leak when setup_chmap() fail
setup_chmap() will return with error number if hw_map calloc fail or
channels doesn't match with hw_params, but memory free was ignored when
error occurs.

Signed-off-by: chunxu.li <chunxuxiao@gmail.com>
Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-09-25 09:57:19 +02:00
Jaroslav Kysela
9b6c5e2d5c aplay: check the return value for snd_pcm_sw_params_current() (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-13 14:46:33 +01:00