return -EPIPE;
}
snd_atomic_write_begin(&plugin->watom);
- snd_pcm_mmap_appl_forward(pcm, frames);
result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
snd_pcm_sframes_t res;
res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result);
- if (res < 0)
+ if (res < 0) {
+ snd_atomic_write_end(&plugin->watom);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
+ }
frames -= res;
}
- snd_atomic_write_end(&plugin->watom);
- if (result <= 0)
+ if (result <= 0) {
+ snd_atomic_write_end(&plugin->watom);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
+ }
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ snd_atomic_write_end(&plugin->watom);
offset += frames;
xfer += frames;
size -= frames;
return -EPIPE;
}
snd_atomic_write_begin(&plugin->watom);
- snd_pcm_mmap_appl_forward(pcm, frames);
result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
snd_pcm_sframes_t res;
res = plugin->undo_read(slave, areas, offset, frames, slave_frames - result);
- if (res < 0)
+ if (res < 0) {
+ snd_atomic_write_end(&plugin->watom);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
+ }
frames -= res;
}
- snd_atomic_write_end(&plugin->watom);
- if (result <= 0)
+ if (result <= 0) {
+ snd_atomic_write_end(&plugin->watom);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
+ }
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ snd_atomic_write_end(&plugin->watom);
offset += frames;
xfer += frames;
size -= frames;
frames = plugin->write(pcm, areas, appl_offset, frames,
slave_areas, slave_offset, &slave_frames);
snd_atomic_write_begin(&plugin->watom);
- snd_pcm_mmap_appl_forward(pcm, frames);
result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
- snd_atomic_write_end(&plugin->watom);
if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
snd_pcm_sframes_t res;
res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result);
- if (res < 0)
+ if (res < 0) {
+ snd_atomic_write_end(&plugin->watom);
return xfer > 0 ? xfer : res;
+ }
frames -= res;
}
- if (result <= 0)
+ if (result <= 0) {
+ snd_atomic_write_end(&plugin->watom);
return xfer > 0 ? xfer : result;
+ }
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ snd_atomic_write_end(&plugin->watom);
if (frames == cont)
appl_offset = 0;
else
frames = (plugin->read)(pcm, areas, hw_offset, frames,
slave_areas, slave_offset, &slave_frames);
snd_atomic_write_begin(&plugin->watom);
- snd_pcm_mmap_hw_forward(pcm, frames);
result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
- snd_atomic_write_end(&plugin->watom);
if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
snd_pcm_sframes_t res;
res = plugin->undo_read(slave, areas, hw_offset, frames, slave_frames - result);
- if (res < 0)
+ if (res < 0) {
+ snd_atomic_write_end(&plugin->watom);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
+ }
frames -= res;
}
- if (result <= 0)
+ if (result <= 0) {
+ snd_atomic_write_end(&plugin->watom);
return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
+ }
+ snd_pcm_mmap_hw_forward(pcm, frames);
+ snd_atomic_write_end(&plugin->watom);
if (frames == cont)
hw_offset = 0;
else