<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>297784</bug_id>
          
          <creation_ts>2025-08-22 08:34:52 -0700</creation_ts>
          <short_desc>[GStreamer] Cannot switch audio outputs using PipeWire w/ PulseAudio compatibility enabled</short_desc>
          <delta_ts>2025-08-25 02:51:29 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>216880</dependson>
    
    <dependson>297418</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adrian Perez">aperez</reporter>
          <assigned_to name="WebKitGTK+ bugs">bugs-noreply</assigned_to>
          <cc>philn</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2138256</commentid>
    <comment_count>0</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2025-08-22 08:34:52 -0700</bug_when>
    <thetext>Steps to reproduce:

- Have a session with PipeWire running, plus the pipewire-pulse compatibility service.
- Run:  GST_DEBUG=&apos;webkit*:5&apos; run-minibrowser --wpe \
    --features=PerElementSpeakerSelection,ExposeSpeakersWithoutMicrophone,ExposeSpeakers \
     https://people.igalia.com/aperez/joplin.html
- Try changing outputs

What actually happens is that autoaudiosink has chosen pulsesink to produce output, but the capture device manager is using PipeWire to enumerate devices, hence when trying to switch outputs, we attempt to reconfigure a pulsesink using a GstPipeWireDevice, but of course that doesn&apos;t work because the latter can only reconfigure pipewiresink elements!

We can see the mismatch in the logged output:

0:00:11.643063450    37 0x5bb3806fb2b0 DEBUG   webkitcapturedevicemanager GStreamerCaptureDeviceManager.cpp:171:gstreamerDeviceWithUID: Looking for device with UID alsa_output.usb-Generic_KM_B2_Digital_Audio_20210726905926-00.analog-stereo
0:00:11.643149681    37 0x5bb3806fb2b0 DEBUG      webkitmediaplayer MediaPlayerPrivateGStreamer.cpp:4640:audioOutputDeviceChanged:&lt;song-0&gt; Switching to pipewiredevice5&lt;0x7cde64019ff0&gt;, output &apos;KM_B2 Digital Audio Analog Stereo&apos;
0:00:11.643201328    37 0x5bb3806fb2b0 DEBUG      webkitmediaplayer MediaPlayerPrivateGStreamer.cpp:4609:applyAudioSinkDevice:&lt;song-0&gt; Skipped element &apos;autoaudiosink0-actual-sink-pulse&apos; with device pipewiredevice5&lt;0x7cde64019ff0&gt;
0:00:11.643242415    37 0x5bb3806fb2b0 DEBUG      webkitmediaplayer MediaPlayerPrivateGStreamer.cpp:4645:audioOutputDeviceChanged:&lt;song-0&gt; Could not change to audio output device &apos;alsa_output.usb-Generic_KM_B2_Digital_Audio_20210726905926-00.analog-stereo&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138258</commentid>
    <comment_count>1</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2025-08-22 08:40:38 -0700</bug_when>
    <thetext>Of course if the element chosen by autoaudiosink matches what is being used by the device capture manager to enumerate available devices, things work as expected.

I am not sure how to go about fix this, but I do know that autoaudiosink does NOT support telling it which kind of sink to use. Maybe we will have to go through gst_device_create_element() when initially creating the audio sink for the media player pipeline. Or replace the output element from the pipeline with a new one, if we detect that it mismatches what the GstDevice can handle... but I am not sure if this second option can actually be done.

Docs: https://gstreamer.freedesktop.org/documentation/gstreamer/gstdevice.html?gi-language=c#gst_device_create_element</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138578</commentid>
    <comment_count>2</comment_count>
    <who name="Philippe Normand">philn</who>
    <bug_when>2025-08-25 02:51:29 -0700</bug_when>
    <thetext>The PipeWire device provider masks the ALSA device provider when it detects ALSA devices, afaics... https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/gst/gstpipewiredeviceprovider.c?ref_type=heads#L677</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>