Re: [PATCH 2/2] media-source: manage end of search/browse with splitted sources



On Tue, 2011-06-28 at 15:59 +0100, lionel g landwerlin linux intel com
wrote:
> -    remaining = as_info->count;
> +    /* When auto split, if we receive a NULL media, we're at the
> +       end. */
> +    if (media == NULL)
> +      remaining = 0;
> +    else
> +      remaining = as_info->count; 

Already discussed with Lionel through IRC.

You shouldn't rely on media==NULL to know if there are more elements or
no. You must check the remaining==0 for that. In fact, a source can send
a non-NULL media with remaining==0 to tell that it is the last element.

Of course, with autosplit things are more complicated. Roughly speaking,
what the core should do is to check if source has satisfied all the
elements in the chunk. If so, and there user asked for more elements,
let's ask for next chunk.

But if the chunk was not satisfied (that is, source sent less elements
than asked for the chunk), then it means the source has no more
elements, so it makes no sense to ask for next chunk, because you know
it will send no elements. So at that moment, you can stop the query.

I was doing that in the work-in-process plugin refactoring: I'm counting
how much elements the source is sending so at the end I can check if it
sent chunk-size elements or not.

	J.A.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]