pulseaudio框架浅析

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

  1. Provides “Simple API” for applications.
  2. Implemented as a wrapper around libpulse.

libpulse

  1. Provides “Asynchronous API” for applications.
  2. Communicates with the server via the “native” protocol over a Unix domain or TCP stream socket.

libpulsecommon

  1. Contains parts from libpulsecore

libpulsecore

  1. Server library.
  2. Provides internal API for modules.
  3. Contains common environment and generic building blocks for modules.

modules

  1. Server extensions
  2. 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值