Fwd: [LOW LATENCY] PA_simple

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13 January 2016 at 13:14, Tanu Kaskinen <tanuk at iki.fi> wrote:
> 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().

Just to add to hat Tanu said, you can see one of our tests for how
this is supposed to work:

  http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/tests/sync-playback.c

In general, you're probably going to want the async API anyway to deal
with a low latency application (that way you can provide exactly as
much data as requested when it is requested).

-- Arun


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux