[mythtv-users] Storing recordings on network share

Simon Hobson linux at thehobsons.co.uk
Fri Sep 23 18:40:36 UTC 2011


Travis Tabbal wrote:

>>How is the size of that buffer determined ?

>It was hardcoded last time I looked in the source. 
>ThreadedFileWriter.cpp IIRC.

Correct, I've downloaded the source to have a look, and I see that it 
is indeed configured there.
TFW_DEF_BUF_SIZE   = 2*1024*1024;
TFW_MAX_WRITE_SIZE = TFW_DEF_BUF_SIZE / 4;
TFW_MIN_WRITE_SIZE = TFW_DEF_BUF_SIZE / 32;

Now, I've never programmed in C or C++, but with the comments I can 
get a jist of some of what the code is doing.

So our buffer is by default only 2MByte. That's as short as only a 
couple of seconds, even at our DVB-T SD rates. That seems incredibly 
small to me.

Can someone confirm that even while we are syncing the file (one 
thread), we are still able to send file data to the kernel (separate 
thread) - ie writes from buffer to kernel aren't blocked by the 
earlier writes being synced to disk ? If that is the case, then I can 
see how this arrangement works - as long as the kernel itself will 
accept more data into it's buffers, then we'll have no problem 
keeping this buffer reasonably available. But, if we block writing to 
the kernel, then this buffer will fill up and we'll lose data.

One last thing. Is it easy to build just this one bit of code 
(library ?) ? I'd kinda like to try a larger buffer size and see if 
it makes any difference - but I don't want to rebuild everything 
(I've only built the whole thing as per the install instructions) and 
risk breaking my setup.
-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.


More information about the mythtv-users mailing list