diff options
author | Ricardo Biehl Pasquali <pasqualirb@gmail.com> | 2018-12-18 23:13:05 -0200 |
---|---|---|
committer | Ricardo Biehl Pasquali <pasqualirb@gmail.com> | 2019-01-08 13:06:19 -0200 |
commit | c1446758c76a8319382aad3b56df09c45d51bba4 (patch) | |
tree | 680668d48636df256303a03cf3fe5e069ba1f3c3 /src | |
parent | 7a286f6499128bfbba8ab831cc8ffdbf82330857 (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.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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; } |