Logo Search packages:      
Sourcecode: pulseaudio version File versions

pa_operation* pa_stream_flush ( pa_stream s,
pa_stream_success_cb_t  cb,
void *  userdata 
)

Flush the playback buffer of this stream. Most of the time you're better off using the parameter delta of pa_stream_write() instead of this function. Available on both playback and recording streams.

Definition at line 1769 of file stream.c.

References PA_ERR_BADSTATE, PA_STREAM_PLAYBACK, PA_STREAM_READY, and PA_STREAM_UPLOAD.

                                                                                       {
    pa_operation *o;

    pa_assert(s);
    pa_assert(PA_REFCNT_VALUE(s) >= 1);

    PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
    PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);

    if (!(o = stream_send_simple_command(s, (uint32_t) (s->direction == PA_STREAM_PLAYBACK ? PA_COMMAND_FLUSH_PLAYBACK_STREAM : PA_COMMAND_FLUSH_RECORD_STREAM), cb, userdata)))
        return NULL;

    if (s->direction == PA_STREAM_PLAYBACK) {

        if (s->write_index_corrections[s->current_write_index_correction].valid)
            s->write_index_corrections[s->current_write_index_correction].corrupt = TRUE;

        if (s->buffer_attr.prebuf > 0)
            check_smoother_status(s, FALSE, FALSE, TRUE);

        /* This will change the write index, but leave the
         * read index untouched. */
        invalidate_indexes(s, FALSE, TRUE);

    } else
        /* For record streams this has no influence on the write
         * index, but the read index might jump. */
        invalidate_indexes(s, TRUE, FALSE);

    return o;
}


Generated by  Doxygen 1.6.0   Back to index