From 4b8c4ef932e41404536e51d00b9bf010918151d6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 26 Jun 2008 19:03:16 +0200 Subject: reorder a few things to get rid of an uneeded comparison --- src/pulse/stream.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'src/pulse') diff --git a/src/pulse/stream.c b/src/pulse/stream.c index adce7ad8..66964d39 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -1371,8 +1371,8 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, int n, j; uint32_t ctag = tag; - /* Go through the saved correction values and add up the total correction.*/ - + /* Go through the saved correction values and add up the + * total correction.*/ for (n = 0, j = o->stream->current_write_index_correction+1; n < PA_MAX_WRITE_INDEX_CORRECTIONS; n++, j = (j + 1) % PA_MAX_WRITE_INDEX_CORRECTIONS) { @@ -1388,7 +1388,6 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, /* Now fix the write index */ if (o->stream->write_index_corrections[j].corrupt) { /* A corrupting seek was made */ - i->write_index = 0; i->write_index_corrupt = TRUE; } else if (o->stream->write_index_corrections[j].absolute) { /* An absolute seek was made */ @@ -1399,21 +1398,8 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, i->write_index += o->stream->write_index_corrections[j].value; } } - } - - if (o->stream->direction == PA_STREAM_RECORD) { - /* Read index correction */ - - if (!i->read_index_corrupt) - i->read_index -= pa_memblockq_get_length(o->stream->record_memblockq); - } - -/* pa_log("post corrupt w:%u r:%u\n", i->write_index_corrupt || !o->stream->timing_info_valid, i->read_index_corrupt || !o->stream->timing_info_valid); */ - - /* Clear old correction entries */ - if (o->stream->direction == PA_STREAM_PLAYBACK) { - int n; + /* Clear old correction entries */ for (n = 0; n < PA_MAX_WRITE_INDEX_CORRECTIONS; n++) { if (!o->stream->write_index_corrections[n].valid) continue; @@ -1423,6 +1409,13 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, } } + if (o->stream->direction == PA_STREAM_RECORD) { + /* Read index correction */ + + if (!i->read_index_corrupt) + i->read_index -= pa_memblockq_get_length(o->stream->record_memblockq); + } + /* Update smoother */ if (o->stream->smoother) { pa_usec_t u, x; -- cgit