Jellyfin Forum
Fix for audio pause bug when using passthrough on Linux - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Fix for audio pause bug when using passthrough on Linux (/t-fix-for-audio-pause-bug-when-using-passthrough-on-linux)



Fix for audio pause bug when using passthrough on Linux - VladtheImpaler - 2024-06-12

I've had a long term problem with Jellyfin Media Player on pipewire. When passing AC3 or DTS over spdif and pausing a video, it would cause audio to start looping the last sound played over and over really fast. It was truly annoying.

It did with every version I tried, the Deb version, the Snap version, the AUR version, the Copr version, building it myself..  It did it on both of my receivers, 1 new Onkyo and 1 old Harmon Kardon. I did it with multiple audio devices, the Soundblaster Z and AE-5 Plus and the Realtek 892 and 1220.

The fix is to change pipewires period-size and headroom.  I've confirmed the fix works on 3 different PC's.  It's possible lower settings will also work, but I'm leaving them at 1024 and 8192 until I encounter problems. 


Wireplumber 0.5 and newer

create:  ~/.config/wireplumber/wireplumber.conf.d/50-alsa-config.conf

add:

monitor.alsa.rules = [
  {
    matches = [
      {
        ## Matches all sources.
        node.name = "~alsa_input.*"
      }
      {
        ## Matches all sinks.
        node.name = "~alsa_output.*"
      }
    ]
    actions = {
      update-props = {
        session.suspend-timeout-seconds = 0
        api.alsa.period-size = 1024
        api.alsa.headroom = 8192
        }
    }
  }
]


Wireplumber older than 0.5

sudo cp -a /usr/share/wireplumber/main.lua.d/50-alsa-config.lua ~/.config/wireplumber/main.lua.d/50-alsa-config.lua

Scroll to the bottom and change:  (remove -- to uncomment)

      ["api.alsa.period-size"]  = 1024,
      ["api.alsa.headroom"]    = 8192,
      --["api.alsa.disable-mmap"]  = false,
      --["api.alsa.disable-batch"] = false,
      ["session.suspend-timeout-seconds"] = 0
    },



Reboot or restart wireplumber

systemctl --user restart wireplumber