mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-01 22:58:47 -04:00
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>
This commit is contained in:
parent
cbc0d5ffcb
commit
a1c4a6916f
1 changed files with 5 additions and 3 deletions
|
|
@ -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)
|
if (pa_atou(e, &ms) < 0 || ms <= 0)
|
||||||
pa_log_debug("Failed to parse $PULSE_LATENCY_MSEC: %s", e);
|
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 {
|
else {
|
||||||
attr->maxlength = (uint32_t) -1;
|
attr->maxlength = (uint32_t) -1;
|
||||||
attr->tlength = pa_usec_to_bytes(ms * PA_USEC_PER_MSEC, &s->sample_spec);
|
attr->tlength = pa_usec_to_bytes(ms * PA_USEC_PER_MSEC, &s->sample_spec);
|
||||||
attr->minreq = (uint32_t) -1;
|
attr->minreq = (uint32_t) -1;
|
||||||
attr->prebuf = (uint32_t) -1;
|
attr->prebuf = (uint32_t) -1;
|
||||||
attr->fragsize = attr->tlength;
|
attr->fragsize = attr->tlength;
|
||||||
}
|
|
||||||
|
|
||||||
if (flags)
|
if (flags)
|
||||||
*flags |= PA_STREAM_ADJUST_LATENCY;
|
*flags |= PA_STREAM_ADJUST_LATENCY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->context->version >= 13)
|
if (s->context->version >= 13)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue