PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
Posted Mar 3, 2021 2:42 UTC (Wed) by Subsentient (subscriber, #142918)In reply to: PipeWire: The Linux audio/video bus by gerdesj
Parent article: PipeWire: The Linux audio/video bus
I don't want to be out of luck for fixing broken shit for the next 3 years while the world gets used to PipeWire.
Posted Mar 3, 2021 4:32 UTC (Wed)
by darwi (subscriber, #131202)
[Link] (12 responses)
I had no space left in the article to further expand on this, so I'll write it here: breaking users audio was not always PulseAudio's fault. It was the first heavy user of a certain class of ALSA APIs like audio buffer rewinding; e.g., snd_pcm_rewind() and friends. The proprietary Adobe flash plugin, prevalent back then, also caused its own unique set of problems.
Nonetheless, yes, PulseAudio (and especially its glitch-free support) was pushed too early on users. "I'll break your audio", the constant tongue-in-cheek remark by PulseAudio's lead developer back then, did not also always help. Humility, and some sympathy for users with broken audio setups, were definitely lacking.
The good news is that the community as a whole learned a lot from the ALSA→PulseAudio transition fiasco. Remember that everyone is also more than a decade older now… Everyone is (hopefully) a little-bit wiser.
By the way, the PipeWire developers are keenly aware of the previous audio API transition issues. This was discussed at length in the PipeWire 2018 hackfest: an adults-in-the-room orderly PulseAudio→PipeWire transition was planned early-on. I'm personally optimistic :) [Famous last words?]
Posted Mar 3, 2021 4:48 UTC (Wed)
by Subsentient (subscriber, #142918)
[Link] (2 responses)
Posted Mar 4, 2021 6:12 UTC (Thu)
by darwi (subscriber, #131202)
[Link]
Posting an empty comment that is just a link to a GIF meme does not contribute to a healthy discussion. Assuming that you were posting in good faith, then the answer is yes, I do (based on interactions with a lot of active developers across the stack.)
Posted Mar 11, 2021 10:21 UTC (Thu)
by oldtomas (guest, #72579)
[Link]
Posted Mar 3, 2021 13:44 UTC (Wed)
by pizza (subscriber, #46)
[Link] (2 responses)
It's probably more accurate to say that a _huge_ number of ALSA and application[+library] bugs were uncovered and fixed during the early PA days, and that work continues to pay dividends, making future migrations much easier.
(The main technical reason for the ease of the PA->PW migration is that PA and PW both provide ALSA plugins so that software natively using the ALSA API continues to JustWork, and of course PW provides a drop-in PA library replacement..)
Posted Mar 4, 2021 4:14 UTC (Thu)
by darwi (subscriber, #131202)
[Link] (1 responses)
Yes, of course. I thought this was implied. I meant also "wiser" in the technical sense.
> (The main technical reason for the ease of the PA->PW migration is that PA and PW both provide ALSA plugins so that software natively using the ALSA API continues to JustWork, and of course PW provides a drop-in PA library replacement..)
It's not only about that.
Anyone can implement compatibility layers; e.g., roaraudio reimplements the PulseAudio APIs. On the ALSA compatability side, ALSA plugins are actually the simplest part of the equation: it's usually a single C file with some hundred lines of code + a 10-line configuration file.
As discussed in the article, how PipeWire is internally designed is actually what helps a lot. Don't underestimate how a proper initial rigorous design makes things much smoother at the later adoption and transition stages of any software project. A proper design makes everything "fit into place".
PipeWire design and code is semantically simpler than PulseAudio; in part, because everyone got wiser. Anyone who has worked inside the PulseAudio code base for a while will know what I mean here ;)
Posted Mar 5, 2021 14:22 UTC (Fri)
by ecree (guest, #95790)
[Link]
Sounds like PipeWire may be an example of third-system effect. A good sign.
Posted Mar 3, 2021 16:55 UTC (Wed)
by HenrikH (subscriber, #31152)
[Link] (1 responses)
I'll beg to differ, the only reason that the ALSA drivers where ultimately fixed, that PA became usable and that software started to use PA was that it was pushed out to all users as early as it was. Had it not been done this way then PA would be closer to where Wayland is today and PipeWire would have been decades away in the future.
The real QA for any software projects only comes on the day that you get it pushed to end users, it doesn't matter how much internal QA you have done.
Posted Mar 4, 2021 21:26 UTC (Thu)
by marcH (subscriber, #57642)
[Link]
There's always an infinite supply of bugs. If you ever run out of them, just test harder and you will get more. It's a continuum.
Once you ran out of sensible use cases, pass it on to a security team.
Posted Mar 5, 2021 7:00 UTC (Fri)
by WolfWings (subscriber, #56790)
[Link] (3 responses)
They REALLY burned bridges with their attitude and flippant responses in a way few understand, and with many ALSA sound card drivers supporting multiple programs attaching at the same time the main 'requirement' for PulseAudio has become moot at this point for simple laptop or desktop audio use.
Posted Mar 6, 2021 1:52 UTC (Sat)
by BirAdam (guest, #132170)
[Link] (2 responses)
Posted Mar 3, 2021 8:52 UTC (Wed)
by chris_se (subscriber, #99706)
[Link] (19 responses)
I'd like to disagree here. I don't love PulseAudio, but with PulseAudio it was the first time I actually got audio working somewhat reliably on Linux. Previously audio was always a real pain, and it never worked reliably at all. I remember bare OSS, bare ALSA, and even such things as aRts. I always spent a long time trying to get it to work somehow, and then some application came along that didn't work with the setup and I had to figure stuff out again. Note that I'm the opposite of an audiophile, my only requirements are that the sound comes out of the device I want it to, that I can dynamically plug in a head set, that I can adjust the volume, there are no cracks due to buffer underruns, that multiple applications can output audio at the same time, and that I can change settings easily via GUI. I don't think these requirements are particularly onerous (I don't even care about stereo audio, I'd be more than happy with mono), but pre PulseAudio I was never even able to achieve even these basic things. Once PulseAudio came, the first couple of releases it wasn't great, but no worse than my prior experience -- but after a while it actually became reliable. It was the first time I could actually use a Bluetooth headset. (I experimented back when support first appeared in the audio stack before PulseAudio, and that barely worked at all.) Sure, some things still didn't work quite as well as I'd hoped, and there are some issues, but for me PulseAudio was a major improvement compared to everything that came before it. I think PulseAudio has a reputation that is worse than it deserves by a long shot. That said, PipeWire does sound extremely promising, and I'm very excited to try it out at some point when I can find some time, because I do sometimes bump into some of the warts of PulseAudio.
Posted Mar 3, 2021 13:14 UTC (Wed)
by ms-tg (subscriber, #89231)
[Link] (17 responses)
PulseAudio was a huge improvement for me over what came before. Am I misremembering, or wasn’t the prior state that we would have apps crash with “could not open ...” if two apps were trying to make sound at once?
Posted Mar 3, 2021 13:26 UTC (Wed)
by pizza (subscriber, #46)
[Link]
Followed by trying to figure out exactly what application was holding the sound card open. Or zombified sound mixing daemon, of which there were several.
(Unless you were one of the fortunate few to have a sound card that could natively handle multiple simultaneous streams!)
Still, even in its early days, PA was a _huge_ net improvement, and most of the issues that folks attributed to PA were really bugs in the underlying device drivers or applications themselves. (I recall the flash plugin being one of the worst offenders..)
(Something similar played out with NetworkManager/wpa_supplicant and wifi devices that didn't implement the WEXT APIs consistently, and/or applications that were written expecting the quirks of a single driver to apply everywhere)
Posted Mar 3, 2021 15:47 UTC (Wed)
by chris_se (subscriber, #99706)
[Link] (7 responses)
All of the other "sound servers", such as aRts and ESD, were created just for this reason. For programs that weren't compatible with them (basically anything not KDE / not GNOME) you had to start them with a wrapper that used a LD_PRELOAD library to hijack the system calls to open the ALSA/OSS devices, and reroute that through aRts/ESD -- but that didn't work with all software, so you had to kill the sound servers sometimes to use some applications. And then others using the sound server would misbehave. And don't get me started with Suspend-to-RAM, which typically killed any application that was currently outputting audio when closing your laptop lid...
I do remember ALSA having native software mixing, but from what I recall it required all applications to use the same sample rate for their audio, which of course was often not really the case. (Maybe that's changed in the mean time?) And you had to configure it manually in your ~/.asoundrc. Also, I don't know exact time this was added, but I remember seeing ALSA software mixing for the first time when PulseAudio was already a thing, so maybe it came way too late. Or at the very least it wasn't advertised very well, because I didn't read about it before I was already switching to PulseAudio.
Posted Mar 3, 2021 19:32 UTC (Wed)
by dezgeg (subscriber, #92243)
[Link] (5 responses)
However this was long time (years) ago, definitely before me owning any USB or Bluetooth exclusive audio devices. I do not even remember when "killall pulseaudio" last solved anything And regardless of that being able to adjust sound levels per-application with PA has been very useful (lack of it is not show stopper but just very nice to have).
Posted Mar 4, 2021 4:52 UTC (Thu)
by jeltz (guest, #88600)
[Link] (2 responses)
Posted Mar 5, 2021 0:06 UTC (Fri)
by hailfinger (subscriber, #76962)
[Link] (1 responses)
PipeWire seems to care about not breaking existing setups and the article implies that the community is nice. I'm happy about that and look forward to testing it.
Posted Mar 5, 2021 5:56 UTC (Fri)
by zdzichu (subscriber, #17118)
[Link]
Posted Mar 4, 2021 15:45 UTC (Thu)
by sorpigal (guest, #36106)
[Link] (1 responses)
The only thing I occasionally pine for is per-process volume control.
Posted Mar 18, 2021 9:20 UTC (Thu)
by mgedmin (subscriber, #34497)
[Link]
Posted Mar 17, 2021 10:18 UTC (Wed)
by immibis (subscriber, #105511)
[Link]
Posted Mar 7, 2021 9:23 UTC (Sun)
by jengelh (guest, #33263)
[Link] (6 responses)
Quite the contrary. People had actual proper soundcards (me: ad1816 or cs46xx on daughterboards), and with other chips (me: ali5451 in first post-2000 laptop), there was ALSA's dmix that would do software mixing via shared memory, before moving the software mixing off to separate - and quite high latency! - daemons like PA.
Posted Mar 7, 2021 12:44 UTC (Sun)
by pizza (subscriber, #46)
[Link] (5 responses)
Just because you had high-end audio gear (for the time) doesn't mean most folks did. Even before Intel standardized onboard audio with the bog-simple single-stream AC97 spec, the overwhelming majority of the audio chips on the market only supported a single hardware PCM stream. Multi-stream hardware was always the upper echelon of the market.
> there was ALSA's dmix that would do software mixing via shared memory
I recall having a lot of issues with dmix in its early days. Not surprising as the same sorts of driver/library/application bugs that made PA a bit rocky also affected dmix.
Posted Mar 7, 2021 15:15 UTC (Sun)
by jengelh (guest, #33263)
[Link] (1 responses)
I never thought of the two being particular high-end; ad1816 came with the package, the cs46xx was a 20€ second-hand thing.
Posted Mar 10, 2021 3:28 UTC (Wed)
by pizza (subscriber, #46)
[Link]
(I owned a high-end CS4630 device in the late 2000 timeframe, mainly because it had drivers that were stable on the multiprocessor Win2K system that I was using for realtime video capture. I ended up selling it after that project was over due to zero Linux support..)
I stand corrected on the AD1816; a quick bit of research shows that supports six simultaneous streams mixed onto two output channels, although given its ISA nature it seems unlikely to achieve that with "CD quality" audio, and seems to have been sold nearly exclusively on bare-minimum cards as a super cheap way to met Microsoft's "MPC97" spec.
But yeah, these were both considerably more capable (at a chipset level) than most of their contemporaries. Until you pointed out the AD1816 I wasn't aware that any mainstream multi-stream ISA cards existed, and the PCI cards of that era tended to be the cheap bare-minimum crap that pretty much ended once onboard AC97 audio came along, leaving just the higher-end stuff targeted at gamers wanting to take advantage of native multi-stream 3D positional audio.
The market for all of this fancy stuff evaporated pretty quickly after Microsoft removed support for hardware-based multi-stream (and 3D positional) audio with Vista -- Despite the spec allowing for it, I don't know offhand of any "HD Audio" controller that implements multi-stream mixing; instead it's one stream per external audio codec. There may be more than one codec (ie two 2-channel codecs instead of one 4-channel codec) but that's pretty rare.
(Of course, pro audio hardware still exists, but those are nearly always single-stream-per-channel and rely on the CPU for mixing/dsp work, but specialized hardware can do whatever it wants, of course..)
Posted Mar 8, 2021 14:21 UTC (Mon)
by LtWorf (subscriber, #124958)
[Link] (2 responses)
Never had a problem with dmix.
Posted Mar 9, 2021 16:39 UTC (Tue)
by zlynx (guest, #2285)
[Link] (1 responses)
Back when I ran Gentoo Linux I did run ALSA with dmix. And I did have problems sometimes. For example, if you nice some process which is acting as the dmix output to ALSA it gets under runs. If a process which is part of dmix gets hammered by OOM or a kill -9 signal things can get super messed up.
The best setup was on my home desktop running Gentoo because there I had a Soundblaster Audigy 2 card which managed a full 5.1 surround setup and I believe 16 independent input sources. The only real problem there was alsactl which had about 500 cryptically named visible controls.
Posted Mar 9, 2021 17:32 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link]
Posted Mar 15, 2021 6:10 UTC (Mon)
by flussence (guest, #85566)
[Link]
Posted Mar 4, 2021 7:42 UTC (Thu)
by josh (subscriber, #17465)
[Link]
Posted Mar 3, 2021 21:49 UTC (Wed)
by ncm (guest, #165)
[Link] (3 responses)
LP wasn't joking about breaking sound: things did break, many, many times for many, many people, for years. And, almost always the only information readily available about what went wrong was just sound no longer coming out, or going in. And, almost always the reliable fix was to delete PA.
But it really was often a consequence of something broken outside of PA. That doesn't mean there was always nothing the PA developers could do, and often they did. The only way it all ended up working as well as it does today--pretty well--is that those things finally got done, and bulldozed through the distro release pipelines. The result was that we gradually stopped needing to delete PA.
Gstreamer crashed all the damn time, for a very long time, too. I never saw PA crash much.
The thing is, all that most of us wanted, almost all the time, was for exactly one program to operate on sound at any time, with exactly one input device and one output device. UI warbling and meeping was never a high-value process. Mixing was most of the time an unnecessary complication and source of latency. The only complicated thing most of us ever wanted was to change routing to and from a headset when it was plugged or unplugged. ALSA was often wholly good enough at that.
To this day, I have UI warbling and meeping turned off, not because it is still broken or might crash gstreamer, but because it is a net-negative feature. I am happiest that it is mostly easy to turn off. (I *wish* I could make my phone not scritch every damn time it sees a new wifi hub.)
Pipewire benefits from things fixed to make PA work, so I have expectations that the transition will be quicker. But Pipewire is (like PA and Systemd) coded in a language that makes correct code much harder to write than buggy, insecure code; and Pipewire relies on not always necessarily especially mature kernel facilities. Those are both risk factors. I would be happier if Pipewire were coded in modern C++ (Rust is--let's be honest, at least with ourselves!--not portable enough yet), for reliability and security. I would be happier if it used only mature kernel features in its core operations, and dodgy new stuff only where needed for correspondingly dodgy Bluetooth configurations that nobody, seriously, expects ever to work anyway.
What would go a long way to smoothing the transition would be a way to see, graphically, where it has stopped working. The graph in the article, annotated in real time with flow rates, sample rates, bit depths, buffer depths, and attenuation figures, would give us a hint about what is failing, with a finer resolution than "damn Pipewire". If we had such a thing for PA, it might have generated less animosity.
Posted Mar 3, 2021 22:35 UTC (Wed)
by pebolle (guest, #35204)
[Link] (2 responses)
Please speak for yourself.
Posted Mar 4, 2021 3:55 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link] (1 responses)
It wasn't that hard to fix, but still.
Posted Mar 4, 2021 9:51 UTC (Thu)
by Wol (subscriber, #4433)
[Link]
PulseAudio relied on the underlying layers working properly. For the most part, at the time, they didn't.
Cheers,
PipeWire: The Linux audio/video bus
>Remember that everyone is also more than a decade older now… Everyone is (hopefully) a little-bit wiser.
PipeWire: The Linux audio/video bus
You think so?
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
Nobody liked Pulseaudio
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
If you do not report bugs, they won't be fixed. And you will have the same problem with pipewire.
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
PipeWire: The Linux audio/video bus
Wol