GNOME Bugzilla – Bug 486840
[alsamixer] use _all variants when setting the mixer
Last modified: 2008-01-07 14:02:21 UTC
See: https://bugzilla.redhat.com/show_bug.cgi?id=305501 alsa-lib sometimes gives us different answer to _get() when _set()'ing the volumes quickly. 1. Launch gnome-volume-control 2. Check that the master track's channels are locked 3. Change the volume quickly, the 2 channels will become unlocked (the 2 tracks end up with different volumes) I debugged this in gst-plugins-base's gstalsamixer.c: A quick succession of snd_mixer_selem_set_playback_volume and snd_mixer_selem_get_playback_volume will result in 2 slightly different results. I add those lines in gst_alsa_mixer_get_volume(): if (track->num_channels == 2 && volumes[0] != volumes[1]) printf ("volumes[0]: %d volumes[1]: %d\n", volumes[0], volumes[1]); And saw this after dragging the sliders for a while: volumes[0]: 31 volumes[1]: 21 etc. The attached patch makes the set() use the _all() variants if all the tracks are set to have the same volume.
Created attachment 97240 [details] [review] gst-alsa-mixer-use-all.patch
Do you know _why_ this happens? Your patch looks like a hack to work around a problem in alsa to me, but maybe I'm just not getting the real issue.
(In reply to comment #2) > Do you know _why_ this happens? No, I don't, which is why I've left the original bug against alsa-lib opened. > Your patch looks like a hack to work around a > problem in alsa to me, but maybe I'm just not getting the real issue. It is a work-around. It's not that much of a hack though, as we should use the _all variants when possible.
Oh well: 2008-01-07 Tim-Philipp Müller <tim at centricular dot net> Patch by: Bastien Nocera <hadess at hadess net> * ext/alsa/gstalsamixer.c: (gst_alsa_mixer_get_volume), (check_if_volumes_are_the_same), (gst_alsa_mixer_set_volume): Use snd_mixer_selem_set_{playback|capture}_volume_all() if the volume is the same for all channels. This works around some problem in alsa that leaves us with inconsistent state for some reason (#486840). (I took the liberty to make the function return a boolean when it actually returns booleans :))