]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
bouquets: fastscan - do not check the frequency too strictly
authorJaroslav Kysela <perex@perex.cz>
Thu, 20 Nov 2014 11:28:13 +0000 (12:28 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 20 Nov 2014 11:28:13 +0000 (12:28 +0100)
src/input/mpegts/fastscan.c

index 17233fb835d4df3d688fbc6f27e04cd1489ade48..7f8e1a91799f634d52e1df2d77b88def052ee807 100644 (file)
@@ -47,15 +47,13 @@ static SKEL_DECLARE(fastscan_rb_skel, dvb_fastscan_t);
 static int
 _fs_cmp(const void *a, const void *b)
 {
-  int64_t aa = ((dvb_fastscan_t *)a)->position * 1000000000LL +
-               ((dvb_fastscan_t *)a)->frequency;
-  int64_t bb = ((dvb_fastscan_t *)b)->position * 1000000000LL +
-               ((dvb_fastscan_t *)b)->frequency;
-  if (aa < bb)
-    return -1;
-  if (aa > bb)
-    return 1;
-  return 0;
+  int r = ((dvb_fastscan_t *)a)->position - ((dvb_fastscan_t *)b)->position;
+  if (r == 0) {
+    r = ((dvb_fastscan_t *)a)->frequency - ((dvb_fastscan_t *)b)->frequency;
+    if (abs(r) < 2000)
+      return 0;
+  }
+  return r;
 }
 
 void