[mythtv] Small code improvement.

michael at optusnet.com.au michael at optusnet.com.au
Sun May 11 13:18:15 EDT 2003

Isaac Richards <ijr at po.cwru.edu> writes:
> On Saturday 10 May 2003 12:59 am, michael at optusnet.com.au wrote:
> > In RingBuffer.cpp, there's code to read from a remotefile.
> > It _looks_ like it was supposed to maintain a window of
> > requests ahead of the reads. Unfortunately, it's doesn't
> > achieve that purpose.
> No, that's not the intent.  That _used_ to be how it worked, but with the 
> addition of the prebuffer thread, it's not used that way anymore.

Indeed. I was looking at 0.8 and the CVS version is indeed different.

Note that it's still useful on higher latency links to have the
pre-fetch window there. Your max read rate is always proportional to

         min( bandwidth , window_size / latency )

so no matter how much read-ahead you do, you can't saturate a higher
latency network link without windowing the requests. (given that a
typical remote machine can have 20 ms or more of latency, I care
about this :)

> > Mythtv seems to be full of 'magic numbers' that aren't in
> > configuration files. 
> > Is there an intention to turn these into variable and move
> > into a configuration file somewhere!?
> Nope.  People would break things by messing around with settings they don't 
> understand and then complain to the list =)

Would you object if I at least moved all the magic numbers to 
variable, and consolidated them in one place?

I'm finding some areas of the code very difficult to understand.
Would you object to a patch to simplified some things, and added
a bunch of comments?

I have rather a lot of unanswered questions. :)

What does TransitionToFile do? (vs TransitionToRing?)
(I.e. why does it exist?)

In RingBuffer::safe_read(int,void*,int) when the read()
gives EOF, why does it try another 20 times before
failing? (I notice similar code in lots of other

Many thanks,

More information about the mythtv-dev mailing list