We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

PipeWire in the Automotive Industry

00:00

Formal Metadata

Title
PipeWire in the Automotive Industry
Title of Series
Number of Parts
490
Author
License
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
PipeWire has recently been adopted by Automotive Grade Linux for its implementation of the low-level platform audio service, replacing entirely previous solutions. Getting there had, of course, many challenges. In this talk, George is going to talk about how PipeWire has managed to overcome these challenges and has evolved to support automotive use cases and hardware through the design and implementation of a new, reusable, session & policy management component, WirePlumber.
33
35
Thumbnail
23:38
52
Thumbnail
30:38
53
Thumbnail
16:18
65
71
Thumbnail
14:24
72
Thumbnail
18:02
75
Thumbnail
19:35
101
Thumbnail
12:59
106
123
Thumbnail
25:58
146
Thumbnail
47:36
157
Thumbnail
51:32
166
172
Thumbnail
22:49
182
Thumbnail
25:44
186
Thumbnail
40:18
190
195
225
Thumbnail
23:41
273
281
284
Thumbnail
09:08
285
289
Thumbnail
26:03
290
297
Thumbnail
19:29
328
Thumbnail
24:11
379
Thumbnail
20:10
385
Thumbnail
28:37
393
Thumbnail
09:10
430
438
MultimediaSoftware engineeringMultimediaComputer animation
Open setSource codeComputing platformSoftwareInfotainmentElectronic visual displayTelematikFunctional (mathematics)System programmingDevice driverGradientTask (computing)Physical systemProjective planeTask (computing)BuildingGeometryVideo gameDemo (music)Computer animation
Physical systemComputer hardwareDevice driverDifferent (Kate Ryan album)Pulse (signal processing)Numbering schemeComputer animation
Open setComputer hardwareGradientComputer networkBefehlsprozessorPattern recognitionArray data structureDigital signal processorMixed realityStreaming mediaInformation securityBootingSoftwareContext awarenessImplementationMusical ensembleDevice driverMetreMultimediaMobile appStreaming mediaInformation securityComputer hardwareGame controllerBefehlsprozessorData managementDifferent (Kate Ryan album)Numbering schemeMultiplication signFilter <Stochastik>Sound cardPulse (signal processing)MultiplicationPhysical systemInfotainmentArray data structureUltraviolet photoelectron spectroscopyHypermediaPlastikkarteType theoryDisk read-and-write headKnowledge baseMereologyBitOrder (biology)Video game consoleComputer animation
Data managementPulse (signal processing)Decision theoryInformation securityOpen setDemonInterface (computing)Euclidean vectorLoop (music)Projective planeDecision theoryCASE <Informatik>Information securityMultimediaData managementPulse (signal processing)Streaming mediaModule (mathematics)Mobile appComplex (psychology)Cartesian coordinate systemGame controllerComputer animation
Cartesian coordinate systemCASE <Informatik>Computer architectureRoutingHypermediaBitComputer animation
DemonArchitectureOpen setExecution unitLink (knot theory)Pulse (signal processing)VideoconferencingModul <Datentyp>Information securityServer (computing)DemonCartesian coordinate systemPlug-in (computing)Graph (mathematics)Server (computing)Process (computing)HypermediaGame controllerPulse (signal processing)VideoconferencingCodeLink (knot theory)Data managementSoftwarePresentation of a groupConnected spaceObject (grammar)Different (Kate Ryan album)Arithmetic meanInformation securityQuicksortWordComputer animation
ImplementationDemonLibrary (computing)Data managementModul <Datentyp>UsabilityObject (grammar)Keyboard shortcutOpen setPoint (geometry)HypermediaVertex (graph theory)Graph (mathematics)AbstractionOperations researchGUI widgetPulse (signal processing)Representation (politics)Computer hardwareBridging (networking)Function (mathematics)Digital signal processorComputer networkProcess (computing)outputLatent heatFeedbackMenu (computing)Streaming mediaComa BerenicesPhysical systemData managementLibrary (computing)Distribution (mathematics)Computer hardwareSynchronizationHypermediaModule (mathematics)Parallel portCartesian coordinate systemLink (knot theory)Streaming mediaCodeRoutingSoftwareDemonUsabilityBefehlsprozessorGraph (mathematics)Process (computing)Speech synthesisFormal languageImplementationWritingObject (grammar)AbstractionRepresentation (politics)Personal digital assistantPoint (geometry)Arithmetic progressionMarginal distributionCASE <Informatik>AuthorizationLatent heatTwin primeField (computer science)Power (physics)Decision theorySource codeComplex (psychology)ArmTheory of relativityComputer animation
Personal digital assistantOpen setSpeech synthesisVertex (graph theory)Graph (mathematics)Demo (music)BuildingInformation securityData managementObject (grammar)Run time (program lifecycle phase)VideoconferencingImplementationPulse (signal processing)TouchscreenSource codeData managementComputer hardwareHypermediaGame controllerImplementationMultimediaStreaming mediaSoftwareFunction (mathematics)Sound effectConnected spaceMusical ensembleVolume (thermodynamics)Cartesian coordinate systemCASE <Informatik>Link (knot theory)Graph (mathematics)Demo (music)Point (geometry)Information securityPulse (signal processing)Message passingRun time (program lifecycle phase)Module (mathematics)Moment (mathematics)VideoconferencingSource codeProcess (computing)Code refactoringDecision theoryDifferent (Kate Ryan album)Branch (computer science)WikiBuildingScripting languagePlanningBefehlsprozessoroutputNumber1 (number)Drop (liquid)ArmOpen sourceDivisorPhysical systemLibrary (computing)Coefficient of determinationRight anglePerturbation theoryLevel (video gaming)Representation (politics)CodeCasting (performing arts)Multiplication signComputer animation
Open setTerm (mathematics)StatisticsBenchmarkGoodness of fitFrequencyPairwise comparisonArmMultiplication signPoint (geometry)Run time (program lifecycle phase)Streaming mediaSpacetimeMathematicsData managementBus (computing)Configuration spaceComputer hardwareBootingBefehlsprozessorFunctional (mathematics)Sampling (statistics)Computer animation
Point cloudOpen sourceFacebook
Transcript: English(auto-generated)
Hello everyone. Welcome. I'm George. I work at Collabora. I'm a senior software engineer working on multimedia things like Gistremer and Pipewire. And today I'm going to talk
about what I've been doing in the past one year with Pipewire enabling Pipewire in the automotive industry. So let's start by defining automotive. So basically I've been working on a project called Automotive Grid Linux. I'm pretty sure you've heard of
it before. If you haven't heard, ask around. There is a booth at the building K as well where you can see a live demo of Automotive Grid Linux. And my task in AGL has been to make an audio system for cars. Now, the immediate question you might have is what's so special
about the audio system? I mean, we've had audio systems for years on Linux. The driver layer also works. We have pulse audio on top that works really well for the desktop.
But yeah, what's missing? So to explain that, I need to explain to you how the hardware looks like because that's the difference basically. So on a desktop, we're used to having this kind of scheme where there is a single CPU and a single audio card,
might be multiple but it doesn't matter. You basically choose one audio card that you use. You have your speakers connected there and you have your microphone connected there and that's the whole thing that exists. And yeah, you have things like
pulse audio that can manage this really, really, really well. On a car now, things are quite different because you have different nodes inside the car, different CPUs, multiple CPUs. So you have maybe one CPU that is the in-vehicle infotainment
system and then another CPU around somewhere else which is maybe, I don't know, a hardware radio device or a CD player. There is dedicated DSP somewhere else which is doing the filters
and echo cancellation and finally amplifies the audio to the speakers. And there might be multiple DSPs actually, one for the front speakers, one for the rear seat speakers. There are some cars that have even speakers on your headrest. There are also microphone
arrays that are on your seat belt or on the top on the roof, on the doors, on the side, everywhere basically. And this becomes basically a very complex network that you no longer manage
in the way that you manage the desktop. So some requirements. Basically, yeah, I mostly talked about it already. You have a lot of different hardware. And the other thing that I didn't say
is that you might have streams that go around without passing through the main CPU. So you may have, for example, dedicated hardware CD player that directly puts audio on the DSP and that audio never passes through the main CPU. Although the main CPU still has control over what place, you don't actually get the audio data routed through the main CPU for performance
reasons. And you need low latency because you may want to implement echo cancellation and things like that. And then on the software side, on the iFi system, when you want to play
something, there are some requirements there as well because you might have, you basically have apps that have a different context. There are apps that, for example, apps that play music that are in the multimedia context the same. And there are other apps that
may be doing something special like, for example, your navigation app, which every once in a while it says please turn left in 100 meters or something like that. And that sound needs to be treated specially because you want to make sure that the driver can hear it.
You want to play it on the front speakers, you want to play it amplified, lower down the music while it's playing, and things like that. So you have to treat it in a different path than, and in a different way than how you treat the music. We want security because things
nowadays are very hard. We want to have containerized apps nowadays that can play music or something else, but you don't want them to be able to do something that they
are not intended to do. Like you don't want the music app to be able to take over the navigation special stream and things like that. And then you have emergency signals when there is something wrong with your car that needs to play some sound to warn the driver. That's also something that needs to be treated specially. And it's usually
coming from dedicated hardware that has to be certified and it won't actually send data through the main CPU again. It will just play directly on the DSP and there is a path there that is guaranteed to work because it's certified. But then the IVI needs to understand
that this is going on and stop the other streams at the time and things like that. So the real problem actually to be doing an audio system in a car is routing and policy management.
How do we manage the routing and how do we make policies? So there have been some projects that have tried to address this. I'm starting with Pulse Audio. Pulse Audio didn't actually
ever try to address this use case. It's really meant for the desktop. It makes its own policy decisions so you can't actually tinker with it unless you build a module. And some people do that. They build a module that tries to circumvent how Pulse Audio is internally routing
streams. But it's not very nice. It is fairly resource intensive compared to other multimedia demos. And it doesn't implement any kind of security so whichever app connects has control over everything. And then there have been things like the Geneva Audio Manager
which is building on top of Pulse Audio. It uses Pulse Audio as a backend. Optionally, it can use other backends as well. It basically builds an API for policy management on top of that. But it has a couple of shortcomings. You must call the Audio Manager API so the
applications need to be aware that this exists and things like that. And people that have used it, they generally agree that it's complex and not very nice. And then in AGL, we also had another API called 4A which tried to solve some of these issues of Audio Manager but didn't succeed in addressing all of them and people still didn't like it so much.
So then there was Pipewire. What is Pipewire doing differently to address these issues? So
when I started looking at that, Pipewire of course didn't support any of these use cases. But it had something that looked like it was possible to develop it to address these use cases. So let's start with explaining a little bit of the architecture of Pipewire. How does it
look like? So there is a daemon, Pipewire daemon, that basically handles all the media routing between applications and devices. And everything is a different process. So you can have applications sending data through MFD or DMA buff to Pipewire or capturing data.
And then you can have devices either accessed directly through a plug-in to connect let's say to also or to video for Linux. But you can also present devices through external processes like the
Bluetooth manager process that we have that does all the networking stuff with Bluetooth and provides the device to the Pipewire daemon. And then there is another process which is called
Pipewire daemon. It actually looks at the whole applications and devices graph and decides what is going to be routed where and makes all these connections. And I'll talk more about that later.
That's actually what I've been doing myself. So inside that blue box, the Pipewire daemon, the things look like that. So inside the Pipewire daemon there is actually a media graph with a lot of little objects called nodes that connect to each other with links.
Every application is represented by an application node. Every device is represented there as well. Halsa, video for Linux, Bluetooth. And it can also load internal plugins
that also provide nodes that can do filtering and processing. Pipewire actually started from providing a pulse audio for video. It was initially called Pulse Video. So it can handle video data very well. That's its original purpose.
Nowadays it also implements routing audio data and it's evolving to become a pulse audio replacement. It is modular so you can customize it a lot. It has built-in security, something that Pulse
Audio didn't have. There is access control per application, per device, and you can make things, you can give access to certain applications to do certain things and not other things. And that's what I mean with security. It's a very clean code and much more efficient
than Pulse Audio. It's capable of doing low latency audio and it actually implements the jack API so it can also work as a jack audio server. And yeah, the single most important thing is the external policy management. So applications connect to Pipewire,
they don't actually get linked to anything, they are not able to do anything until the session manager acts and gives them permissions and gives them links to something else, to a device.
What was missing from Pipewire, when I started last year, there was no session manager. So I started developing a session manager, basically that was all my work. And I developed a session manager called Wire Plumber. That was the first session manager implementation. It's like Pipewire, it's modular and extensible. The target is to provide a reusable session
manager for all kinds of use cases, automotive, other embedded, also to provide a desktop session manager. And a session management API as well, so it provides a library that would allow you to
write your own session manager if you want, or to write your own policies to decide what route where, to write modules for Wire Plumber, to extend its features and tools around that. It's written using GObject, it provides a GObjectified API on top of Pipewire for
ease of use and for enabling bindings in other languages. That would be super useful. And it also provides an API, which is called the Endpoints API, I'm going to explain that,
which is very useful for implementing policies. I'm going to explain that. Endpoints is a concept that I brought into Pipewire, it didn't exist before. Pipewire itself, it routes media through nodes from an application to a device or vice versa.
But the thing is that in a car you have all these kinds of streams, hardware streams that maybe are not passing through the main CPU and you want to control them. So I thought, how can we make an abstraction on top of all of these? And this is what the
endpoints are. Basically, endpoints are also little objects that look like nodes, they can be linked together and unlinked, but they don't actually have media, they don't route media, they are something more abstract. So for example, you could think of a pipeline that looks
like in the endpoints graph, it looks like there is a media player that gets connected to the car amplifier and these are the two endpoints with one link and there is no more in that graph. While the same thing on the nodes graph, it looks like there is a media player that goes
into a filter that does some processing and then it goes to a network sync that pushes things out to the car network and then there is a car network distribution daemon or whatever that eventually ends up in the amplifier. And this is a much more complex path that
the policy management would have to know and it would become very hardware specific to handle this. So this is why I thought we need to abstract this. And these two are meant to run in parallel. So you have both the endpoints graph and the media,
the nodes graph, and whenever you make a link on the endpoints graph, the session manager translates that into links on the actual nodes graph and on the actual car network or whatever else is there. The endpoints API is also something useful to bring
the graph closer to what Palsodio has. So Palsodio has only sources and syncs, there is only two things that you can link together. There is no concept of a very much more complex graph. And this is exactly what endpoints are. So if you were to implement endpoints on a desktop,
you could still have things like an application being represented as one endpoint and your speakers or your microphone as another endpoint and then you can link them together no matter if there are filters in between or whatever else. And this is how it looks in the endpoints graph.
So you have your applications, your media player, your voice agent, voice assistant, and they make links to the endpoints. There's an amplifier endpoint there, a speech microphone. And on the top of this graph, we have basically streams that are in the main CPU,
the main CPU actually routes media data. But then we can also represent a hardware player or something else that is only routed in the car network and not in the main
CPU. But the main CPU can still have this representation in a graph. And so the policy management code can still look at this and decide, okay, here's, for example, a hardware player that decides to, in this example, so for example, there is a voice agent assistant
there that wants to play something and it starts playing. And then as soon as it makes the link and it starts streaming, maybe the policy management understands that this happens and it enables some effects on the amplifier endpoint, which could mean that more nodes are
getting linked at the point and they enable some effects or it could mean that something on the hardware is triggered to enable this effect where the voice is louder than the music.
And then the hardware player, the user goes and clicks a button on the hardware and there's a radio hardware player that starts streaming to the amplifier without passing media through the main CPU. But because we have this graph representation, the policy management understands that it needs to unlink that media player at the top which was previously linked
and which is in software. So this is how it works. And then we have how do we make the connection between the endpoints and the actual media nodes? So maybe you have, again, two endpoints, an application that plays something and an amplifier,
something that plays. And you want to implement volume controls per stream. So you have the multimedia stream and the navigation stream, which are, as I said earlier, they are something that needs to be treated differently. So the software DSP output endpoint that I have written there
is creating a couple of DSP nodes there that implement volume controls per stream. And as soon as you make this virtual link on the endpoints graph, it goes and creates the actual link on the media routing graph.
And in the case where there is a hardware dedicated DSP that can support these streams in the hardware and you can trigger the different volumes per stream by sending some comments to the hardware, it's still the same externally. So you can make a link on the
endpoints graph. And then the session manager, which has a module that implements this endpoint, it understands that it needs to go and send a message to the hardware amplifier to enable that different volume effect. So what's the status of Wireplumber right now?
It currently works nicely for AGL. On the demo that we have on building K, we use Pipewire and Wireplumber at the moment. The API is sitting down. We are doing some more refactoring on the API level, on the library,
but it's sitting down. And we've just recently started generating documentation using Hotdog. And I'm in the process of documenting right now. I started, like, last week. I pushed some dogs. There are some shortcomings. Like, it doesn't have flexible policy. Although the policy is configurable, it's not configurable
enough. And it works only for the AGL demo and nothing else right now. And there is no security management implemented. We just need access to all the applications, which is bad. But we have a plan. So the next steps, what I want to do next is experiment with
scriptable policy, provide something, provide an API that scripts can be written to influence how these decisions are taken about what to link where. And there is a runtime called Anatoly, written by Bastian Nocera, who wrote this basically for this purpose, for
managing Pipewire policies. So my next step is to experiment with that, see if that's something that makes sense and if we can write nice scripts like that. But other ways of doing that would be also acceptable and welcome. The other thing is improve desktop compatibility and make a
drop-in replacement for Pulse Audio that currently doesn't work on the desktop. Another next step is to enable management of video, video nodes, enable camera inputs and screencast inputs, and implement security management. There is a design for that, I just haven't gotten around it to implement it. The source code, it's all on GitHub for
the desktop.org slash Pipewire. You can find both Pipewire and Wireplumber in there. You can make a merge request there, you can find issues there, the wiki is there, everything is there. And on the AGL front, I maintain a branch of Pipewire with
the AGL-specific commits that I had to make, although I'm constantly pushing them upstream, so as soon as they are merged upstream, I remove them from the branch and I rebase. And then there is this metapipewire Yocto layer. AGL is based on Yocto, so these are the
recipes to build Pipewire and Wireplumber inside AGL. Thank you very much, any questions?
The question is if I have any benchmarks comparing Pulsar to Pipewire. Yes, I had the benchmark that's from last year, so it's not up to date, but it was looking like, I'm sorry I don't have the slide with me, but we had some comparison of Pipewire
basically taking a stream, a 5.1 stream, so six channels, transforming it in a couple of ways, resampling, changing the format, and taking it out. That was using something like 6% CPU with
64 samples latency, while Pulsadio at the same configuration was using 100% CPU, it was failing. So a good comparison was like that. I'm sorry I don't have the latest statistics.
It's looking really, really good. In terms of flexibility over here, you said you were looking to do more flexibility, were you talking about boot time flexibility or runtime flexibility? Because with the adoption of things like A to B in the audio space now,
you're getting nodes that are coming on and off the buses all the time that are making audio harder to manage. Yeah, Pipewire is very dynamic in how it manages hardware, so it can detect things coming up and moving up all the time.
Does that include firmware? Because you can have A to B nodes with DSPs in them, the firmware, the DSP, which implements different functionality gets changed dynamically as well. I don't see why it wouldn't be supported, but I never looked at this kind of hardware.
There's no time for more questions. Thank you very much for listening.