summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/memblockq.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-04-01 23:05:09 +0200
committerLennart Poettering <lennart@poettering.net>2009-04-01 23:05:09 +0200
commit373b5efe51238b0ad34cb9a9d8fc61b973afdad8 (patch)
tree2d08442489818caeeb1c955eb6fc385aead3e009 /src/pulsecore/memblockq.c
parent380e97a596e8e7be122285b005a50635e20d58fc (diff)
properly account for seeks in the requested_bytes counter
Diffstat (limited to 'src/pulsecore/memblockq.c')
-rw-r--r--src/pulsecore/memblockq.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c
index e6e7b736..d12d13a8 100644
--- a/src/pulsecore/memblockq.c
+++ b/src/pulsecore/memblockq.c
@@ -601,7 +601,7 @@ size_t pa_memblockq_missing(pa_memblockq *bq) {
return l >= bq->minreq ? l : 0;
}
-void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek) {
+void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, pa_bool_t account) {
int64_t old, delta;
pa_assert(bq);
@@ -628,12 +628,14 @@ void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek) {
delta = bq->write_index - old;
- if (delta >= (int64_t) bq->requested) {
- delta -= (int64_t) bq->requested;
- bq->requested = 0;
- } else if (delta >= 0) {
- bq->requested -= (size_t) delta;
- delta = 0;
+ if (account) {
+ if (delta >= (int64_t) bq->requested) {
+ delta -= (int64_t) bq->requested;
+ bq->requested = 0;
+ } else if (delta >= 0) {
+ bq->requested -= (size_t) delta;
+ delta = 0;
+ }
}
bq->missing -= delta;
@@ -895,7 +897,7 @@ int pa_memblockq_splice(pa_memblockq *bq, pa_memblockq *source) {
pa_memblock_unref(chunk.memblock);
} else
- pa_memblockq_seek(bq, (int64_t) chunk.length, PA_SEEK_RELATIVE);
+ pa_memblockq_seek(bq, (int64_t) chunk.length, PA_SEEK_RELATIVE, TRUE);
pa_memblockq_drop(bq, chunk.length);
}