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



From: Lionel Landwerlin <lionel g landwerlin linux intel com>

When running in splitted modes (usually when dealing with websites),
if you get less results than what the user would like to get, we
currently end up in an infinite loop with the core of grilo keeping
asking for new items from a source which can't deliver anymore.

To manage this specific case, we just check whether the plugin has
returned a remaining results number equals to 0 as well as a null
item.

Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
---
 src/grl-media-source.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index 5ffe260..b97334e 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -697,9 +697,12 @@ browse_result_relay_cb (GrlMediaSource *source,
     as_info->count--;
     as_info->chunk_consumed++;
 
-    /* FIXME: If we received less than we requested we should
-       not do an extra query */
-    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;
   }
 
   /* --- relay operation  --- */
-- 
1.7.5.4



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