[vlc-devel] [PATCH 1/2] httplive: fix Read func. (when caller skips data)

Frederic YHUEL fyhuel at viotech.net
Mon Jan 9 15:18:14 CET 2012


On Wed, Jan 4, 2012 at 2:02 PM, Frederic YHUEL <fyhuel at viotech.net> wrote:
>>>>>
>>>>> diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
>>>>> index 4d60d8a..58dc1db 100644
>>>>> --- a/modules/stream_filter/httplive.c
>>>>> +++ b/modules/stream_filter/httplive.c
>>>>> @@ -1912,7 +1912,8 @@ static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read)
>>>>>
>>>>>         if (len > 0)
>>>>>         {
>>>>> -            memcpy(p_read + copied, segment->data->p_buffer, len);
>>>>> +            if( p_read ) /* otherwise caller skips data */
>>>>> +                memcpy(p_read + copied, segment->data->p_buffer, len);
>>>>
>>>> Below you update the segment data buffer while p_read is NULL, which
>>>> is the wrong thing to do.
>>>>
>>
>> So what is the right thing to do? Do you agree that currently data is
>> read (instead of being skipped) when p_read is null?
>>
>
> I mean, what's the point to allocate a buffer and memcpy data in it,
> if the caller just wants to skips that data?
>
> Ok it will not hinder perf a lot, but it makes code harder to understand.
>
> Or am I missing something?
>

Ping?


-- 
Frédéric



More information about the vlc-devel mailing list