[linux-dvb] Packet stuck in DMX buffer

Steve Malenfant smalenfant at gmail.com
Fri Dec 8 00:09:40 CET 2006


I've been trying to build an app around the DVB API to tell me exactly
when a PID will appear in a transport stream.  The problem I face is
that when I start my program, it goes and read in the dmx buffer and
finds PIDs in there that are actually not present on the transport
stream.

I'm using the standard way to set the filter...

  memset (&filter, 0, sizeof (struct dmx_pes_filter_params));

  filter.pid = 81;
  filter.input  = DMX_IN_FRONTEND;
  filter.output = DMX_OUT_TS_TAP;
  filter.pes_type = DMX_PES_OTHER;
  filter.flags = DMX_IMMEDIATE_START;

  if (ioctl(fd_dmx,DMX_SET_PES_FILTER,&filter) < 0) {
    close (fd_dmx);
    close (fd_dvr);
    return -1;
  }

Then I go read the file descriptor of the dvr...

The first time I launch the app, it works just fine.  I see my pid
arriving and then exit (properly stop the DMX, close dmx and dvr).

I stop my stream from going to the transport and then I wait long
enough to make sure it's not present anymore...

The I re-launch the app and after I read the first packet off the dvr
file descriptor I get a packet in there.

The same thing happen if I try to use dvbsnoop and filter on the same
PID, looks like the ringbuffer isn't re-initialized (I don't much
about the DVB API).

So, maybe this is a normal behavior but if I'm doing continuity
counter check on that PID, I get errors for the first 238 packets
(stuck in file descriptor?) then it's OK.  Looks like new packets gets
written along with old packets which creates errors...  It might be
the DVB card I'm using that's causing this (Technisat HD5000)

Is there a way to check if there is packets available to read?  Cause
I'd like to empty before I start waiting for this PID to come.  I've
tried using FIONREAD but it's not supported (result -1).

Any help?
Thanks.

Steve M.



More information about the linux-dvb mailing list