OSDN Git Service

pcm_file: do not disrupt playback on output file write fail
authorAdam Miartus <amiartus@de.adit-jv.com>
Wed, 12 Jun 2019 06:48:27 +0000 (08:48 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sat, 15 Jun 2019 08:34:53 +0000 (10:34 +0200)
commit6ecd330fb8a4063f814e4828f017ade20c6003e6
tree5e17ff78e009fdeb6516a541580bb0765b4668e6
parent03b2f3d05653ef1d9de32ce1d9cf251b6fecd279
pcm_file: do not disrupt playback on output file write fail

previously playback could be interrupted by snd_pcm_file_add_frames:
    assert(file->wbuf_used_bytes < file->wbuf_size_bytes)

in case snd_pcm_file_write_bytes fails to write full amount of bytes
to file, variable wbuf_used_bytes would not be fully decremented by
requested amount of bytes function was called with

for the assert to trigger, multiple write fails need to happen, so
that wbuf_used_bytes overflows wbuf_size_bytes,

this patch will allow application to report error code to api user
who might have an idea how to recover, before assert is triggered,
also reporting error along with the print out message might give user
a better idea of what is going on, where previously reason for
mentioned assert was not immediately clear

Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_file.c