summaryrefslogtreecommitdiff
path: root/backends/oss/oss-device.c
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2015-09-26 20:50:04 +0200
committerMichal Ratajsky <[email protected]>2015-09-26 20:50:04 +0200
commitcd7b540d979581f7a36096624d88e9720eea418b (patch)
tree3045cd5415f93b705c2a6c3c0d562b5681941bdb /backends/oss/oss-device.c
parent10a0b2193303063167a297f542c4de0952a4cd25 (diff)
downloadlibmatemixer-cd7b540d979581f7a36096624d88e9720eea418b.tar.bz2
libmatemixer-cd7b540d979581f7a36096624d88e9720eea418b.tar.xz
oss: Only use modify counter for polling on Linux, it is broken on BSDs
Diffstat (limited to 'backends/oss/oss-device.c')
-rw-r--r--backends/oss/oss-device.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/backends/oss/oss-device.c b/backends/oss/oss-device.c
index 7699e7d..e89e6e8 100644
--- a/backends/oss/oss-device.c
+++ b/backends/oss/oss-device.c
@@ -459,8 +459,12 @@ oss_device_load (OssDevice *device)
} else
g_clear_object (&device->priv->output);
- /* See if we can use the modify_counter field to optimize polling */
-#ifdef SOUND_MIXER_INFO
+ /*
+ * See if we can use the modify_counter field to optimize polling.
+ *
+ * Only do this on Linux for now as the counter doesn't update on BSDs.
+ */
+#if defined(SOUND_MIXER_INFO) && defined(__linux__)
do {
struct mixer_info info;
gint ret;
@@ -476,12 +480,12 @@ oss_device_load (OssDevice *device)
/*
* Use a polling strategy inspired by KMix:
*
- * Poll for changes with the OSS_POLL_TIMEOUT_NORMAL interval, when we
+ * Poll for changes with the OSS_POLL_TIMEOUT_NORMAL interval. When we
* encounter a change in modify_counter, decrease the interval to
* OSS_POLL_TIMEOUT_RAPID for a few seconds to allow for smoother
* adjustments, for example when user drags a slider.
*
- * This way is not used on systems which don't support the modify_counter
+ * This is not used on systems which don't support the modify_counter
* field, because there is no way to find out whether anything has
* changed and therefore when to start the rapid polling.
*/
@@ -648,17 +652,13 @@ poll_mixer (OssDevice *device)
struct mixer_info info;
/*
- * The modify_counter field increases each time a change happens on
+ * The modify_counter field increases each time a change occurs on
* the device.
*
* If this ioctl() works, we use the field to only poll the controls
* if a change actually occured and we can also adjust the poll interval.
*
- * This works well at least on Linux, NetBSD and OpenBSD. This call is
- * not supported on FreeBSD as of version 10.
- *
- * The call is also used to detect unplugged devices early, when not
- * supported, the unplug is still caught in the backend.
+ * The call is also used to detect unplugged devices early.
*/
ret = ioctl (device->priv->fd, SOUND_MIXER_INFO, &info);
if (ret == -1) {