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

pipewire: 0.3.15 -> 0.3.16 #104553

Merged
merged 1 commit into from Nov 26, 2020
Merged

pipewire: 0.3.15 -> 0.3.16 #104553

merged 1 commit into from Nov 26, 2020

Conversation

jansol
Copy link
Contributor

@jansol jansol commented Nov 22, 2020

Changes: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/09d373f094f0e6797aef3d97cde2c0167dccc986

Follow-up on #104504. Feel free to open a replacement PR if someone ends up finishing work on this while I'm asleep. (@primeos)

Not sure if we want to deal with coexistence actual pulseaudio and pipewire.pulse-server in the nixos module at all, feel free to remove that bit if the consensus is no.

Bluetooth would be nice to have a setting for since it is off by default due to conflicts with pulseaudio, but that can be done separately if it takes too much time to figure out now. I'm not familiar with modifying applications' config files from within nix.

Motivation for this change

Upstream update that should fix a lot of the current pulseaudio woes by throwing out the libpulseaudio shim and instead providing a module that acts as a fake pulseaudio server.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)

  • Built on platform(s)

    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)

  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"

  • Tested execution of all binary files (usually in ./result/bin/)

  • Determined the impact on package closure size (by running nix path-info -S before and after)

  • Ensured that relevant documentation is up to date

  • Fits CONTRIBUTING.md.

Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks! I've added a few of my nitpicks/thoughts. Not sure how WIP this is so feel free to ignore them for now ;)

nixos/modules/services/desktops/pipewire.nix Outdated Show resolved Hide resolved
nixos/modules/services/desktops/pipewire.nix Outdated Show resolved Hide resolved
nixos/modules/services/desktops/pipewire.nix Outdated Show resolved Hide resolved
nixos/modules/services/desktops/pipewire.nix Outdated Show resolved Hide resolved
nixos/modules/services/desktops/pipewire.nix Outdated Show resolved Hide resolved
@jansol jansol force-pushed the pipewire branch 3 times, most recently from ad96082 to 96fd13e Compare November 22, 2020 12:47
@jansol jansol marked this pull request as ready for review November 22, 2020 12:50
@jansol
Copy link
Contributor Author

jansol commented Nov 22, 2020

Removed bluetooth option for now to make this mergeable sooner.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 22, 2020

@jtojnar
Copy link
Contributor

jtojnar commented Nov 22, 2020

There is also another path in

https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/7ca8491be3a730cba61ea0578b654a83bcdd552c/src/daemon/meson.build#L21

but if I am not missing something, that is only used in a comment in the config file:

https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/7ca8491be3a730cba61ea0578b654a83bcdd552c/src/daemon/pipewire.conf.in

and would cause a dependency cycle if corrected. We might need to watch monitor it in case it gets used somewhere else in the future.

@jansol
Copy link
Contributor Author

jansol commented Nov 22, 2020

The path to the pulse server needs to be patched at least here

What's the preferred way to generate patches for nixpkgs?

but if I am not missing something, that is only used in a comment in the config file

Yeah that is only for when one wants to launch pipewire with the pulse bridge loaded automatically. The comment even mentions that loading the pulse bridge with a systemd service is preferred. And that's this PR is doing now, assuming I got it right.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 22, 2020

What's the preferred way to generate patches for nixpkgs?

I just clone the repo, change something and then do git diff > foo.patch. Others prefer using quilt but I haven’t figured that out yet.

This release replaces the libpulseaudio shim with a pipewire module that acts as a fake pulseaudio server along with a systemd service that loads that module on demand.
@jtojnar
Copy link
Contributor

jtojnar commented Nov 25, 2020

Hmm, the pulse server does not seem to work for me in a VM.

On startup:

