Summary: | incoherent muting of ALSA channels (mutes master, headphone and speaker, but unmutes only master, when adjusting in alsamixer or equivalent) | ||
---|---|---|---|
Product: | PulseAudio | Reporter: | Horst Schirmeier <horst> |
Component: | misc | Assignee: | pulseaudio-bugs |
Status: | RESOLVED MOVED | QA Contact: | pulseaudio-bugs |
Severity: | normal | ||
Priority: | medium | CC: | 8, lennart |
Version: | unspecified | ||
Hardware: | x86-64 (AMD64) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | pcm_playback_switch need to be on instead of mute |
Description
Horst Schirmeier
2014-06-11 09:12:53 UTC
I suppose this has nothing to do with GStreamer. Can you reproduce this simpy by muting and unmuting the sink with pactl? The command to use is "set-sink-mute", see man pactl for details. Changing "switch = mute" to "switch = on" is not a proper fix. "switch = mute" means that the switch state should follow the sink mute state, so unmuting the sink in pulseaudio should unmute the switch in alsa too. No, I cannot reproduce the behavior with "pactl set-sink-mute 0 toggle". Running this once mutes "Master", "Headphone" and "PCM" in alsamixer. Running this a second time correctly unmutes all three. Ok, then I guess xfce4-volumed is accessing alsa directly, instead of doing the muting through pulseaudio. Explanation for the inconsistency between muting and unmuting: xfce4-volumed sets the Master switch to muted. PulseAudio notices that something happened in the alsa mixer, and sees that one of the switches is muted, so PulseAudio concludes that the device is muted and sets the internal device state to mute. While setting the internal state, pulseaudio also mutes the rest of the switches marked as "switch = mute", including PCM. When xfce4-volumed unmutes the Master switch, PulseAudio again notices that something happened, but since the PCM switch is still muted, PulseAudio concludes that the device is still muted and does nothing. xfce4-volumed should be changed to talk to pulseaudio instead of accessing the alsa mixer directly. Or another solution would be to change pulseaudio so that it caches the alsa mixer state, so when one switch is unmuted, pulseaudio would be able to figure out that unmuting happened. Without caching this is not possible, because the only notification we get from alsa is that "something changed". But from architecture point of view I think there should be only one component that is controlling the alsa mixers, and that component should be pulseaudio, so changing xfce4-volumed makes more sense than changing pulseaudio to cope with other components fiddling with the alsa mixers. As I said in the description: We think we tracked this down not to be an issue with ALSA or xfce4-volumed. The problem also occurs using a different window manager (I tried it with Unity IIRC), and it disappears when deinstalling PulseAudio. I may be drawing wrong conclusions here, though. Please instruct me on which experiments to conduct to gather more information. Unmuting via pulseaudio works fine, so whatever does the unmuting when you press the mute button on your laptop is, with very very high probability, not using pulseaudio. I had a look at xfce4-volumed code, and it seems to rely on GstMixer. xfce4-volumed doesn't seem to care about the mixer implementation, it will just use the first mixer implementation that it finds. That might very well be an implementation based on alsa, not pulseaudio. you need to log the changes of alsa playback volume and switch made by pulseaudio when it switch path only the driver know which control belong to the audio path of headphone, line out and speaker for business desktop, notebook or home desktop https://launchpadlibrarian.net/166342784/alsa-info.txt.q27ddho7BC Node 0x0a [Pin Complex] wcaps 0x400181: Stereo Control: name="Headphone Jack", index=0, device=0 Pincap 0x0000001c: OUT HP Detect Pin Default 0x0421101f: [Jack] HP Out at Ext Right Conn = 1/8, Color = Black DefAssociation = 0x1, Sequence = 0xf Pin-ctls: 0xc0: OUT HP Unsolicited: tag=01, enabled=1 Connection: 3 0x10 0x11* 0x17 Node 0x0d [Pin Complex] wcaps 0x400181: Stereo Control: name="Speaker Phantom Jack", index=0, device=0 Pincap 0x00000014: OUT Detect Pin Default 0x90170110: [Fixed] Speaker at Int N/A Conn = Analog, Color = Unknown DefAssociation = 0x1, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Unsolicited: tag=00, enabled=0 Connection: 3 0x10* 0x11 0x17 Node 0x0f [Pin Complex] wcaps 0x400181: Stereo Control: name="Dock Line Out Jack", index=0, device=0 Pincap 0x00000014: OUT Detect Pin Default 0x23011050: [Jack] Line Out at Sep Left Conn = 1/8, Color = Black DefAssociation = 0x5, Sequence = 0x0 Pin-ctls: 0x40: OUT Unsolicited: tag=02, enabled=1 Connection: 3 0x10* 0x11 0x17 Node 0x10 [Audio Output] wcaps 0xd0c05: Stereo Amp-Out R/L Control: name="PCM Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="PCM Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="92HD71B7X Analog", type="Audio", device=0 Amp-Out caps: N/A Amp-Out vals: [0x6d 0x6d] Converter: stream=8, channel=0 Power states: Power: setting=D0, actual=D0 Delay: 13 samples Node 0x11 [Audio Output] wcaps 0xd0c05: Stereo Amp-Out R/L Control: name="Headphone Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Headphone Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: N/A Amp-Out vals: [0x6d 0x6d] Converter: stream=8, channel=0 Power states: Power: setting=D0, actual=D0 Delay: 13 samples Created attachment 101077 [details] [review] pcm_playback_switch need to be on instead of mute as pcm playback switch is regarded by pulseaudio as common to all paths, it should be on instead of mute I don't follow. PulseAudio uses PCM for all paths, but why does that imply that PCM should not be muted when the sink is muted? https://launchpadlibrarian.net/178486562/PulseList.txt e.g hda codec cs4213 has only one hardware volume control for both headphone and speaker when did pulseaudio setup those control which is common To all paths ? When the port changes from headphones to speakers, for example, alsa mixer is updated at that point to reflect the previously saved state of the speakers port. BTW, I'm seeing this on a Dell Latitude E4300, too. (Not surprising, as it's also using a 82801I.) What else do you need to fix this? http://mailman.alsa-project.org/pipermail/alsa-devel/2014-October/082334.html pcm volume of some hda codecs seem to be renamed but the name of ac97 codecs are unlikely to be changed Raymond, your comment is, again, very cryptic. How is this related to my problem, what am I supposed to do about it, and what needs to be changed to fix the issue? I'm not into PulseAudio details, so please tell me exactly what to do (if the comment was directed to me at all, and not rather another PulseAudio developer). For example, if I am supposed to provide log output, tell me how to enable logging (for the particular tool/daemon), where to find the log file, and what action I need to trigger to provoke something interesting to be logged (e.g., press the "mute" button twice). you have to follow if your dell e430 use stac9200 which is a two channel hda codec http://mailman.alsa-project.org/pipermail/alsa-devel/2014-October/083128.html I don't think the Dell Latitude E4300 has a stac9200. Again, if you talk about some funny ALSA or PulseAudio details, please tell me on what information to provide here, and how to gather it. I'm just *guessing* the output of "aplay -l" or alsamixer may be relevant here (is it?): $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: 92HD71B7X Analog [92HD71B7X Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 alsamixer says "Card: HDA Intel" and "Chip: Intel Cantiga HDMI". And, just to reiterate my initial bug report (as you're pointing me to an ALSA mailing list thread): "- We already tracked this down not to be an issue with ALSA or xfce4-volumed: The problem also occurs using a different window manager, and it disappears when deinstalling PulseAudio." it is because your notebook have speaker, headphone and dock line out with two audio output david 's patch is to change "pcm" to "speaker+LO" for those with 2+2 HDA codec and three ports for those notebook with dock headphone, you need to follow up with Tiwai Node 0x10 [Audio Output] wcaps 0xd0c05: Stereo Amp-Out R/L Control: name="PCM Playback Volume", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="PCM Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Device: name="92HD71B7X Analog", type="Audio", device=0 Amp-Out caps: N/A Amp-Out vals: [0x6d 0x6d] Converter: stream=8, channel=0 Power states: Power: setting=D0, actual=D0 Delay: 13 samples for those two channel ac97 codec and some for channel ac97 codec ac97 analog mixer have many input : DAC, mic , line in, CD, Aux, pcm playback volume/switch control the DAC input to AC97 analog mixer ac97 analog mixer has it own ouput volume controls which are master playback volume/switch and mono playback for those hda codecs which have ac97 like analog mixer (e.g. ad1986a, vt1708,...) the alsa driver already removed the corresponding "PCM" playback volume and playback switch when those codec use hda_generic.c to create the controls it use set volume to 0dB and unmute without creating any control the remaing hda codecs are those without analog mixer need change of control name to indicate whether it is shared by two or more ports http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-November/022241.html What are you saying? That the core reason for the bug is known and worked on? Or do you need more input from me to analyze the issue? you need to add some code in alsa-sink.c or alsa-util.c to log all the mute switch/volume events when pulseaudio change those alsa playback switch/volume to prove the mute of pcm playback switch is done by pulseaudio instead of driver or other alsa application You need to log e->alsa_name and value of b for snd_mixer_selem_set_playback_switch_all in http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/alsa-mixer.c static int element_set_switch(pa_alsa_element *e, snd_mixer_t *m, bool b) { snd_mixer_elem_t *me; snd_mixer_selem_id_t *sid; int r; pa_assert(m); pa_assert(e); SELEM_INIT(sid, e->alsa_name); if (!(me = snd_mixer_find_selem(m, sid))) { pa_log_warn("Element %s seems to have disappeared.", e->alsa_name); return -1; } if (e->direction == PA_ALSA_DIRECTION_OUTPUT) r = snd_mixer_selem_set_playback_switch_all(me, b); else r = snd_mixer_selem_set_capture_switch_all(me, b); and log the path name int pa_alsa_path_set_mute(pa_alsa_path *p, snd_mixer_t *m, bool muted) { pa_alsa_element *e; pa_assert(m); pa_assert(p); if (!p->has_mute) return -1; PA_LLIST_FOREACH(e, p->elements) { if (e->switch_use != PA_ALSA_SWITCH_MUTE) continue; if (element_set_switch(e, m, !muted) < 0) return -1; } return 0; } this mean that when pulseaudio switch from path A to path B, the mute switch which is common to both path should not set to PA_ALSA_SWITCH_MUTE this also imply those elements in output.common should not set to PA_ALSA_SWITCH_MUTE you should send your patch to pulseaudio-discuss mailing list for review seem new bug as the driver already changed by this patch, this create a Line out playback volume when the computer only have speaker and header https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_generic.c?id=3abb4f4d0e7aaad0d12004b5057f4486a688752b Please note, that if you use Indicator Plugin or pavucontrol to unmute, it also unmutes several channels. (In reply to Raymond from comment #26) > seem new bug as the driver already changed by this patch, this create a Line > out playback volume when the computer only have speaker and header > > https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/ > pci/hda/hda_generic.c?id=3abb4f4d0e7aaad0d12004b5057f4486a688752b Yes, different bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1433568 Suggestion in the last paragraph: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1436269/comments/5 Update: another workaround when using xfce4-mixer (or Xfce Audio Mixer in panel): Choose Playback:...(PulseAudio Mixer) instead of (Alsa mixer) as sound card in properties. (In reply to Jarno Suni from comment #30) > Update: another workaround when using xfce4-mixer (or Xfce Audio Mixer in > panel): Choose Playback:...(PulseAudio Mixer) instead of (Alsa mixer) as > sound card in properties. Confirmed. This works around the symptoms for me. Thanks! -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/540. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.