]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
linuxdvb: make the status period (read times) configurable
authorJaroslav Kysela <perex@perex.cz>
Sat, 17 Jan 2015 18:14:23 +0000 (19:14 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sat, 17 Jan 2015 18:20:49 +0000 (19:20 +0100)
docs/html/config_tvadapters.html
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/linuxdvb/linuxdvb_private.h

index 27a9c2732067498eb3428ae367b585b6c8ebe883..542ecbb07b4cc41f1d4e6d740b05975118ff8880 100644 (file)
@@ -76,6 +76,14 @@ The rows have the following functions
  <dt><b>Input Buffer (Bytes)</b></dt>
   <dd>By default, linuxdvb input buffer is 18800 bytes long. The accepted
       range is 18800-1880000 bytes.</dd>
+<p>
+ <dt><b>Status Period</b></dt>
+  <dd>By default, linuxdvb status read period is 1000ms (one second). The
+      accepted range is 250ms to 8000ms. Note that for some hardware /
+      drivers (like USB), the status operations takes too much time and CPU.
+      In this case, increase the default value. For fast hardware, this value
+      might be descreased to make the decision of the re-tune algorithm
+      based on the signal status faster.</dd>
 </dl>
 
 <p>
index 620dcec30f4abf04bc0c99561da0a7fb10bc5212..1e7668ed70a7fc4e4da77e1f86bda487594f7bb8 100644 (file)
@@ -113,6 +113,13 @@ const idclass_t linuxdvb_frontend_class =
       .opts     = PO_ADVANCED,
       .off      = offsetof(linuxdvb_frontend_t, lfe_ibuf_size),
     },
+    {
+      .type     = PT_U32,
+      .id       = "status_period",
+      .name     = "Status Period (ms)",
+      .opts     = PO_ADVANCED,
+      .off      = offsetof(linuxdvb_frontend_t, lfe_status_period),
+    },
     {}
   }
 };
@@ -491,6 +498,7 @@ linuxdvb_frontend_monitor ( void *aux )
   streaming_message_t sm;
   service_t *s;
   int logit = 0, retune;
+  uint32_t period = MIN(MAX(250, lfe->lfe_status_period), 8000);
 #if DVB_VER_ATLEAST(5,10)
   struct dtv_property fe_properties[6];
   struct dtv_properties dtv_prop;
@@ -526,7 +534,7 @@ linuxdvb_frontend_monitor ( void *aux )
   if (!mmi || !lfe->lfe_ready) return;
 
   /* re-arm */
-  gtimer_arm(&lfe->lfe_monitor_timer, linuxdvb_frontend_monitor, lfe, 1);
+  gtimer_arm_ms(&lfe->lfe_monitor_timer, linuxdvb_frontend_monitor, lfe, period);
 
   /* Get current status */
   if (ioctl(lfe->lfe_fe_fd, FE_READ_STATUS, &fe_status) == -1) {
@@ -609,10 +617,9 @@ linuxdvb_frontend_monitor ( void *aux )
       lfe->lfe_monitor = dispatch_clock + 1;
     }
   } else {
-    /* Monitor 1 per sec */
     if (dispatch_clock < lfe->lfe_monitor)
       return;
-    lfe->lfe_monitor = dispatch_clock + 1;
+    lfe->lfe_monitor = dispatch_clock + (period + 999) / 1000;
   }
 
   /* Statistics - New API */
@@ -1441,6 +1448,7 @@ linuxdvb_frontend_create
   strncpy(lfe->lfe_name, name, sizeof(lfe->lfe_name));
   lfe->lfe_name[sizeof(lfe->lfe_name)-1] = '\0';
   lfe->lfe_ibuf_size = 18800;
+  lfe->lfe_status_period = 1000;
   lfe = (linuxdvb_frontend_t*)mpegts_input_create0((mpegts_input_t*)lfe, idc, uuid, conf);
   if (!lfe) return NULL;
 
index f03557c8b086dd1285a86b3462ca5171ffd1c606..cac9e5b6c885112b1060f6d4b20e2fecb50bb6ab 100644 (file)
@@ -117,6 +117,7 @@ struct linuxdvb_frontend
   int                       lfe_tune_repeats;
   uint32_t                  lfe_skip_bytes;
   uint32_t                  lfe_ibuf_size;
+  uint32_t                  lfe_status_period;
 
   /*
    * Satconf (DVB-S only)