summaryrefslogtreecommitdiffstats
path: root/src/polyp
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-04-12 23:57:25 +0000
committerLennart Poettering <lennart@poettering.net>2006-04-12 23:57:25 +0000
commit7fa8323453fab243192bacdae0aeae1e65146f13 (patch)
tree7941a0a32a3c7708647067aed491025cc04acead /src/polyp
parent06bd27b0433e06f3af573ddc213e2577127972e4 (diff)
include local record memblockq in latency calculations
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@694 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/polyp')
-rw-r--r--src/polyp/context.c6
-rw-r--r--src/polyp/stream.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/src/polyp/context.c b/src/polyp/context.c
index 7c0ed190..047b739f 100644
--- a/src/polyp/context.c
+++ b/src/polyp/context.c
@@ -294,12 +294,14 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
assert(c->ref >= 1);
pa_context_ref(c);
-
+
if ((s = pa_dynarray_get(c->record_streams, channel))) {
+ assert(seek == PA_SEEK_RELATIVE && offset == 0);
+
pa_memblockq_seek(s->record_memblockq, offset, seek);
pa_memblockq_push_align(s->record_memblockq, chunk);
-
+
if (s->read_callback) {
size_t l;
diff --git a/src/polyp/stream.c b/src/polyp/stream.c
index fc8cc5cc..ce2470f6 100644
--- a/src/polyp/stream.c
+++ b/src/polyp/stream.c
@@ -662,6 +662,10 @@ int pa_stream_drop(pa_stream *s) {
PA_CHECK_VALIDITY(s->context, s->peek_memchunk.memblock, PA_ERR_BADSTATE);
pa_memblockq_drop(s->record_memblockq, &s->peek_memchunk, s->peek_memchunk.length);
+
+ /* Fix the simulated local read index */
+ if (s->timing_info_valid && !s->timing_info.read_index_corrupt)
+ s->timing_info.read_index += s->peek_memchunk.length;
pa_memblock_unref(s->peek_memchunk.memblock);
s->peek_memchunk.length = 0;
@@ -814,6 +818,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);
+ }
+
o->stream->ipol_timestamp = now;
o->stream->ipol_usec_valid = 0;
}