On Tue, 06 Jan 2004 15:31:43 +0100
Holger Waechtler <holger@convergence.de> wrote:
When a buffer overflows the ringbuffer pointers are reset, errno is set
to EOVERFLOW. The data that has been previously in the ringbuffer will
get lost.
And the read call returns -1, easily causing the reading program to
stop reading (if there isn't a special case handling).
POSIX requires you to check errno in case of a return value of -1. Then
you see errno=EOVERFLOW and see that it's not a critical error. Maybe
you want to flush/reset some of your program's buffers and log an error
message, then you can continue.so the limit can't be even raised. The default is 10*1024*188 bytes
(which is only one second with HDTV at 15Mbit/s).
You don't want to write a program that reads and processes the stream
only every second, right? This would cause pretty heavy latencies...
Well, even if the program is not designed to wait one second it can
easily happen under heavy system activity.
As regards latencies, in some cases I'm not interested in them at all;
for example a
cat /dev/dvb/adapter0/dvr0 >recording.ts
with several megabytes of buffer would be very robust.
Think about it this way: I need just around 2MB/s of throughput and
an autorefreshed page in Mozilla ruins my recording, on a machine
with 800 megabytes of free RAM, because we actually use only a
little part of it to smooth the stream flow. Isn't it reasonable
to have a huge buffer in such a case?
Have you tried buffering in userspace?