Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
linuxdvb: make the status period (read times) configurable
  • Loading branch information
perexg committed Jan 17, 2015
1 parent f157e18 commit dafea1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions docs/html/config_tvadapters.html
Expand Up @@ -76,6 +76,14 @@ <h3>The adapters and tuners are listed / edited in a tree</h3>
<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>
Expand Down
14 changes: 11 additions & 3 deletions src/input/mpegts/linuxdvb/linuxdvb_frontend.c
Expand Up @@ -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),
},
{}
}
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/input/mpegts/linuxdvb/linuxdvb_private.h
Expand Up @@ -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)
Expand Down

0 comments on commit dafea1a

Please sign in to comment.