media: ngene: move the tsin_exchange() stripcopy block into a function
Move the copy logic that will skip previously inserted TS NULL frames when moving data to the DVB ring buffers into an own function. This is done to not duplicate code all over the place with the following TS offset shift fixup patch. While we're touching this part of the code, get rid of the DEBUG_CI_XFER debug-ifdeffery. This could be toggleable either by a Kconfig or a module param, but in the end this will accidentally be enabled and cause lots of kernel log messages, and such devel debug shouldn't be there anyway. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
88cfc33f55
commit
e5fc6767ea
|
@ -139,12 +139,15 @@ static void swap_buffer(u32 *p, u32 len)
|
||||||
/* start of filler packet */
|
/* start of filler packet */
|
||||||
static u8 fill_ts[] = { 0x47, 0x1f, 0xff, 0x10, TS_FILLER };
|
static u8 fill_ts[] = { 0x47, 0x1f, 0xff, 0x10, TS_FILLER };
|
||||||
|
|
||||||
/* #define DEBUG_CI_XFER */
|
static inline void tsin_copy_stripped(struct ngene *dev, void *buf)
|
||||||
#ifdef DEBUG_CI_XFER
|
{
|
||||||
static u32 ok;
|
if (memcmp(buf, fill_ts, sizeof(fill_ts)) != 0) {
|
||||||
static u32 overflow;
|
if (dvb_ringbuffer_free(&dev->tsin_rbuf) >= 188) {
|
||||||
static u32 stripped;
|
dvb_ringbuffer_write(&dev->tsin_rbuf, buf, 188);
|
||||||
#endif
|
wake_up(&dev->tsin_rbuf.queue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags)
|
void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags)
|
||||||
{
|
{
|
||||||
|
@ -157,28 +160,8 @@ void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags)
|
||||||
|
|
||||||
if (dev->ci.en && chan->number == 2) {
|
if (dev->ci.en && chan->number == 2) {
|
||||||
while (len >= 188) {
|
while (len >= 188) {
|
||||||
if (memcmp(buf, fill_ts, sizeof fill_ts) != 0) {
|
tsin_copy_stripped(dev, buf);
|
||||||
if (dvb_ringbuffer_free(&dev->tsin_rbuf) >= 188) {
|
|
||||||
dvb_ringbuffer_write(&dev->tsin_rbuf, buf, 188);
|
|
||||||
wake_up(&dev->tsin_rbuf.queue);
|
|
||||||
#ifdef DEBUG_CI_XFER
|
|
||||||
ok++;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef DEBUG_CI_XFER
|
|
||||||
else
|
|
||||||
overflow++;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef DEBUG_CI_XFER
|
|
||||||
else
|
|
||||||
stripped++;
|
|
||||||
|
|
||||||
if (ok % 100 == 0 && overflow)
|
|
||||||
dev_warn(&dev->pci_dev->dev,
|
|
||||||
"%s: ok %u overflow %u dropped %u\n",
|
|
||||||
__func__, ok, overflow, stripped);
|
|
||||||
#endif
|
|
||||||
buf += 188;
|
buf += 188;
|
||||||
len -= 188;
|
len -= 188;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue