diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2016-12-30 17:52:35 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2017-01-03 04:21:43 +0200 |
commit | 8e9f07074716b248a17b2d044f3a4d27a2e70a32 (patch) | |
tree | 010d38cda827c5014da90e6bf778a729da2c7c40 /src/pulsecore | |
parent | 11946a5be03d2cb914d83c683fb51d531fd63baf (diff) |
memblockq: remove pa_memblockq_missing()
The function isn't used anywhere else than memblockq-test. Also, the
function is confusing, because it defines "missing" differently than
pa_memblockq_pop_missing(). pa_memblockq_missing() calculated the
missing amount like this:
missing = tlength - length,
where "length" is the current queue length. pa_memblockq_pop_missing(),
on the other hand, calculates the missing amount like this:
missing = tlength - length - requested,
where "requested" is an internal variable that keeps track of how much
the server has requested data from the client and how much of the
requests are yet to be fulfilled by the client.
memblockq-test is broken at the moment, because it assumes that
pa_memblockq_pop_missing() calculates "missing" the same way that
pa_memblockq_missing() used to calculate it. A patch for fixing that
will follow.
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/memblockq.c | 12 | ||||
-rw-r--r-- | src/pulsecore/memblockq.h | 5 |
2 files changed, 1 insertions, 16 deletions
diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c index f660ffae..b132dd31 100644 --- a/src/pulsecore/memblockq.c +++ b/src/pulsecore/memblockq.c @@ -680,18 +680,6 @@ size_t pa_memblockq_get_length(pa_memblockq *bq) { return (size_t) (bq->write_index - bq->read_index); } -size_t pa_memblockq_missing(pa_memblockq *bq) { - size_t l; - pa_assert(bq); - - if ((l = pa_memblockq_get_length(bq)) >= bq->tlength) - return 0; - - l = bq->tlength - l; - - return l >= bq->minreq ? l : 0; -} - void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, bool account) { int64_t old; pa_assert(bq); diff --git a/src/pulsecore/memblockq.h b/src/pulsecore/memblockq.h index 301bb21e..69dcebc3 100644 --- a/src/pulsecore/memblockq.h +++ b/src/pulsecore/memblockq.h @@ -56,7 +56,7 @@ typedef struct pa_memblockq pa_memblockq; if no data is in the queue and will never fail. Pass (size_t) -1 for the default. - - minreq: pa_memblockq_missing() will only return values greater + - minreq: pa_memblockq_pop_missing() will only return values greater than this value. Pass 0 for the default. - maxrewind: how many bytes of history to keep in the queue @@ -112,9 +112,6 @@ bool pa_memblockq_is_readable(pa_memblockq *bq); /* Return the length of the queue in bytes */ size_t pa_memblockq_get_length(pa_memblockq *bq); -/* Return how many bytes are missing in queue to the specified fill amount */ -size_t pa_memblockq_missing(pa_memblockq *bq); - /* Return the number of bytes that are missing since the last call to * this function, reset the internal counter to 0. */ size_t pa_memblockq_pop_missing(pa_memblockq *bq); |