libdvbv5: Fix the speedup scan condition
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 2 May 2014 13:52:29 +0000 (06:52 -0700)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 2 May 2014 13:52:29 +0000 (06:52 -0700)
The DVB table read routine has 3 operational modes: it can seek for an
specific table section, it can expect sequential table sections, or it
can wait non-sequencial sections, stopping when a section is duplicated.

The second mode (sequencial table sections) finishes the reading after
receiving all table sections from 0 to the max table section, speeding
up its reception, while being more reliant to section errors.

However, the tests for the stop condition for this mode were wrong.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
lib/libdvbv5/dvb-scan.c

index dfb597a..297ac59 100644 (file)
@@ -196,7 +196,7 @@ static int dvb_parse_section(struct dvb_v5_fe_parms *parms,
        if (priv->last_section < 0)
                priv->last_section = h.last_section;
        else { /* Check if the table was already parsed, but not on first pass */
-               if (!sect->allow_section_gaps && sect->ts_id != -1) {
+               if (!sect->allow_section_gaps && sect->ts_id == -1) {
                        if (test_bit(h.section_id, priv->is_read_bits))
                                return 0;
                } else if (priv->first_ts_id == h.id && priv->first_section == h.section_id) {
@@ -217,7 +217,7 @@ static int dvb_parse_section(struct dvb_v5_fe_parms *parms,
        }
 
        /* handle the sections */
-       if (!sect->allow_section_gaps && sect->ts_id != -1)
+       if (!sect->allow_section_gaps && sect->ts_id == -1)
                set_bit(h.section_id, priv->is_read_bits);
 
        if (dvb_table_initializers[tid])
@@ -227,7 +227,7 @@ static int dvb_parse_section(struct dvb_v5_fe_parms *parms,
                dvb_logerr("%s: no initializer for table %d",
                           __func__, tid);
 
-       if (!sect->allow_section_gaps && sect->ts_id != -1 &&
+       if (!sect->allow_section_gaps && sect->ts_id == -1 &&
                        is_all_bits_set(priv->last_section, priv->is_read_bits))
                priv->done = 1;