summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2013-03-25 09:20:14 +0100
committerTanu Kaskinen <tanuk@iki.fi>2013-03-25 15:43:33 +0200
commit2026c41be6f4e1a526c94c1368e5e528597df03a (patch)
tree15dc194d748fbdcf57dc94c6a66e8eb29f330de2
parent450747cf22af3348a78128c4330ea553f65c2e4e (diff)
protocol-native: Ensure tlength is not set higher than maxlength
Tlength should never be set higher than maxlength. While this is corrected by memblockq later, we still need a correct tlength for the subsequent calculations. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
-rw-r--r--src/pulsecore/protocol-native.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 7095519d..e8aa13cd 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -936,6 +936,8 @@ static void fix_playback_buffer_attr(playback_stream *s) {
s->buffer_attr.tlength = (uint32_t) pa_usec_to_bytes_round_up(DEFAULT_TLENGTH_MSEC*PA_USEC_PER_MSEC, &s->sink_input->sample_spec);
if (s->buffer_attr.tlength <= 0)
s->buffer_attr.tlength = (uint32_t) frame_size;
+ if (s->buffer_attr.tlength > s->buffer_attr.maxlength)
+ s->buffer_attr.tlength = s->buffer_attr.maxlength;
if (s->buffer_attr.minreq == (uint32_t) -1)
s->buffer_attr.minreq = (uint32_t) pa_usec_to_bytes_round_up(DEFAULT_PROCESS_MSEC*PA_USEC_PER_MSEC, &s->sink_input->sample_spec);