diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-04-06 22:09:38 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-04-06 22:13:41 +0200 |
commit | e61728e67a656c0bbd12b13bb4c1777d0e3163f4 (patch) | |
tree | 771b799f585359efa957639aefb7d8f09eb762df /src/pulsecore/protocol-native.c | |
parent | ff8d66d82ec70c18e477f94a965eef4675222d84 (diff) |
Make sure we don't get stuck when prebuf is too high
If prebuf is greater than tlength minus minreq we might end up waiting
for the buffer to fill up further however without ever asking for more
data from the client since less minreq bytes might be missing.
This fixes bug #440
Diffstat (limited to 'src/pulsecore/protocol-native.c')
-rw-r--r-- | src/pulsecore/protocol-native.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 59e5d80e..edcd5982 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -850,7 +850,7 @@ static int playback_stream_process_msg(pa_msgobject *o, int code, void*userdata, /* Called from main context */ static void fix_playback_buffer_attr(playback_stream *s) { - size_t frame_size; + size_t frame_size, max_prebuf; pa_usec_t orig_tlength_usec, tlength_usec, orig_minreq_usec, minreq_usec, sink_usec; pa_assert(s); @@ -976,8 +976,11 @@ static void fix_playback_buffer_attr(playback_stream *s) { if (s->buffer_attr.tlength <= s->buffer_attr.minreq) s->buffer_attr.tlength = s->buffer_attr.minreq*2 + (uint32_t) frame_size; - if (s->buffer_attr.prebuf == (uint32_t) -1 || s->buffer_attr.prebuf > s->buffer_attr.tlength) - s->buffer_attr.prebuf = s->buffer_attr.tlength; + max_prebuf = s->buffer_attr.tlength + (uint32_t)frame_size - s->buffer_attr.minreq; + + if (s->buffer_attr.prebuf == (uint32_t) -1 || + s->buffer_attr.prebuf > max_prebuf) + s->buffer_attr.prebuf = max_prebuf; } /* Called from main context */ |