aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-core
diff options
context:
space:
mode:
authorMark Adams <mark147m@gmail.com>2005-11-09 00:35:50 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:05 -0500
commitb3967d6c251d8482fe42a1aad3cc292ee04c0a6b (patch)
treeb885c08047d209504a4b774bc07b641c51a8721e /drivers/media/dvb/dvb-core
parentf0fa86a574843264bdcbed4c84b41a2778861fde (diff)
[PATCH] dvb: fix bug in demux that caused lost mpeg sections
Fix a bug in the software demux which causes large MPEG sections to be lost when they follow very small sections. The problem happens when two sections begin in the same transport packet. The dvb_demux code resets its buffer only before the first of these sections. This means that when the second (or subsequent) section begins, there is up to 182 bytes of buffer space already used. If the following section is close to the maximum size, it currently won't fit in the (4096-byte) buffer and is thrown away. The fix is simply to enlarge the buffer by the size of one transport packet and correct one usage of the SECFEED_SIZE definition where what is really meant is the maximum size of a section. Signed-off-by: Mark Adams <mark147m@gmail.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Cc: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/dvb-core')
-rw-r--r--drivers/media/dvb/dvb-core/demux.h5
-rw-r--r--drivers/media/dvb/dvb-core/dvb_demux.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/dvb/dvb-core/demux.h b/drivers/media/dvb/dvb-core/demux.h
index 9719a3b30f7..7d7b0067f22 100644
--- a/drivers/media/dvb/dvb-core/demux.h
+++ b/drivers/media/dvb/dvb-core/demux.h
@@ -48,8 +48,11 @@
48 * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed filter. 48 * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed filter.
49 */ 49 */
50 50
51#ifndef DMX_MAX_SECTION_SIZE
52#define DMX_MAX_SECTION_SIZE 4096
53#endif
51#ifndef DMX_MAX_SECFEED_SIZE 54#ifndef DMX_MAX_SECFEED_SIZE
52#define DMX_MAX_SECFEED_SIZE 4096 55#define DMX_MAX_SECFEED_SIZE (DMX_MAX_SECTION_SIZE + 188)
53#endif 56#endif
54 57
55 58
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c
index dc476dda2b7..b4c899b1595 100644
--- a/drivers/media/dvb/dvb-core/dvb_demux.c
+++ b/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -246,7 +246,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed,
246 246
247 for (n = 0; sec->secbufp + 2 < limit; n++) { 247 for (n = 0; sec->secbufp + 2 < limit; n++) {
248 seclen = section_length(sec->secbuf); 248 seclen = section_length(sec->secbuf);
249 if (seclen <= 0 || seclen > DMX_MAX_SECFEED_SIZE 249 if (seclen <= 0 || seclen > DMX_MAX_SECTION_SIZE
250 || seclen + sec->secbufp > limit) 250 || seclen + sec->secbufp > limit)
251 return 0; 251 return 0;
252 sec->seclen = seclen; 252 sec->seclen = seclen;