diff options
author | Johannes Stezenbach <devnull@localhost> | 2005-01-06 11:47:08 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2005-01-06 11:47:08 +0000 |
commit | ed4061bc5e018bd9e1cf9ac649461bb68fd39f28 (patch) | |
tree | a4075b21544d2a2f2c381bd17becc784f3004cce | |
parent | ec4ba832298d36042d59844b9d05fe111c8beca5 (diff) | |
download | mediapointer-dvb-s2-ed4061bc5e018bd9e1cf9ac649461bb68fd39f28.tar.gz mediapointer-dvb-s2-ed4061bc5e018bd9e1cf9ac649461bb68fd39f28.tar.bz2 |
patch by Emard: handle PUSI in section filter correctly
(fix bug reported by Patrick Valsecchi)
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_demux.c | 30 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_demux.h | 3 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/budget-core.c | 1 |
3 files changed, 31 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c index c05e98e5c..26c793d13 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c @@ -249,7 +249,22 @@ static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) } /* -** Losless Section Demux 1.4 by Emard +** Losless Section Demux 1.4.1 by Emard +** Valsecchi Patrick: +** - middle of section A (no PUSI) +** - end of section A and start of section B +** (with PUSI pointing to the start of the second section) +** +** In this case, without feed->pusi_seen you'll receive a garbage section +** consisting of the end of section A. Basically because tsfeedp +** is incemented and the use=0 condition is not raised +** when the second packet arrives. +** +** Fix: +** when demux is started, let feed->pusi_seen = 0 to +** prevent initial feeding of garbage from the end of +** previous section. When you for the first time see PUSI=1 +** then set feed->pusi_seen = 1 */ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, const u8 *buf, u8 len) { @@ -295,7 +310,12 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, const sec->seclen = seclen; sec->crc_val = ~0; /* dump [secbuf .. secbuf+seclen) */ - dvb_dmx_swfilter_section_feed(feed); + if(feed->pusi_seen) + dvb_dmx_swfilter_section_feed(feed); +#ifdef DVB_DEMUX_SECTION_LOSS_LOG + else + printk("dvb_demux.c pusi not seen, discarding section data\n"); +#endif sec->secbufp += seclen; /* secbufp and secbuf moving together is */ sec->secbuf += seclen; /* redundand but saves pointer arithmetic */ } @@ -328,6 +348,10 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 ** in the following dvb_dmx_swfilter_section_new */ #endif + /* Discontinuity detected. Reset pusi_seen = 0 to + ** stop feeding of suspicious data until next PUSI=1 arrives + */ + feed->pusi_seen = 0; dvb_dmx_swfilter_section_new(feed); return 0; } @@ -343,6 +367,8 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 u8 after_len = count-1-before_len; dvb_dmx_swfilter_section_copy_dump(feed, before, before_len); + /* before start of new section, set pusi_seen = 1 */ + feed->pusi_seen = 1; dvb_dmx_swfilter_section_new(feed); dvb_dmx_swfilter_section_copy_dump(feed, after, after_len); } diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.h b/linux/drivers/media/dvb/dvb-core/dvb_demux.h index 98acadbe1..3f40fe16d 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.h @@ -93,7 +93,8 @@ struct dvb_demux_feed { enum dmx_ts_pes pes_type; int cc; - + int pusi_seen; /* prevents feeding of garbage from previous section */ + u16 peslen; struct list_head list_head; diff --git a/linux/drivers/media/dvb/ttpci/budget-core.c b/linux/drivers/media/dvb/ttpci/budget-core.c index 04d094316..b4cc259f1 100644 --- a/linux/drivers/media/dvb/ttpci/budget-core.c +++ b/linux/drivers/media/dvb/ttpci/budget-core.c @@ -253,6 +253,7 @@ static int budget_start_feed(struct dvb_demux_feed *feed) return -EINVAL; spin_lock(&budget->feedlock); + feed->pusi_seen = 0; /* have a clean section start */ status = start_ts_capture(budget); spin_unlock(&budget->feedlock); return status; |