Nov 25 22:48:15 nixos pipewire-media-session[1146]: could not make thread realtime: No such file or directory
Nov 25 22:48:16 nixos pipewire-pulse[961]: pulse-server 0x5107c0: [GNOME Shell Volume Control] ERROR command:27 (GET_CLIENT_INFO) tag:13 error:5 (No such file or directory)
Nov 25 22:48:16 nixos pipewire-pulse[961]: pulse-server 0x5107c0: [GNOME Shell Volume Control] ERROR command:88 (GET_CARD_INFO) tag:14 error:5 (No such file or directory)

On playing music

Nov 25 22:50:06 nixos pipewire-pulse[961]: Failed to mlock memory 0x7fd93c124000 32832: This is not a problem but for best performance, consider increasing RLIMIT_MEMLOCK
Nov 25 22:50:06 nixos pipewire[1124]: (alsa_output.pci-0000:00:09.0.analog-stereo-38) XRun! count:1 time:131709585 delay:76551 max:76551
Nov 25 22:50:07 nixos pipewire-pulse[961]: pulse-server 0x580030: [Music] ERROR command:14 (GET_PLAYBACK_LATENCY) tag:22 error:5 (No such file or directory)
Nov 25 22:50:07 nixos pipewire[1124]: alsa-pcm 0x9a1988: snd_pcm_avail after recover: Broken pipe
Nov 25 22:50:07 nixos pipewire-pulse[961]: core 0x591060: proxy 0x591060 id:0: bound:-1 seq:146 res:-22 (Invalid argument) msg:"unknown resource 30 op:2"
Nov 25 22:50:07 nixos pipewire-pulse[961]: core 0x591060: proxy 0x591060 id:0: bound:-1 seq:148 res:-22 (Invalid argument) msg:"unknown resource 30 op:2"
Nov 25 22:50:07 nixos pipewire-pulse[961]: core 0x5134a0: proxy 0x5134a0 id:0: bound:-1 seq:130 res:-22 (Invalid argument) msg:"unknown resource 29 op:2"
Nov 25 22:50:07 nixos pipewire-pulse[961]: core 0x5134a0: proxy 0x5134a0 id:0: bound:-1 seq:132 res:-22 (Invalid argument) msg:"unknown resource 29 op:2"
Nov 25 22:50:07 nixos pipewire-media-session[1146]: core 0x157b600: proxy 0x157b600 id:0: bound:-1 seq:238 res:-22 (Invalid argument) msg:"unknown resource 51 op:2"
Nov 25 22:50:07 nixos pipewire-media-session[1146]: error id:0 seq:238 res:-22 (Invalid argument): unknown resource 51 op:2
Nov 25 22:50:07 nixos pipewire-media-session[1146]: core 0x157b600: proxy 0x157b600 id:0: bound:-1 seq:240 res:-22 (Invalid argument) msg:"unknown resource 51 op:2"
Nov 25 22:50:07 nixos pipewire-media-session[1146]: error id:0 seq:240 res:-22 (Invalid argument): unknown resource 51 op:2
Nov 25 22:50:07 nixos pipewire-pulse[961]: core 0x53c590: proxy 0x53c590 id:0: bound:-1 seq:122 res:-22 (Invalid argument) msg:"unknown resource 29 op:2"
Nov 25 22:50:07 nixos pipewire-pulse[961]: core 0x53c590: proxy 0x53c590 id:0: bound:-1 seq:124 res:-22 (Invalid argument) msg:"unknown resource 29 op:2"
Nov 25 22:50:07 nixos pipewire-pulse[961]: pulse-server 0x5398b0: [GNOME Volume Control Media Keys] ERROR command:29 (GET_SINK_INPUT_INFO) tag:20 error:5 (No such file or directory)
Nov 25 22:50:07 nixos pipewire[1124]: alsa-pcm 0x9a1988: snd_pcm_avail after recover: Broken pipe
Nov 25 22:50:07 nixos pipewire[1124]: 3 events suppressed
Nov 25 22:50:07 nixos pipewire[1124]: (alsa_output.pci-0000:00:09.0.analog-stereo-38) XRun! count:5 time:132283432 delay:8622 max:303724
Nov 25 22:50:07 nixos pipewire[1124]: alsa-pcm 0x9a1988: snd_pcm_avail after recover: Broken pipe
Nov 25 22:50:07 nixos pipewire[1124]: alsa-pcm 0x9a1988: snd_pcm_avail after recover: Broken pipe
Nov 25 22:50:08 nixos pipewire[1124]: alsa-pcm 0x9a1988: snd_pcm_avail after recover: Broken pipe
Nov 25 22:50:08 nixos pipewire[1124]: alsa-pcm 0x9a1988: snd_pcm_avail after recover: Broken pipe
Nov 25 22:50:09 nixos pipewire[1124]: alsa-pcm 0x9a1988: snd_pcm_avail after recover: Broken pipe
Nov 25 22:50:09 nixos pipewire[1124]: alsa-pcm 0x9a1988: snd_pcm_avail after recover: Broken pipe
Nov 25 22:50:09 nixos pipewire[1124]: 21 events suppressed
VM config

I ran the following command nixos-rebuild build-vm -I nixpkgs=$HOME/Projects/nixpkgs -I nixos-config=pipewire-pulse.nix:

{ pkgs, config, ... }: {
  environment.systemPackages = with pkgs; [
    gdb
    binutils # readelf
    file
    htop
    less
    git
    rr
    valgrind
    dfeet
  ];
  environment.enableDebugInfo = true;
  services.xserver = {
    enable = true;
    layout = "cz";
    xkbVariant = "qwerty";

    displayManager.gdm.enable = true;
    displayManager.autoLogin.enable = true;
    displayManager.autoLogin.user = "jtojnar";

    desktopManager.xterm.enable = false;
    desktopManager.gnome3.enable = true;
  };

  services.openssh.enable = true;
  hardware.pulseaudio.enable = false;
  services.pipewire.pulse.enable = true;

  users.extraUsers.jtojnar = {
    isNormalUser = true;
    uid = 1000;
    extraGroups = [ "wheel" "networkmanager" ];
    password = "";
    openssh.authorizedKeys.keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYbOlZydfRRCGCT08wdtPcpfSrgxMc6weDx3NcWrnMpVgxnMs3HozzkaS/hbcZUocn7XbCOyaxEd1O8Fuaw4JXpUBcMetpPXkQC+bZHQ3YsZZyzVgCXFPRF88QQj0nR7YVE1AeAifjk3TCODstTxit868V1639/TVIi5y5fC0/VbYG2Lt4AadNH67bRv8YiO3iTsHQoZPKD1nxA7yANHCuw38bGTHRhsxeVD+72ThbsYSZeA9dBrzACpEdnwyXclaoyIOnKdN224tu4+4ytgH/vH/uoUfL8SmzzIDvwZ4Ba2yHhZHs5iwsVjTvLe7jjE6I1u8qY7X8ofnanfNcsmz/ jtojnar@kaiser"];
  };

  virtualisation.qemu.options = [ "-device intel-hda -device hda-duplex" ];
  virtualisation.memorySize = 2048;
  virtualisation.diskSize = 8048;
}

Also had to add LD_LIBRARY_PATH=/nix/store/pqxym29swx6ydfql9ypnqcdlbck3dby8-alsa-plugins-1.2.2/lib/alsa-lib but that might be Ubuntu specific.

@ashkitten
Copy link
Contributor

it works fine for me on my computer fwiw, i've been using it with little issue for a few days.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 25, 2020

Guess we can merge it then.

@jansol
Copy link
Contributor Author

jansol commented Nov 25, 2020

Rebuilt my system into this with all compat layers enabled (alsa, jack, pulse) and so far everything is working great except telegram-desktop which complains about timeouts when connecting to pulse streams.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 25, 2020 via email

@jtojnar jtojnar merged commit e95cc85 into NixOS:master Nov 26, 2020
@collares
Copy link
Member

Telegram hits a known bug in 0.3.16, fixed in 0.3.17: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants