1. 简介
1. PulseAudio is a sound server
2. It performs advanced operations on sound data as it passes between your application and hardware
3. Transfer audio to a different machine change the sample format or channel count, or mix several sounds into one input/output
2. 主要高级组件
libpulse-simple
- Provides “Simple API” for applications.
- Implemented as a wrapper around libpulse.
libpulse
- Provides “Asynchronous API” for applications.
- Communicates with the server via the “native” protocol over a Unix domain or TCP stream socket.
libpulsecommon
- Contains parts from libpulsecore
libpulsecore
- Server library.
- Provides internal API for modules.
- Contains common environment and generic building blocks for modules.
modules
- Server extensions
- Many server features are implemented in modules,including network protocols, device drivers, desktop integrations, etc.
3. 服务器端对象类型
source
an input device. Runs a thread with its own event loop.
source-output
a recording stream. The aource thread invokes source output when next sample chunk is available or parameters are updated.
sink
an output device. Runs a thread with its own event loop.
sink-input
a playback stream. The sink thread invokes sink input when next sample chunk is needed or parameters are updated.
4. 重采样器
主要功能
1. converts frame from input sample format to working sample format
2. maps input channels to output channels
3. converts sample rate from input rate to output rate
4. converts frame from working sample format to output sample format
配置流程
5. 客户端数据类型
Main Loop
Start up a separate thread to carry back events, messages and time updates from the pulseaudio server.
Context
Basic object for a connection between client and pulseaudio server.
Streams
Audio streams form the central functionality of the sound server. Data is routed, converted and mixed from several sources before it is passed along to a final output.
6. 播放流程简析
1. 建立连接
2. 写数据
buffer传输中的类型
流程框图
函数调用流程
1. client至mainloop
2. mainloop至内部buffer
3. 相关module(alsa-sink)读取内部buffer,然后通过alsa lib写入声卡
7. 开启log
1. 配置文件:/etc/pulse/client.conf
extra-arguments = --log-target=file:/tmp/pulse.log
2. 配置文件:/etc/pulse/daemon.conf
log-level = debug