I am using Fedora 35 and there is something that is highly annoying to me with audio. As soon as a song or video stops playing, 3 seconds later the audio sink is suspended and this results in a noticeable delay when starting audio playback again. Before WirePlumber, this delay resulting from suspending of the audio sink could be addressed in a configuration file for pipewire-media-session. There is no documentation as far as I can tell for fixing this problem when using WirePlumber. I discovered that the simple fix is to modify a lua script in the WirePlumber script directory.
/usr/share/wireplumber/scripts/ and make a backup of the file
suspend-node.lua somewhere on your system. Then edit the file
suspend-node.lua so that one if statement (which contains another if statement and other commands) in part of the contents of the following section in the file are commented out (use Ctrl+m in Gedit if you have the comment plugin installed, or manually do it):
om:connect("object-added", function (om, node) node:connect("state-changed", function (node, old_state, cur_state) -- Always clear the current source if any local id = node["bound-id"] if sources[id] then sources[id]:destroy() sources[id] = nil end -- Add a timeout source if idle for at least 3 seconds -- if cur_state == "idle" then -- -- honor "session.suspend-timeout-seconds" if specified -- local timeout = -- tonumber(node.properties["session.suspend-timeout-seconds"]) or 3 -- if timeout == 0 then -- return -- end -- -- add idle timeout; multiply by 1000, timeout_add() expects ms -- sources[id] = Core.timeout_add(timeout * 1000, function() -- -- Suspend the node -- Log.info(node, "was idle for a while; suspending ...") -- node:send_command("Suspend") -- -- Unref the source -- sources[id] = nil -- -- false (== G_SOURCE_REMOVE) destroys the source so that this -- -- function does not get fired again after 3 seconds -- return false -- end) -- end end) end) om:activate()
This completely removes the logic for testing if the sink is idle and suspending it, which is exactly what we want. Reboot your computer and it should be fixed. Enjoy your seamless audio now that your soundcard doesn’t get turned off after 3 seconds! I hope this helps some people on Fedora 35 with their audio playback woes.