Skip to content

fix bumping/jumping/popping audio, fixes Mobian-team/devices/qcom-support#8

This MR addressed the "bumping audio" (or however you want to call it) shown in the video (ref: qcom-linux#11_564656)

VID_20241223_133059_360px

I've seen this same issue on an enchilada with up-to-date trixie and 6.6.23 kernel. That kernel has been used for months and it's known to work fine. Then this specific issue with bumping audio is not related to the kernel: I think it's probably related to an update in wireplumber, but this is still an untested theory.

sink's properties
Linux mobian 6.6-qcom #1 SMP PREEMPT Thu Mar 28 13:42:07 UTC 2024 aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Dec 24 16:46:06 2024 from 192.168.1.103
marco@mobian:~$ dpkg -l | grep linux-image-6.
ii  linux-image-6.6-qcom                                     6.6.23+qcom-1                          arm64        Linux 6.6 for qcom devices
marco@mobian:~$ cat /usr/share/wireplumber/wireplumber.conf.d/50-qcom-phone-tweaks.conf 
monitor.alsa.rules = [
  {
    matches = [
      {
        # Matches all sources
        node.name = "~alsa_input.*"
      },
      {
        # Matches all sinks
        node.name = "~alsa_output.*"
      }
    ]
    actions = {
      update-props = {
        audio.format           = "S16LE"
     }
    }
  }
]
marco@mobian:~$ wpctl status
PipeWire 'pipewire-0' [1.2.6, marco@mobian, cookie:1222199824]
 └─ Clients:
        33. pipewire                            [1.2.6, marco@mobian, pid:1105]
        35. WirePlumber                         [1.2.6, marco@mobian, pid:1103]
        47. WirePlumber [export]                [1.2.6, marco@mobian, pid:1103]
        48. kwin_wayland                        [1.2.6, marco@mobian, pid:1233]
        49. QtPulseAudio:1315                   [1.2.6, marco@mobian, pid:1315]
        50. libcanberra                         [1.2.6, marco@mobian, pid:1423]
        71. xdg-desktop-portal                  [1.2.6, marco@mobian, pid:1264]
        72. CallAudio                           [1.2.6, marco@mobian, pid:1640]
        73.                                     [1.2.6, marco@mobian, pid:1423]
        74. chatty                              [1.2.6, marco@mobian, pid:1785]
        75. Chats                               [1.2.6, marco@mobian, pid:1785]
        76.                                     [1.2.6, marco@mobian, pid:1488]
        99. wpctl                               [1.2.6, marco@mobian, pid:2407]

Audio
 ├─ Devices:
 │      51. Built-in Audio                      [alsa]

 ├─ Sinks:
 │      56. Built-in Audio Headphones           [vol: 1.00]
 │  *   57. Built-in Audio Speaker              [vol: 1.00]

 ├─ Sources:
 │      58. Built-in Audio Headset Microphone   [vol: 1.00]
 │      59. Built-in Audio Top Microphone       [vol: 1.00]
 │  *   60. Built-in Audio Bottom Microphone    [vol: 1.00]

 ├─ Filters:

 └─ Streams:
        77.                                                             
             80. input_FL        < Speaker:monitor_FL   [active]
             81. monitor_FL     
             82. input_FR        < Speaker:monitor_FR   [active]
             83. monitor_FR     
        78.                                                             
             86. input_FL        < Top Microphone:capture_FL    [active]
             87. monitor_FL     
             88. input_FR        < Top Microphone:capture_FR    [active]
             89. monitor_FR     
        79.                                                             
             92. input_FL        < Bottom Microphone:capture_FL [active]
             93. monitor_FL     
             94. input_FR        < Bottom Microphone:capture_FR [active]
             95. monitor_FR     

Video
 ├─ Devices:
 │      34. Qualcomm Venus video decoder        [v4l2]
 │      46. Qualcomm Venus video encoder        [v4l2]

 ├─ Sinks:

 ├─ Sources:

 ├─ Filters:

 └─ Streams:

Settings
 └─ Default Configured Devices:
         0. Audio/Sink    alsa_output.platform-sound.HiFi__Headphones__sink
         1. Audio/Source  alsa_input.platform-sound.HiFi__Headset__source
marco@mobian:~$ wpctl inspect 57
id 57, type PipeWire:Interface:Node
    alsa.card = "0"
    alsa.card_name = "OnePlus 6"
    alsa.class = "generic"
    alsa.device = "2"
    alsa.driver_name = "snd_soc_sdm845"
    alsa.id = "MultiMedia3 (*)"
    alsa.long_card_name = "OnePlus 6"
    alsa.mixer_device = "_ucm0001.hw:O6"
    alsa.name = ""
    alsa.resolution_bits = "16"
    alsa.subclass = "generic-mix"
    alsa.subdevice = "0"
    alsa.subdevice_name = "subdevice #0"
    alsa.sync.id = "00000000:00000000:00000000:00000000"
    api.alsa.card.longname = "OnePlus 6"
    api.alsa.card.name = "OnePlus 6"
    api.alsa.headroom = "512"
    api.alsa.open.ucm = "true"
    api.alsa.path = "hw:O6,2"
    api.alsa.pcm.card = "0"
    api.alsa.pcm.stream = "playback"
    api.alsa.period-num = "8"
    api.alsa.period-size = "512"
    audio.channels = "2"
    audio.format = "S16LE"
    audio.position = "FL,FR"
    card.profile.device = "3"
  * client.id = "47"
    clock.quantum-limit = "8192"
    device.api = "alsa"
    device.class = "sound"
  * device.id = "51"
    device.profile.description = "Speaker"
    device.profile.name = "HiFi: Speaker: sink"
    device.routes = "1"
  * factory.id = "19"
    factory.name = "api.alsa.pcm.sink"
    library.name = "audioconvert/libspa-audioconvert"
  * media.class = "Audio/Sink"
  * node.description = "Built-in Audio Speaker"
    node.driver = "true"
    node.loop.name = "data-loop.0"
    node.max-latency = "2048/48000"
  * node.name = "alsa_output.platform-sound.HiFi__Speaker__sink"
  * node.nick = "Speaker"
    node.pause-on-idle = "false"
  * object.path = "alsa:acp:O6:3:playback"
  * object.serial = "57"
    port.group = "playback"
  * priority.driver = "712"
  * priority.session = "712"
marco@mobian:~$ 

As you can see by comparing the wpctl inspect outcome with the actual 50-qcom-phone-tweaks.conf, when you let wireplumber set node's parameter by itself:

  • audio.rate is not even mentioned, maybe it's not relevant? Or maybe it defaults to 48kHz then there's no need to set it?
  • api.alsa.period-size becomes 512 instead of 4096
  • api.alsa.period-num becomes 8 instead of 6
  • api.alsa.headroom stays at 512

I've also checked that audio.format = "S16LE" is still required.

Looking at the commit starting all this wireplumber conf thing, the commit description hints that playing with node's parameters was done in the first place to fix such kind of issues. If it's not related to last wireplumber update, I expect some other recent change in the audio stack requiring this new conf. I'm still surprised that on the pmOS side they haven't already changed the wireplumber conf so far, and that I seem to be the only one experiencing this in Mobian...

For now, this MR can stay in draft status, waiting to get more info/test. At least with this, I can listen to podcasts again 😄

cc @erebion @a-wai

Merge request reports

Loading