Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: Help on use of DMX_OUT_TAP (II)



> > Buf size is 512, video_fd=3, audio_fd=4.
> > Errno 75: video_fd read: Value too large for defined data type
> > Read 512 bytes from audio_fd.
> > Read 512 bytes from audio_fd.
> > Errno 75: video_fd read: Value too large for defined data type
> > Read 512 bytes from audio_fd.
> 
> It works if the devices are opened with O_NONBLOCK. And this is
> indeed a driver bug. Posix guarantees that if a fd is signalled
> as readable be select() or poll(), the next read() will *never* block.
> But currently it will block until the read() buffer is completely
> filled, unless O_NONBLOCK is specified.
> 
> Thanks for uncovering this bug, I will look into it as my time permits.

Thanks for the clue, I managed to find the problem as well. I fixed it, 
but then I found another bug as well. I fixed it by doing the 
following in dmxdev.c:dvb_dmxdev_buffer_read():

while (todo>0) {
  if (non_blocking && (src->pwrite==src->pread))
  return (count-todo) ? (count-todo) : -EWOULDBLOCK;
  
>>  if ((!non_blocking) && ((count - todo) > 0)  && (src->pwrite==src->pread))
>>     return (count-todo);
  
  if (wait_event_interruptible(src->queue,
			       (src->pread!=src->pwrite) ||
			       (src->error))<0)
  return count-todo;

My new code is indented with ">>". I don't know if this is a very good fix
though? From memory, I think the proper thing to do is to wait for a
certain amount of data to be available. The threshold can be specified
with an ioctl(), but defaults to some sensible value (half the buffer 
size?).

But when I did this fix I found that I still got overflow errors. I 
instrumented the code a lot and found that the read routine couldn't keep 
up with the write routine. The buffer size was the default, 8192 bytes. 
This doesn't seem large enough on my PC, ie. it gets filled too quickly 
before the read routine can get in. However, my PC is pretty quick, and it 
is only 2% loaded, so I think the buffer default size needs increasing. 
16KB was enough for me, but if somebody has a slower PC they might need 
bigger. Is there any problem with making the default bigger. It's pretty 
useless at the moment.

Anyway, thanks very much for your help, I now have a working driver so I
can begin my application now....

James.



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index