[pulseaudio-discuss] Switching output ports across sound cards will cause the Headphone to be silent.

Sean Greenslade sean at seangreenslade.com
Mon Nov 20 08:47:17 UTC 2023


On Mon, Nov 20, 2023 at 03:03:41PM +0800, 赵成义 wrote:
> > OK, so your custom client application is deliberately changing the
> > default sink? Note that just changing the default sink will not move
> > existing sink input streams. You will need to do that yourself, for
> > example with the pa_context_move_sink_input_by_index function.
> 
> 
> 
> Hi Sean,
> 
> 
> In fact, the sink-input has been moved correctly. If the speaker port is closed, this problem will not occur.
> 
> 
> 
> I think this is a kernel problem. At that time, the speaker was always on and switching between sound cards 
> 
> was performed when the headphone was plugged and unplugged.
> 
> 
> 
> logs:
> -----------
> 
> 11月 20 13:40:10.689190 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: configured_default_sink: alsa_output.pci-0000_00_1f.3.analog-stereo -> alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo
> 11月 20 13:40:10.689190 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: default_sink: alsa_output.pci-0000_00_1f.3.analog-stereo -> alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo
> 11月 20 13:40:10.689623 uos60-PC pulseaudio[8944]: D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.pci-0000_00_1f.3.analog-stereo becomes idle, timeout in 2 seconds.
> 11月 20 13:40:10.689623 uos60-PC pulseaudio[8944]: D: [pulseaudio] sink-input.c: Starting to move sink input 0 from 'alsa_output.pci-0000_00_1f.3.analog-stereo'

I'm unable to reproduce the behavior you are describing. I tried on
several machines with both internal soundcards and a USB sound card
attached, and I was able to move sink inputs between the two cards
immediately after plugging in headphones with no issues.

As a next step, you should try to determine where in the stack the issue
is. Your logs don't have any smoking guns in them, so I would get your
system into the problematic state while your audio source is running,
then check everything starting at the source of the audio:
- Audio player is actually playing media (e.g. not paused)
- Pulse APIs are consuming audio samples (e.g. not stalled)
- Pulse reports that the sink input is not corked, not muted, and set at
  a reasonable volume level
- Pulse reports that the sink input is routed to the correct sink
- Pulse reports that the sink is running, not muted, set to a reasonable
  volume, and has the correct active port
- Alsamixer shows the device master channel as unmuted and at
  approximately the same volume that pulse reports
- Alsamixer shows the intended port's channel at 100% volume and not
  muted

--Sean



More information about the pulseaudio-discuss mailing list