mux create: do not update mux parameters from multiple origin muxes (nit)

NIT data:

mux: '12109H' : dvb-s2 pos 235E freq 12129000 V sym 275000 fec 2/3 mod 8PSK roff 20
mux: '11739V' : dvb-s2 pos 235E freq 12129000 V sym 275000 fec 2/3 mod 8PSK roff 25

This change avoids the frequent automatic parameter changes using
the origin (first hit) mux which broadcasted the data. The origin
mux is locked for 24 hours from the last update.
This commit is contained in:
Jaroslav Kysela 2014-05-14 14:45:10 +02:00
parent 9a3cfe9486
commit aa91e53ff9
2 changed files with 14 additions and 2 deletions

View file

@ -313,6 +313,8 @@ struct mpegts_mux
MM_SCAN_CURRENT, // Currently tuned for initial scan
} mm_initial_scan_status;
int mm_initial_scan_done;
mpegts_mux_t *mm_dmc_origin;
time_t mm_dmc_origin_expire;
/*
* Physical instances

View file

@ -278,6 +278,7 @@ dvb_network_create_mux
( mpegts_mux_t *mm, uint16_t onid, uint16_t tsid, dvb_mux_conf_t *dmc )
{
int save = 0;
mpegts_mux_t *mmo = mm;
dvb_network_t *ln = (dvb_network_t*)mm->mm_network;
mm = dvb_network_find_mux(ln, dmc);
@ -304,6 +305,10 @@ dvb_network_create_mux
mm = (mpegts_mux_t*)dvb_mux_create0(ln, onid, tsid, dmc, NULL, NULL);
} else if (mm) {
dvb_mux_t *lm = (dvb_mux_t*)mm;
/* the nit tables may be incosistent (like rolloff ping-pong) */
/* accept information only from one origin mux */
if (mm->mm_dmc_origin_expire > dispatch_clock && mm->mm_dmc_origin != mmo)
goto noop;
#if ENABLE_TRACE
#define COMPARE(x) ({ \
int xr = dmc->x != lm->lm_tuning.x; \
@ -362,8 +367,13 @@ dvb_network_create_mux
#undef COMPARE
#undef COMPAREN
}
if (save && mm)
mm->mm_config_save(mm);
if (mm) {
mm->mm_dmc_origin = mmo;
mm->mm_dmc_origin_expire = dispatch_clock + 3600 * 24; /* one day */
if (save)
mm->mm_config_save(mm);
}
noop:
return mm;
}