On Wed, Jul 21, 2004 at 07:31:36PM +0200, Wolfgang Fritz wrote: > Hello, > > I'm trying to get some facts about the infamous "video data stream > broken" error in VDR. > > The following modified code from VDR-1.3.10/dvbdevice.c cDvbTuner::Action > > active = true; > while (active) { > .... > if (tunerStatus == tsTuned) { > fe_status_t status = fe_status_t(0); > CHECK(ioctl(fd_frontend, FE_READ_STATUS, &status)); > if (status & FE_HAS_LOCK) { > tunerStatus = tsLocked; > dsyslog ("Frontend %d locked", cardIndex); > } > } > if (tunerStatus != tsIdle) { > dvb_frontend_event event; > if (ioctl(fd_frontend, FE_GET_EVENT, &event) == 0) { > dsyslog ("Event on frontend %d: %02x", cardIndex, event.status); > if (event.status & FE_REINIT) { > tunerStatus = tsSet; > esyslog("ERROR: frontend %d was reinitialized - > re-tuning", cardIndex); > continue; > } > } > } > .... > bool fast = (tunerStatus == tsTuned) || (ciHandler && > (time(NULL) - startTime < 20)); > newSet.TimedWait(mutex, fast ? 100 : 1000); > } > > sometimes gives the following output: > > Jul 21 19:06:21 vdr vdr[1697]: Event on frontend 1: 00 > Jul 21 19:06:21 vdr vdr[1697]: Frontend 1 locked > Jul 21 19:06:21 vdr vdr[1697]: Event on frontend 1: 03 > Jul 21 19:06:22 vdr vdr[1697]: Event on frontend 1: 1f > > What does this mean? > > - Did the frontend really lose lock for a short time? > > Or > > - Are the frontend events queued so that the event "03" > in fact occured before the "Frontend 1 locked"?
Events are queued. You are supposed to use poll() and read events as soon as they are generated, or let FE_GET_EVENT block waiting for events. To fix up vdr you could also open the frontend with O_NONBLOCK and loop until FE_GET_EVENT returns -EGAIN, discarding old events. Once upon a time szap did something like that: http://linuxtv.org/cgi-bin/cvsweb.cgi/DVB/apps/szap/szap.c?rev=1.3.2.1&content-type=text/plain Johannes