Merge tag 'android-6.0.0_r26' into HEAD
Android 6.0.0 release 26
* tag 'android-6.0.0_r26':
Add pcm_get_poll_fd
Export pcm_mmap_avail
initialize pcm_config to zero
Change-Id: I5f1139095b87e178b51f9f346442d105b36af52a
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h
index 1554b52..97ee4f3 100644
--- a/include/tinyalsa/asoundlib.h
+++ b/include/tinyalsa/asoundlib.h
@@ -235,6 +235,7 @@
int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset,
unsigned int *frames);
int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames);
+int pcm_mmap_avail(struct pcm *pcm);
/* Prepare the PCM substream to be triggerable */
int pcm_prepare(struct pcm *pcm);
@@ -247,6 +248,7 @@
/* Interrupt driven API */
int pcm_wait(struct pcm *pcm, int timeout);
+int pcm_get_poll_fd(struct pcm *pcm);
/* Change avail_min after the stream has been opened with no need to stop the stream.
* Only accepted if opened with PCM_MMAP and PCM_NOIRQ flags
diff --git a/pcm.c b/pcm.c
index e3a41b0..488ea0c 100644
--- a/pcm.c
+++ b/pcm.c
@@ -1059,7 +1059,7 @@
return avail;
}
-static inline int pcm_mmap_avail(struct pcm *pcm)
+int pcm_mmap_avail(struct pcm *pcm)
{
pcm_sync_ptr(pcm, SNDRV_PCM_SYNC_PTR_HWSYNC);
if (pcm->flags & PCM_IN)
@@ -1180,6 +1180,11 @@
return 1;
}
+int pcm_get_poll_fd(struct pcm *pcm)
+{
+ return pcm->fd;
+}
+
int pcm_mmap_transfer(struct pcm *pcm, const void *buffer, unsigned int bytes)
{
int err = 0, frames, avail;
diff --git a/tinycap.c b/tinycap.c
index 5bef289..e470488 100644
--- a/tinycap.c
+++ b/tinycap.c
@@ -191,6 +191,7 @@
unsigned int size;
unsigned int bytes_read = 0;
+ memset(&config, 0, sizeof(config));
config.channels = channels;
config.rate = rate;
config.period_size = period_size;
diff --git a/tinyplay.c b/tinyplay.c
index 57b51af..7422554 100644
--- a/tinyplay.c
+++ b/tinyplay.c
@@ -218,6 +218,7 @@
int size;
int num_read;
+ memset(&config, 0, sizeof(config));
config.channels = channels;
config.rate = rate;
config.period_size = period_size;