summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2015-11-06 12:31:32 +0100
committerDavid Henningsson <david.henningsson@canonical.com>2015-11-17 09:30:58 +0100
commit107dfa8e0141d5fb979bebe3606b3fd9e4f65f55 (patch)
tree81352cb0f172ca8ccceb1c41bd8ed6294e0b563a
parentf621aa5e2c04ff8bc63d5f10447130cfb6bf435d (diff)
alsa-mixer: Return early in case of no mixer poll descriptors
We encountered an alsa plugin a while ago (not sure if the source can be shared) which had mixer controls, but no descriptors to poll for changes. Quit early to avoid latter assertion failures. BugLink: https://bugs.launchpad.net/bugs/1092377 Signed-off-by: David Henningsson <david.henningsson@canonical.com>
-rw-r--r--src/modules/alsa/alsa-mixer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 486da83d8..af7adeaf5 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -329,6 +329,10 @@ static void defer_cb(pa_mainloop_api *a, pa_defer_event *e, void *userdata) {
pa_log("snd_mixer_poll_descriptors_count() failed: %s", pa_alsa_strerror(n));
return;
}
+ else if (n == 0) {
+ pa_log_warn("Mixer has no poll descriptors. Please control mixer from PulseAudio only.");
+ return;
+ }
num_fds = (unsigned) n;
if (num_fds != fdl->num_fds) {
@@ -522,6 +526,10 @@ int pa_alsa_set_mixer_rtpoll(struct pa_alsa_mixer_pdata *pd, snd_mixer_t *mixer,
pa_log("snd_mixer_poll_descriptors_count() failed: %s", pa_alsa_strerror(n));
return -1;
}
+ else if (n == 0) {
+ pa_log_warn("Mixer has no poll descriptors. Please control mixer from PulseAudio only.");
+ return 0;
+ }
i = pa_rtpoll_item_new(rtp, PA_RTPOLL_LATE, (unsigned) n);