Commit graph

349 commits

Author SHA1 Message Date
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
Jaroslav Kysela
bc42704c96 aplay: fix the multiple open file descriptors for the raw capture
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-12 17:36:11 +01:00
Takashi Sakamoto
6c81444a52 aplay: improve available conditions for '--samples' and '--duration' options
Either '--samples' ('-s') and '--duration' ('-d') option is available
exclusively, according to its semantics and actual implementation.

This commit improves description of manual at this point.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Daniel Baluta daniel.baluta@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-08 16:03:32 +01:00
Takashi Sakamoto
8b0cdffe09 aplay: add a paragraph for '--samples' ('-s') option to aplay manual
A '--samples' ('-s') option was added so that record/playback process is
terminated after handling the same number of PCM frames as a value of the
option. However this option is not described in aplay manual.

This commit adds a paragraph for the option.

Fixes: 3d44e2bc15 ('aplay: Add samples argument for playing/recording a given number of samples')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Daniel Baluta daniel.baluta@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-08 16:03:25 +01:00
Takashi Sakamoto
f79082df38 aplay: delete paragraph for obsoleted '--sleep-min' ('-s') option from aplay manual
A '--sleep-min' option was already obsoleted for aplay. On the other hand,
a paragraph for the option was left as is.

This commit deletes the paragraph.

Fixes: 4cb74aed89 ('Remove sleep_min from aplay')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Daniel Baluta daniel.baluta@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-08 16:03:01 +01:00
Jaroslav Kysela
fb97588025 aplay: add missing block brackets
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2018-10-14 17:00:26 +02:00
Takashi Iwai
da4d5bd53a aplay: Fix invalid file size check for non-regular files
aplay tries to check the file size via fstat() at parsing the format
headers and avoids parsing when the size is shorter than the given
size.  This works fine for regular files, but when a special file like
pipe is passed, it fails, eventually leading to the fallback mode
wrongly.

A proper fix is to do this sanity check only for a regular file.

Reported-by: Jay Foster <jay@systech.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 22:17:01 +02:00
erwin
588b3aa0ef aplay: Fix wav file not being split on 32 bit platforms
On my 32 bit armhf board arecord exits because of write() returning EFBIG
when the output file size reaches 2147483647 bytes.

To fix this, include generated header file before system header files
so that _FILE_OFFSET_BITS=64 is used properly, as required in documentation
"man feature_test_macros".

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-03-13 22:07:08 +01:00
Jussi Laako
d0802f32ca aplay: Adjust sample rate limits to support newer hardware
There are number of devices that support up to 384 kHz sampling rate and
some devices up to 768 kHz sampling rate. This patch increases sanity
check limit to 768k in order to support testing of such hardware.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-12-07 13:44:20 +01:00
Jaroslav Kysela
b1e3d945b7 Change FSF address (Franklin Street)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-11-14 14:28:53 +01:00
Daniel Baluta
1c9adf46b8 aplay: Fix playback for small raw files
This fixes a bug when trying to play files with size
smaller than maximum supported header size.

Lets have a look at the following example:

$ aplay -s 2 sample.raw

-> playback_go(fd = 10, loaded = 26, count = 2, name="sample.raw")
--> l = loaded = 26
--> c = count - written = 2
--> c -= l = 2 - 26 = -24
---> r = safe_read(fd, audiobuf + 26, -24)
---> r = -1, EXIT_FAILURE

In this case we have already 'loaded' from the input file more
bytes that we need to send to pcm device. So, we need to adjust
the number of bytes loaded and avoid reading a negative number
of bytes.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-09 10:39:36 +02:00
Daniel Baluta
dba6db9228 aplay: Refactor playback code
This introduces read_header function which tries
to read the header of an audio file in order to determine
its type.

This has the following effects:
	(1) makes code easier to read
	(2) don't abort if file size is less than expected header

(2), allows us to play small files with size smaller than any
supported audio file headers.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-09 10:38:41 +02:00
Ion-Horia Petrisor
3d44e2bc15 aplay: Add samples argument for playing/recording a given number of samples
-s --samples allows aplay to be used for playback/capture a given
number of samples per channel

Signed-off-by: Ion-Horia Petrisor <ion-horia.petrisor@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-09 10:38:19 +02:00
Srikanth Krishnakar
16557c2c7f aplay: interrupt streaming via signal in voc_pcm_write
aplay/arecord (alsa-utils v1.1.2) cannot interrupt streaming
via CTRL-C. Fixed the issue by properly handling 'in_aborting'
flag in appropriate functions.

Signed-off-by: Anant Agrawal <Anant_Agrawal@mentor.com>
Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-07-10 15:27:22 +02:00
Scott Gilliland
a28ff22df8 aplay: Fix --max-file-time option 32 bits overflow
Fix bug in arecord --max-file-time where the file size could overflow
32 bits.

Signed-off-by: Scott Gilliland <scott.gilliland@gatech.edu>
Acked-by: John Sauter <John_Sauter@systemeyescomputerstore.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-26 17:05:38 +02:00
Daniel Baluta
1d34e6addc aplay: Introduce and use xwrite helper
Write can return less then requested bytes, but we treat this as
an error thus ending up with confusing error messages.

Fix this by introducing xwrite helper, which makes sure all bytes
are written or an error is returned.

With this patch an usecase where disk is filled by recording will
print:
$ /mnt/msc/audio.wav: No space left on device

instead of random messages like:

$/mnt/msc/audio.wav: No such file or directory

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-04-10 09:11:28 +02:00