[pulseaudio-discuss] [LOW LATENCY] PA_simple

Swapnali Patil swapnali.patil at intelli-vision.com
Tue Jan 12 20:41:56 PST 2016

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. We tried to set /use
PA_STREAM_API as mentioned below

    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);

s = pa_stream_new(pa_ctx, "Playback", &ss, NULL);
       if (!s) {
   printf("pa_stream_new failed\n");
goto finish;
         ret = 0;
paAttr.maxlength = pa_usec_to_bytes(latency,&ss);//(uint32_t)8192;//32768;
paAttr.tlength =
paAttr.prebuf = (uint32_t)-1;
paAttr.minreq =  pa_usec_to_bytes(0,&ss);//(uint32_t)-1;
paAttr.fragsize = (uint32_t)-1; //PA_STREAM_ADJUST_LATENCY;
int r = pa_stream_connect_playback(s, NULL, &paAttr,
                                 PA_STREAM_ADJUST_LATENCY, NULL, NULL);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20160113/23a702c0/attachment.html>

More information about the pulseaudio-discuss mailing list