[vdr] ring buffer overflow under high cpu load

Reinhard Nissl rnissl at gmx.de
Sun Mar 26 13:19:38 CEST 2006


Hi,

C.Y.M wrote:

>> What are your buffer settings in vdr-xine?
> 
> I had xine on the default settings.  The buffer set to 8 and hystersis set to 4
> frames.  Perhaps with the hysteresis, I should lower the buffer to 6 and
> hysteresis to 3? What is your recommended setting?  This is an athlon 2000 with
> 756MB RAM.

I've just tried 32 and 4 (= a total of 36 frames) and didn't get any 
overflow.

What's your buffer usage which VDR reports in syslog?

E. g. for the above settings, I get the following report when switching 
away from channel ZDF after vdr-xine has reported it's final buffer size:

Mar 26 13:07:12 video vdr: [10254] transfer thread ended (pid=9307, 
tid=10254)
Mar 26 13:07:12 video vdr: [9307] buffer stats: 209432 (9%) used
Mar 26 13:07:12 video vdr: [10257] TS buffer on device 2 thread ended 
(pid=9307, tid=10257)
Mar 26 13:07:12 video vdr: [10255] buffer stats: 123892 (5%) used
Mar 26 13:07:12 video vdr: [10255] receiver on device 2 thread ended 
(pid=9307, tid=10255)

>> With the update from 0.7.6 to 0.7.7 you had to reduce the prebuffer as
>> it is now exactly measured. And with 0.7.8 you should reduce the
>> prebuffer further as it is increased indirectly by hysteresis.
>>
>> If you buffer too much, then VDR will report a buffer overflow
>> (especially under high CPU load), as the buffer is provided by VDR
>> (#define TRANSFERBUFSIZE MEGABYTE(2)).
>>
>> As the satellite streams at a constant rate, VDR puts as much data into
>> the buffer as xine takes out of it. So the buffer should never run full
>> and the average buffer usage depends on the above settings. But if the
>> average is to high, a burst write may cause an overflow, especially when
>> xine doesn't get enough CPU time to read the buffer immediately.
> 
> Yes, this seems to be what is happening with the DVD plugin. Too much buffer and
> its getting overflowed, causing it to skip frames.

This cannot be the cause, as buffering is only active when viewing Live 
TV. The buffer is only necessary as the satellite streams at constant 
rate, but xine wants to read the data on demand.

When playing DVDs, no extra buffers are allocated at VDR side by 
vdr-xine, as the DVD drive can typically supply data at a speed higher 
than 1x and therefore can fulfill xine's on demand requests.

>> On my EPIA system with a 600 MHz C3 CPU, I run vdr with nice -n 19 and
>> xine with nice -n -20. I run VDR that nice, because background tasks
>> like EPG scan had an impact on fluent replay with xine. But meanwhile,
>> the most recent VDR versions schedule those threads a lower priority
>> anyway. So I'm not sure whether it is still a good idea to run VDR that
>> nice, especially when there are other tools like VDRConvert which run at
>> normal priority. Maybe, xine should have the highest priority and VDR
>> should be above the other processes.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:rnissl at gmx.de



More information about the vdr mailing list