1.pulseaudio/src/pulse/simple.c
pa_simple* pa_simple_new(
const char *server,
const char *name,
pa_stream_direction_t dir,
const char *dev,
const char *stream_name,
const pa_sample_spec *ss,
const pa_channel_map *map,
const pa_buffer_attr *attr,
int *rerror) {
//流程一:创建共享内存
p->context = pa_context_new(pa_threaded_mainloop_get_api(p->mainloop), name);
//流程二:创建socket
pa_context_connect(p->context, server, 0, NULL);
//流程三:线程创建
pa_threaded_mainloop_start(p->mainloop);
//流程四:填充play Or record参数及注册回调函数
p->stream = pa_stream_new(p->context, stream_name, ss, map);
//流程五
pa_stream_connect_playback(p->stream, dev, attr,
PA_STREAM_INTERPOLATE_TIMING
|PA_STREAM_ADJUST_LATENCY