mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:35:42 +01:00
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>
This commit is contained in:
parent
5e87e2e021
commit
9b02b42db4
1 changed files with 5 additions and 4 deletions
|
@ -3206,11 +3206,12 @@ static void capture(char *orig_name)
|
||||||
size_t c = (rest <= (off64_t)chunk_bytes) ?
|
size_t c = (rest <= (off64_t)chunk_bytes) ?
|
||||||
(size_t)rest : chunk_bytes;
|
(size_t)rest : chunk_bytes;
|
||||||
size_t f = c * 8 / bits_per_frame;
|
size_t f = c * 8 / bits_per_frame;
|
||||||
if (pcm_read(audiobuf, f) != f) {
|
size_t read = pcm_read(audiobuf, f);
|
||||||
|
size_t save;
|
||||||
|
if (read != f)
|
||||||
in_aborting = 1;
|
in_aborting = 1;
|
||||||
break;
|
save = read * bits_per_frame / 8;
|
||||||
}
|
if (xwrite(fd, audiobuf, save) != save) {
|
||||||
if (xwrite(fd, audiobuf, c) != c) {
|
|
||||||
perror(name);
|
perror(name);
|
||||||
in_aborting = 1;
|
in_aborting = 1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue