Skip to content

pulseaudio: enable advanced bluetooth codecs#168012

Merged
SuperSandro2000 merged 7 commits intoNixOS:stagingfrom
schmittlauch:pulseaudio-advanced-bluetooth-codecs
Apr 21, 2022
Merged

pulseaudio: enable advanced bluetooth codecs#168012
SuperSandro2000 merged 7 commits intoNixOS:stagingfrom
schmittlauch:pulseaudio-advanced-bluetooth-codecs

Conversation

@schmittlauch
Copy link
Copy Markdown
Member

@schmittlauch schmittlauch commented Apr 9, 2022

Description of changes

Pulseaudio-15.0 features support for additional advanced bluetooth audio codecs such as aptX or ldac. These are provided by gstreamer, which had been disabled so far.
This PR builds pulseaudio with gstreamer and enables aptX support.

It depends on (or already includes the changes of) PR #167983

Discussion, Call for Feedback
  1. As adding gstreamer as a dependency increases the closure size of pulseaudio, I am open to hide this feature behind a flag and only enable it in pulseaudioFull. On the other hand, supporting all possible codecs might be expected when enabling bluetooth support already.

  2. I need testers with bluetooth devices supporting aptX and ldac for this. Both codecs are exposed successfully to bluetoothd and I successfully tested aptX on a device, but do not have any bluetooth audio hardware supporting ldac.

Testing instructions:
It'd be best if you can rebuild your whole system against this branch or at least use nixos-unstable as a base. I only dared to throw in this pulseaudioFull package into an otherwise stable release on my production machine.
Recent pavucontrol releases include support for switching bluetooth audio codecs (see screenshot below). If you have a device that is known to support aptX or ldac, please check whether that codec appears in the list.

Screenshot_20220408_201751

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@schmittlauch schmittlauch added this to the 22.05 milestone Apr 9, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. labels Apr 9, 2022
@schmittlauch schmittlauch force-pushed the pulseaudio-advanced-bluetooth-codecs branch from b9797e4 to 63e391b Compare April 19, 2022 15:43
@schmittlauch schmittlauch marked this pull request as ready for review April 19, 2022 15:43
@schmittlauch schmittlauch requested review from jtojnar and r-burns April 19, 2022 15:44
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. and removed 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. labels Apr 19, 2022
@schmittlauch
Copy link
Copy Markdown
Member Author

Regarding discussion point 1, the closure sizes of pulseaudio:

after this PR:
/nix/store/2ddkmmd77g1nl12l60h2fpn0833ggd2w-pulseaudio-15.0 927.2M

before this PR (77e60d890f0bf13f76ef8938a09156f190018c76):
/nix/store/lk3gr6i7bdnwap99p2dyk58mm1y1kphs-pulseaudio-15.0 206.3M

This makes it pretty clear that pulling in gstreamer in systems not depending on it otherwise is a bad idea. I'll hide this new codec support behind a feature flag that is false by default, but true for pulseaudioFull.

@schmittlauch
Copy link
Copy Markdown
Member Author

closure size update:

pulseaudio:
/nix/store/lk3gr6i7bdnwap99p2dyk58mm1y1kphs-pulseaudio-15.0 206.3M

pulseaudioFull:
/nix/store/q54xdnvy9wqiwdgwf1p1y3phvkrzqijv-pulseaudio-15.0 941.5M

@schmittlauch
Copy link
Copy Markdown
Member Author

schmittlauch commented Apr 19, 2022

Unfortunately I'm way behind my expected schedule and thus am not sure whether this is allowed to make it into 22.05 – it's not really breaking, but also a significant rework.

In case this gets okayed for 22.05, I'm happy to add some release notes.
/cc @dasJ

@schmittlauch schmittlauch requested a review from lovek323 April 19, 2022 16:56
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. and removed 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Apr 19, 2022
- previously, aptx support had been disabled dueto libopenaptx license issues
- since 1.20.1, gstreamer supports libfreeaptx as a drop-in replacement
- this relies on gstreamer for encoding
- advanced bluetooth
  codecs include LDAC and aptX
…re flag

pulseaudioFull enables this feature flag, but the plain pulseaudio attribute does not
@SuperSandro2000
Copy link
Copy Markdown
Member

Rebased against the current master staging merge base otherwise I can't rebuild my system on the branch.

@SuperSandro2000 SuperSandro2000 force-pushed the pulseaudio-advanced-bluetooth-codecs branch from e18ca71 to d62bf28 Compare April 20, 2022 13:16
@toon23
Copy link
Copy Markdown
Contributor

toon23 commented Apr 20, 2022

LDAC (High Quality/ Standard Quality/ Mobile Quality) also works. Tested with Sony WH-1000-X M3.

@SuperSandro2000
Copy link
Copy Markdown
Member

SuperSandro2000 commented Apr 20, 2022

I have set hardware.pulseaudio.package to pkgs.pulseaudioFull and only get a2dp. Withput the full package I also got some sbc variant and with pipewire I get close to 10 including LDAC.

@SuperSandro2000
Copy link
Copy Markdown
Member

I did a reboot after the switch, journalctl shows support for those codecs and I can choose them in pavucontrol (UI is a bit buggy though) but not in the plasma applet. Not sure why.

@schmittlauch
Copy link
Copy Markdown
Member Author

I guess codec switching has just not been implemented for the plasma applet (yet?). That's unfortunate for us fellow plasma users, but not really within the scope of this PR.

If you can choose the new codecs in pavucontrol and your device plays them sufficiently well, then I'd count this as a success.

@schmittlauch
Copy link
Copy Markdown
Member Author

Looks like this might make it into 22.05, shall I write some release notes?

@SuperSandro2000
Copy link
Copy Markdown
Member

SuperSandro2000 commented Apr 20, 2022

I guess codec switching has just not been implemented for the plasma applet (yet?).

It works with pipewire. Maybe plasma-pa needs to catchup for pulseaudio. I don't really know but out of scope.

PS: And I got like 15 new modes how to play sound over HDMI...

image


If you like you can write some release notes but I am going to merge that as soon as I convinced ofborg to @ofborg eval.

@SuperSandro2000
Copy link
Copy Markdown
Member

I think I figured it out: pipewire has codes in the profile included and plasma-pa can only switch profiles. With pulseaudio I have an extra codes field next to the profile which shows aptx and ldac.

So everything fine. LGTM

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation labels Apr 20, 2022
@schmittlauch
Copy link
Copy Markdown
Member Author

Uhmm, regarding the failed EditorConfig check: It's complaining about "30: Trailing whitespace" in the markdown file of the release notes.

The thing is that plain markdown (and Pandoc markdown as well) uses trailing whitespace to enforce a line break, I did that deliberately to have a line break within a bullet point for better readability. So isn't that actually the point of doing so?!?

@ofborg ofborg bot added 8.has: clean-up This PR removes packages or removes other cruft 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. and removed 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. labels Apr 20, 2022
@SuperSandro2000
Copy link
Copy Markdown
Member

You could add a new entry to https://github.com/NixOS/nixpkgs/blob/master/.editorconfig#L81-L82

@schmittlauch schmittlauch force-pushed the pulseaudio-advanced-bluetooth-codecs branch 2 times, most recently from 7194abd to c7dff67 Compare April 21, 2022 00:00
@SuperSandro2000
Copy link
Copy Markdown
Member

@ofborg eval

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

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: clean-up This PR removes packages or removes other cruft 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants