Merge dcbd7a7cd3dfa2803c605b3d6bf66b376a6fc81f on remote branch
Change-Id: I719af81832fa6d7609e752da0dd8063e73473a27
diff --git a/OWNERS b/OWNERS
index e1e3676..ccb311a 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,2 +1,5 @@
dvdli@google.com
-gkasten@google.com
+elaurent@google.com
+mnaganov@google.com
+carterhsu@google.com
+
diff --git a/WORKSPACE b/WORKSPACE
index 02b57bf..133cfc5 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,5 +3,5 @@
git_repository(
name = "googletest",
remote = "https://github.com/google/googletest",
- branch = "master",
+ branch = "main",
)
diff --git a/include/tinyalsa/meson.build b/include/tinyalsa/meson.build
index d14b35b..95077be 100644
--- a/include/tinyalsa/meson.build
+++ b/include/tinyalsa/meson.build
@@ -1,9 +1,11 @@
tinyalsa_headers = [
'asoundlib.h',
+ 'attributes.h',
'interval.h',
'limits.h',
'mixer.h',
'pcm.h',
+ 'plugin.h',
'version.h'
]
diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h
index 5c11e2a..9fca92d 100644
--- a/include/tinyalsa/pcm.h
+++ b/include/tinyalsa/pcm.h
@@ -217,16 +217,16 @@
* silence_size : 0
*/
/** The minimum number of frames required to start the PCM */
- unsigned int start_threshold;
+ unsigned long start_threshold;
/** The minimum number of frames required to stop the PCM */
- unsigned int stop_threshold;
+ unsigned long stop_threshold;
/** The minimum number of frames to silence the PCM */
- unsigned int silence_threshold;
+ unsigned long silence_threshold;
/** The number of frames to overwrite the playback buffer when the playback underrun is greater
* than the silence threshold */
- unsigned int silence_size;
+ unsigned long silence_size;
- unsigned int avail_min;
+ unsigned long avail_min;
};
/** Enumeration of a PCM's hardware parameters.
diff --git a/src/mixer.c b/src/mixer.c
index 5581e5d..afbc015 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -732,9 +732,13 @@
ctl = grp->ctl;
for (n = 0; n < grp->count; n++)
- if (!strcmp(name, (char*) ctl[n].info.id.name))
- if (index-- == 0)
+ if (!strcmp(name, (char*) ctl[n].info.id.name)) {
+ if (index == 0) {
return ctl + n;
+ } else {
+ index--;
+ }
+ }
}
#ifdef TINYALSA_USES_PLUGINS
@@ -743,9 +747,13 @@
ctl = grp->ctl;
for (n = 0; n < grp->count; n++)
- if (!strcmp(name, (char*) ctl[n].info.id.name))
- if (index-- == 0)
+ if (!strcmp(name, (char*) ctl[n].info.id.name)) {
+ if (index == 0) {
return ctl + n;
+ } else {
+ index--;
+ }
+ }
}
#endif
return NULL;
@@ -1039,6 +1047,9 @@
}
case SNDRV_CTL_ELEM_TYPE_IEC958:
+ ret = grp->ops->ioctl(grp->data, SNDRV_CTL_IOCTL_ELEM_READ, &ev);
+ if (ret < 0)
+ return ret;
size = sizeof(ev.value.iec958);
source = &ev.value.iec958;
break;
diff --git a/src/mixer_plugin.c b/src/mixer_plugin.c
index 34117a9..a07b8f6 100644
--- a/src/mixer_plugin.c
+++ b/src/mixer_plugin.c
@@ -82,7 +82,8 @@
id->iface = ctl->iface;
strncpy((char *)id->name, (char *)ctl->name,
- sizeof(id->name));
+ sizeof(id->name) - 1);
+ ((char *)id->name)[sizeof(id->name) - 1] = '\0';
return 0;
}
@@ -100,7 +101,8 @@
strncpy(einfo->value.enumerated.name,
val->texts[einfo->value.enumerated.item],
- sizeof(einfo->value.enumerated.name));
+ sizeof(einfo->value.enumerated.name) - 1);
+ einfo->value.enumerated.name[sizeof(einfo->value.enumerated.name) - 1] = '\0';
return 0;
}
diff --git a/src/pcm_plugin.c b/src/pcm_plugin.c
index 15bfc80..47bf4a5 100644
--- a/src/pcm_plugin.c
+++ b/src/pcm_plugin.c
@@ -153,9 +153,12 @@
return ret;
}
- strncpy((char *)info->id, name, sizeof(info->id));
- strncpy((char *)info->name, name, sizeof(info->name));
- strncpy((char *)info->subname, name, sizeof(info->subname));
+ strncpy((char *)info->id, name, sizeof(info->id) - 1);
+ ((char *)info->id)[sizeof(info->id) - 1] = '\0';
+ strncpy((char *)info->name, name, sizeof(info->name) - 1);
+ ((char *)info->name)[sizeof(info->name) - 1] = '\0';
+ strncpy((char *)info->subname, name, sizeof(info->subname) - 1);
+ ((char *)info->subname)[sizeof(info->subname) - 1] = '\0';
info->subdevices_count = 1;