mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
pcm_file: report write output file error to api user
when writing to output file fails, api user is notified and can handle recovery 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>
This commit is contained in:
parent
6ecd330fb8
commit
2a800c0c4f
1 changed files with 22 additions and 5 deletions
|
|
@ -572,7 +572,10 @@ static snd_pcm_sframes_t snd_pcm_file_writei(snd_pcm_t *pcm, const void *buffer,
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
snd_pcm_areas_from_buf(pcm, areas, (void*) buffer);
|
snd_pcm_areas_from_buf(pcm, areas, (void*) buffer);
|
||||||
__snd_pcm_lock(pcm);
|
__snd_pcm_lock(pcm);
|
||||||
snd_pcm_file_add_frames(pcm, areas, 0, n);
|
if (snd_pcm_file_add_frames(pcm, areas, 0, n) < 0) {
|
||||||
|
__snd_pcm_unlock(pcm);
|
||||||
|
return -EPIPE;
|
||||||
|
}
|
||||||
__snd_pcm_unlock(pcm);
|
__snd_pcm_unlock(pcm);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
|
|
@ -587,7 +590,10 @@ static snd_pcm_sframes_t snd_pcm_file_writen(snd_pcm_t *pcm, void **bufs, snd_pc
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
snd_pcm_areas_from_bufs(pcm, areas, bufs);
|
snd_pcm_areas_from_bufs(pcm, areas, bufs);
|
||||||
__snd_pcm_lock(pcm);
|
__snd_pcm_lock(pcm);
|
||||||
snd_pcm_file_add_frames(pcm, areas, 0, n);
|
if (snd_pcm_file_add_frames(pcm, areas, 0, n) < 0) {
|
||||||
|
__snd_pcm_unlock(pcm);
|
||||||
|
return -EPIPE;
|
||||||
|
}
|
||||||
__snd_pcm_unlock(pcm);
|
__snd_pcm_unlock(pcm);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
|
|
@ -608,6 +614,11 @@ static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pc
|
||||||
snd_pcm_file_areas_read_infile(pcm, areas, 0, frames);
|
snd_pcm_file_areas_read_infile(pcm, areas, 0, frames);
|
||||||
__snd_pcm_lock(pcm);
|
__snd_pcm_lock(pcm);
|
||||||
snd_pcm_file_add_frames(pcm, areas, 0, frames);
|
snd_pcm_file_add_frames(pcm, areas, 0, frames);
|
||||||
|
if (snd_pcm_file_add_frames(pcm, areas, 0, frames) < 0) {
|
||||||
|
__snd_pcm_unlock(pcm);
|
||||||
|
return -EPIPE;
|
||||||
|
}
|
||||||
|
|
||||||
__snd_pcm_unlock(pcm);
|
__snd_pcm_unlock(pcm);
|
||||||
|
|
||||||
return frames;
|
return frames;
|
||||||
|
|
@ -627,7 +638,11 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm
|
||||||
snd_pcm_areas_from_bufs(pcm, areas, bufs);
|
snd_pcm_areas_from_bufs(pcm, areas, bufs);
|
||||||
snd_pcm_file_areas_read_infile(pcm, areas, 0, frames);
|
snd_pcm_file_areas_read_infile(pcm, areas, 0, frames);
|
||||||
__snd_pcm_lock(pcm);
|
__snd_pcm_lock(pcm);
|
||||||
snd_pcm_file_add_frames(pcm, areas, 0, frames);
|
if (snd_pcm_file_add_frames(pcm, areas, 0, frames) < 0) {
|
||||||
|
__snd_pcm_unlock(pcm);
|
||||||
|
return -EPIPE;
|
||||||
|
}
|
||||||
|
|
||||||
__snd_pcm_unlock(pcm);
|
__snd_pcm_unlock(pcm);
|
||||||
|
|
||||||
return frames;
|
return frames;
|
||||||
|
|
@ -649,8 +664,10 @@ static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm,
|
||||||
if (result >= 0) {
|
if (result >= 0) {
|
||||||
assert(ofs == offset && siz == size);
|
assert(ofs == offset && siz == size);
|
||||||
result = snd_pcm_mmap_commit(file->gen.slave, ofs, siz);
|
result = snd_pcm_mmap_commit(file->gen.slave, ofs, siz);
|
||||||
if (result > 0)
|
if (result > 0) {
|
||||||
snd_pcm_file_add_frames(pcm, areas, ofs, result);
|
if (snd_pcm_file_add_frames(pcm, areas, ofs, result) < 0)
|
||||||
|
return -EPIPE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue