[pulseaudio-discuss] [PATCH] stream: Check sample spec validity before abiding PULSE_LATENCY_MSEC

David Henningsson david.henningsson at canonical.com
Fri Jun 12 00:01:21 PDT 2015



On 2015-06-11 07:33, Arun Raghavan wrote:
> On 10 June 2015 at 20:59, David Henningsson
> <david.henningsson at canonical.com> wrote:
>> 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);
>
> Other than that error message needing fixing ("e" is not valid in the
> else if clause), this looks fine.

e should be a valid string, as retrieved earlier from getenv(). pa_atou 
takes a "const char*", so it should not modify e. Am I missing something?

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list