[mythtv] LiveTV creates empty file

Jean-Yves Avenard jyavenard at gmail.com
Sat Jul 5 15:11:08 UTC 2014


On 5 July 2014 20:52, Angela <angela.schmid at wolke7.net> wrote:

> Are you saying that it only reads a couple of seconds (somewhere around
> 1/1.5 seconds within the playback) from the buffer and afterward uses the
> file?
in live TV

it starts reading from the file and everything is placed in a buffer.
AVFormatDecoder then attempts to detect the format of the file and
will retry for up to 3s, working only in memory.

from that point on it continues reading from the disk.

there should be 0 detectable transition occurring here as it's just a
restriction occurring so when you attempt to seek it stays within the
ringbuffer.

this was changed in 0.27.1 as otherwise, when FFmpeg attempts to
determine the format of a file, it does a lot of seeking in the file.
When a seek occurs, the content of the ringbuffer was to be flushed,
so you had to re-read the whole file again, and by default the
ringbuffer will lock a read until there's enough data available to
have .3s of video (to prevent hickup)

this used to seriously slow down liveTV startup and program transition.

In 0.27.1 and later, when liveTV starts, the data read is kept in the
ringbuffer, a seek works within that ringbuffer and no data is ever
loss.

once FFmpeg has finished scanning the content, that ringbuffer mode (I
call it ReadInternalMode) is switched off and it continues to read
from the file, the access now being linear.

That trick has reduced program transition and liveTV startup from 10+s
to less than 3.

Now 0.27.2 and later can start even quicker as the RingBuffer::Read
prior to 0.27.2 would block until the requested amount of data was
entirely available.
>From 0.27.2 you can have partial reads, the ringbuffer will return
whatever amount of data it has, so long that it's not 0.

That has speed up program transition a bit more. and also, allowed to
play some files that would otherwise fail to open (FFmpeg following
the seek to the end would request 256kB of data when only 200kB were
available, and it will lock forever)

hope that answers your question.

if you feel on improving things further, please feel free.

I find the performance more than acceptable now personally, so I have
not much interest in getting it even better, that doesn't mean I don't
want further improvements to be done


More information about the mythtv-dev mailing list