Logo Search packages:      
Sourcecode: pulseaudio version File versions  Download package

pa_usec_t pa_simple_get_latency ( pa_simple s,
int *  error 
)

Return the playback latency.

Since:
0.5

Definition at line 429 of file simple.c.

References pa_simple::context, pa_simple::mainloop, PA_ERR_NODATA, and pa_simple::stream.

                                                           {
    pa_usec_t t;
    int negative;

    pa_assert(p);

    pa_threaded_mainloop_lock(p->mainloop);

    for (;;) {
        CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);

        if (pa_stream_get_latency(p->stream, &t, &negative) >= 0)
            break;

        CHECK_SUCCESS_GOTO(p, rerror, pa_context_errno(p->context) == PA_ERR_NODATA, unlock_and_fail);

        /* Wait until latency data is available again */
        pa_threaded_mainloop_wait(p->mainloop);
    }

    pa_threaded_mainloop_unlock(p->mainloop);

    return negative ? 0 : t;

unlock_and_fail:

    pa_threaded_mainloop_unlock(p->mainloop);
    return (pa_usec_t) -1;
}


Generated by  Doxygen 1.6.0   Back to index