diff options
author | Tanu Kaskinen <tanu.kaskinen@digia.com> | 2012-03-26 14:35:30 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2012-03-28 17:32:04 +0300 |
commit | 5a26404f12045c37988f53e2cd25004539476ca7 (patch) | |
tree | 0b6b368ca60d45a259d49a1bc7bc4aeb070cdd10 | |
parent | 191d60688d18591acb3b0ddeafb870a2b1007429 (diff) |
alsa: Fix SND_MIXER_SCHN_LAST related stuff.
Valid channel id range is from 0 to SND_MIXER_SCHN_LAST,
inclusive, so the size of the masks array in pa_alsa_element
has to be SND_MIXER_SCHN_LAST + 1. Similar "too small"
arrays were also in alsa-sink's and alsa-source's userdata,
but actually those arrays were not used at all so they were
removed.
element_is_subset() in alsa-mixer.c skipped the last channel
id when iterating the element masks array; that's now fixed
as well.
Thanks to David Henningsson for spotting the too small
arrays in alsa-sink and alsa-source and the
element_is_subset() problem.
-rw-r--r-- | src/modules/alsa/alsa-mixer.c | 4 | ||||
-rw-r--r-- | src/modules/alsa/alsa-mixer.h | 2 | ||||
-rw-r--r-- | src/modules/alsa/alsa-sink.c | 2 | ||||
-rw-r--r-- | src/modules/alsa/alsa-source.c | 2 |
4 files changed, 3 insertions, 7 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index ba31c79d..abb12ee0 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -1577,7 +1577,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { * * The definition of e->masks is * - * pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST][2]; + * pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST + 1][2]; * * Since the array size is fixed at 2, we obviously * don't support elements with more than two @@ -3105,7 +3105,7 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m /* If override-maps are different, they're not subsets */ if (a->n_channels != b->n_channels) return FALSE; - for (s = 0; s < SND_MIXER_SCHN_LAST; s++) + for (s = 0; s <= SND_MIXER_SCHN_LAST; s++) if (a->masks[s][a->n_channels-1] != b->masks[s][b->n_channels-1]) { pa_log_debug("Element %s is not a subset - mask a: 0x%" PRIx64 ", mask b: 0x%" PRIx64 ", at channel %d", a->alsa_name, a->masks[s][a->n_channels-1], b->masks[s][b->n_channels-1], s); diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h index 59bd3fbe..fdcff769 100644 --- a/src/modules/alsa/alsa-mixer.h +++ b/src/modules/alsa/alsa-mixer.h @@ -145,7 +145,7 @@ struct pa_alsa_element { long volume_limit; /* -1 for no configured limit */ double min_dB, max_dB; - pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST][2]; + pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST + 1][2]; unsigned n_channels; pa_channel_position_mask_t merged_mask; diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index c88f4cff..ea5188c9 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -140,8 +140,6 @@ struct userdata { pa_rtpoll_item *alsa_rtpoll_item; - snd_mixer_selem_channel_id_t mixer_map[SND_MIXER_SCHN_LAST]; - pa_smoother *smoother; uint64_t write_count; uint64_t since_start; diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 3e593403..2680302c 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -127,8 +127,6 @@ struct userdata { pa_rtpoll_item *alsa_rtpoll_item; - snd_mixer_selem_channel_id_t mixer_map[SND_MIXER_SCHN_LAST]; - pa_smoother *smoother; uint64_t read_count; pa_usec_t smoother_interval; |