aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRicardo Biehl Pasquali <pasqualirb@gmail.com>2018-12-18 23:13:05 -0200
committerRicardo Biehl Pasquali <pasqualirb@gmail.com>2019-01-08 13:06:19 -0200
commitc1446758c76a8319382aad3b56df09c45d51bba4 (patch)
tree680668d48636df256303a03cf3fe5e069ba1f3c3 /src
parent7a286f6499128bfbba8ab831cc8ffdbf82330857 (diff)
pcm: Call HWSYNC ioctl when status is mmaped
When hardware pointer update is requested and status structure is mmaped, call HWSYNC ioctl. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/pcm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pcm.c b/src/pcm.c
index 8ef5a48..4bc86aa 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -516,14 +516,23 @@ unsigned int pcm_frames_to_bytes(const struct pcm *pcm, unsigned int frames)
static int pcm_sync_ptr(struct pcm *pcm, int flags)
{
- if (pcm->sync_ptr) {
+ if (pcm->sync_ptr == NULL) {
+ /* status and control are mmaped */
+
+ if (flags & SNDRV_PCM_SYNC_PTR_HWSYNC) {
+ if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_HWSYNC) == -1) {
+ oops(pcm, errno, "failed to sync hardware pointer");
+ return -1;
+ }
+ }
+ } else {
pcm->sync_ptr->flags = flags;
if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_SYNC_PTR, pcm->sync_ptr) < 0) {
oops(pcm, errno, "failed to sync mmap ptr");
return -1;
}
- return 0;
}
+
return 0;
}