On Wed, 2016-01-13 at 10:19 +0530, Swapnali Patil wrote: > Hello all, > we are using Pulse Audio API to playback audio received from network. So > far we are using pa_simple_api, with this we get latency of 2+ seconds. > From internet documents we got to about PA_STREAM_ADJUST_LATENCY flags. But > it seem this flag can be set for PA_STREAM_API. The PA_STREAM_ADJUST_LATENCY flag is automatically set for all streams created with the simple API. > We tried to set /use > PA_STREAM_API as mentioned below > . but it fails in > > pa_stream_new > () it self. > > Â Â Â Â pa_ml = pa_mainloop_new(); > Â Â Â Â pa_mlapi = pa_mainloop_get_api(pa_ml); > Â Â Â Â pa_ctx = pa_context_new(pa_mlapi, "ivcloudapp"); > Â Â Â Â pa_context_connect(pa_ctx, NULL,PA_CONTEXT_NOFLAGS, NULL); > > Â Â Â Â Â if(!s) > Â Â Â Â Â { > s = > > pa_stream_new(pa_ctx, "Playback", &ss, NULL); > Â Â Â Â Â Â Â if (!s) { > Â printf("pa_stream_new failed\n"); This will fail, because pa_context_connect() doesn't immediately establish the connection. You need to monitor the connection state by setting up a callback with pa_context_set_state_callback(). > Please give direction how we can set low latency with pa_simple_api. The latency is controlled by the tlength parameter in pa_buffer_attr, which you pass to pa_simple_new(). -- Tanu