aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordvdli <dvdli@google.com>2020-10-28 22:22:27 +0800
committerdvdli <dvdli@google.com>2020-10-28 22:22:27 +0800
commit72216211c7a5f29510a2f50dbdc70b35af44fb3a (patch)
treed1ab25010856d30cc7eeea561354996a28cb89b2
parentfaaa6972a2846b43366887bc0779c6c1be20a16f (diff)
AOSP CL "Add pcm_get_poll_fd"
https://android.googlesource.com/platform/external/tinyalsa/+/b42510d55bafc96805a44bd6ac40faac28ebd219 commit b42510d55bafc96805a44bd6ac40faac28ebd219 author Dylan Reid <dgreid@chromium.org> Add pcm_get_poll_fd Similar to ALSA snd_pcm_get_poll_fd, this will allow a user to wait for a sound device to have data in a poll(2) call. The hotword thread will use this to wait for a message on its socket or for audio data to become ready. Change-Id: I61375a73d7a842b00362fc707c12f99aa18e0bdf Signed-off-by: Dylan Reid <dgreid@chromium.org>
-rw-r--r--include/tinyalsa/pcm.h2
-rw-r--r--src/pcm.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h
index a49746c..99ca786 100644
--- a/include/tinyalsa/pcm.h
+++ b/include/tinyalsa/pcm.h
@@ -343,6 +343,8 @@ int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames);
int pcm_mmap_avail(struct pcm *pcm);
+int pcm_get_poll_fd(struct pcm *pcm);
+
int pcm_link(struct pcm *pcm1, struct pcm *pcm2);
int pcm_unlink(struct pcm *pcm);
diff --git a/src/pcm.c b/src/pcm.c
index e88c18c..eb16ed3 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -1344,6 +1344,11 @@ static int pcm_mmap_transfer_areas(struct pcm *pcm, char *buf,
return count;
}
+int pcm_get_poll_fd(struct pcm *pcm)
+{
+ return pcm->fd;
+}
+
int pcm_avail_update(struct pcm *pcm)
{
pcm_sync_ptr(pcm, SNDRV_PCM_SYNC_PTR_APPL|SNDRV_PCM_SYNC_PTR_AVAIL_MIN);