[mythtv] memory buffer for live video video stream

mirak mirak63 at wanadoo.fr
Sun Nov 12 00:51:47 UTC 2006


Hi,

So,  I have read this FAQ :

****************************************************************************************************** 



      Q: When using live TV, why is there a delay between the moment I
      change the channel and the time the channel actually changes?

Of course if you do have any coding skills, there's always the chance to 
have a look at the code to see if channel changing can be made any 
faster. You would certainly earn this FAQ writer's gratitude if you did :)

******************************************************************************************************

Ok, I have some coding skills, but no knowledge of mythtv, so I will 
just in a first time explain the idea I had.

The idea is to
- reduce latency when zapping
- provide a smooth timeshift for small "back in time" like under one minute
- and also reduce simultaneous disks reads & writes, thus reducing hard 
drive noise.

Actually mythv even when you are watching live TV get the stream from 
capture or dvb card, writes the stream to disk in a file, then the 
frontend asks for data from this file to the backend.
I believe that when watching live TV with a small lag from real time, 
the backend could feed the frontend with data coming from ram instead of 
reading on disk.

1 minutes of mpeg2 costs 100 mega bytes, so we could imagine a mem 
buffer of parametrable size according to your hardware.
DVB card get the data stream, and instead of writting it to file, data 
are wrote to the memory buffer.
When 3/4 of the memory buffer is full, we start to write to disk the 
first half of the mem buffer.
When second half is full we buffer data in the first half of the mem 
buffer, when we reach 1/4 of the buffer (half of the first half buffer), 
we then write to disk the second half of the buffer.
Writting could be done earlier the idea is to always have a confortable 
amount of stream into ram.

Now I guess it could be done without any modification to the frontend, 
but for the backend that's another story ...

I have not found yet where this is handled in the code.

bye.



More information about the mythtv-dev mailing list