Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shm multi audio fix #963

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions modules/common/services/audio.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ in
default = 4714;
description = "TCP port used by Pipewire-pulseaudio control";
};
pulseaudioUnixSocketPath = mkOption {
josa41 marked this conversation as resolved.
Show resolved Hide resolved
type = types.path;
default = "/run/pipewire/pulseaudio-0";
description = "Path to Unix socket used by Pipewire-pulseaudio service";
};
pulseaudioUseShmem = mkOption {
type = types.bool;
default = true;
description = "Use shared memory for audio service";
};
};

config = mkIf cfg.enable {
Expand All @@ -46,16 +56,17 @@ in
{
name = "libpipewire-module-protocol-pulse";
args = {
# Enable TCP socket for VMs pulseaudio clients
# Enable Unix or TCP socket for VMs pulseaudio clients
"server.address" = [
{
address = "tcp:0.0.0.0:${toString cfg.pulseaudioTcpPort}";
address =
if cfg.pulseaudioUseShmem then
"unix:${cfg.pulseaudioUnixSocketPath}"
else
"tcp:0.0.0.0:${toString cfg.pulseaudioTcpPort}";
"client.access" = "restricted";
}
];
"pulse.min.req" = "1024/48000";
"pulse.min.quantum" = "1024/48000";
"pulse.idle.timeout" = "3";
};
}
{
Expand Down Expand Up @@ -160,9 +171,12 @@ in
};

# Open TCP port for the pipewire pulseaudio socket
networking.firewall.allowedTCPPorts = [
cfg.pulseaudioTcpPort
cfg.pulseaudioTcpControlPort
];
networking.firewall.allowedTCPPorts =
[
cfg.pulseaudioTcpControlPort
]
++ lib.optionals (!cfg.pulseaudioUseShmem) [
cfg.pulseaudioTcpPort
];
};
}
Loading