summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Waechtler <devnull@localhost>2003-06-29 21:52:02 +0000
committerHolger Waechtler <devnull@localhost>2003-06-29 21:52:02 +0000
commitac71da82b8b5decadf5e8781e9e3dbc82447093b (patch)
treef49db0ab7654f55760da5dd1a3c9f0f3dc7a2ca5
parentc554b7d506bbc8e6e63e334af1599ca562093b6b (diff)
downloadmediapointer-dvb-s2-ac71da82b8b5decadf5e8781e9e3dbc82447093b.tar.gz
mediapointer-dvb-s2-ac71da82b8b5decadf5e8781e9e3dbc82447093b.tar.bz2
add some sanity checks and additional locking in synchronizer code
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_demux.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c
index b5edf3af2..affe8b3a8 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -404,15 +404,18 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t cou
void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
{
int p = 0,i, j;
-
+
+ spin_lock(&demux->lock);
+
if ((i = demux->tsbufp)) {
if (count < (j=188-i)) {
memcpy(&demux->tsbuf[i], buf, count);
demux->tsbufp += count;
- return;
+ goto bailout;
}
memcpy(&demux->tsbuf[i], buf, j);
- dvb_dmx_swfilter_packet(demux, demux->tsbuf);
+ if (demux->tsbuf[0] == 0x47)
+ dvb_dmx_swfilter_packet(demux, demux->tsbuf);
demux->tsbufp = 0;
p += j;
}
@@ -426,11 +429,14 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
i = count-p;
memcpy(demux->tsbuf, buf+p, i);
demux->tsbufp=i;
- return;
+ goto bailout;
}
} else
p++;
}
+
+bailout:
+ spin_unlock(&demux->lock);
}