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 at xbmc.org> Signed-off-by: David Henningsson <david.henningsson at canonical.com> --- src/pulse/stream.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pulse/stream.c b/src/pulse/stream.c index d4ad505..c301b8e 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) -- 1.9.1