summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2015-06-10 17:29:54 +0200
committerArun Raghavan <git@arunraghavan.net>2015-06-12 12:43:14 +0530
commita1c4a6916f74306fb1ddc9c1d5a77a57e4e30a6f (patch)
tree1116534c15351d3c4dc1afbb2d65e2df589a23d8
parentcbc0d5ffcbc32a193205bdfc14fc0a476d30c3d1 (diff)
downloadpulseaudio-a1c4a6916f74306fb1ddc9c1d5a77a57e4e30a6f.tar.gz
stream: Check sample spec validity before abiding PULSE_LATENCY_MSEC
In case the sample spec is not known, as can be the case when pa_stream_new_extended is used, we cannot satisfy the PULSE_LATENCY_MSEC request. As a workaround disable being able to use PULSE_LATENCY_MSEC in this case. Reported-by: Fritsch <fritsch@xbmc.org> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
-rw-r--r--src/pulse/stream.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index d4ad50520..c301b8eec 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -990,16 +990,18 @@ static void patch_buffer_attr(pa_stream *s, pa_buffer_attr *attr, pa_stream_flag
if (pa_atou(e, &ms) < 0 || ms <= 0)
pa_log_debug("Failed to parse $PULSE_LATENCY_MSEC: %s", e);
+ else if (!pa_sample_spec_valid(&s->sample_spec))
+ pa_log_debug("Ignoring $PULSE_LATENCY_MSEC: %s (invalid sample spec)", e);
else {
attr->maxlength = (uint32_t) -1;
attr->tlength = pa_usec_to_bytes(ms * PA_USEC_PER_MSEC, &s->sample_spec);
attr->minreq = (uint32_t) -1;
attr->prebuf = (uint32_t) -1;
attr->fragsize = attr->tlength;
- }
- if (flags)
- *flags |= PA_STREAM_ADJUST_LATENCY;
+ if (flags)
+ *flags |= PA_STREAM_ADJUST_LATENCY;
+ }
}
if (s->context->version >= 13)