[mythtv-users] Playback causes recording stream corruption

Tony Lill ajlill at ajlc.waterloo.on.ca
Fri Mar 31 01:32:34 UTC 2006


Brian Wood <beww at beww.org> writes:

> On Mar 29, 2006, at 5:28 PM, Ben Rigby wrote:
>
>> On 3/30/06, Tony Lill <ajlill at ajlc.waterloo.on.ca> wrote:
>>> It could be that your backend just can't keep up with the video
>>> stream. I get the following messages a lot more since going to 0.19:
>>>
>>> Mar 29 05:01:16 freevo kernel: ivtv0: All encoder MPEG stream  
>>> buffers are full. Dropping data.
>>> Mar 29 05:01:16 freevo kernel: ivtv0: Cause: the application is  
>>> not reading fast enough.
>>>
>>> The real cause seems to be that while recording, the same thread
>>> that's reading from the device is also inserting rows in the
>>> recoredemarkup table. Lately, after a lot of monkeying to make other
>>> things not run during recording, I've found that I get these errors
>>> whenever a recording starts. Coincidently, for the first 30  
>>> seconds of
>>> a recording, the inserts are done every 5 seconds and after, every  
>>> 30.
>>>
>>
>> Hi Tony,
>>
>> I haven't seen either of those messages on my system. And my problems
>> are consistent across the length of a recording, I haven't noticed
>> them as more prevalent during the first 30 seconds. But please send
>> you patch my way, I'll have a look at anything.

Well, those are specific to the hauppage card, but your messages
looked like the reader was getting out of sync with the data, which
could mean that it's dropping data, so I'm guessing it's the same root
cause.

I've got the patch running now, if it makes a difference, I'll post it
to trac.

>> It does appear that the backend doesn't seem able to keep up with the
>> recording, but I'm at a loss as to why. Even recording and playing
>> back at once I only get to about 20% CPU usage. The hard drive is a
>> fairly new drive, and whilst I'm not sure how to check, I'd be
>> suprised if it couldn't keep up with one recording stream being
>> written, and one playback stream being read. This is digital SDTV on a
>> fairly powerful system, it shouldn't be pushing any of the boundaries
>> of performance. Are there buffers involved in writing recordings to
>> disk and reading for playback? Can I increase them?

There's some config in one of the menus for HD ring buffer size, or
something like that, I'm not sure if that does what you
want. Otherwise look in libs/libmythtv/tv_rec.cpp, and look for calls
to ringBuffer->SetWriteBufferSize(). It's not called for all the
recorders, some just use the default (near the top pf
ThreadedFileWriter.cpp).

As long as dma is working, the disk should be able to keep up with the
data. When I do a cp, I can get over 30MB/s, and my video stream is only
about 700k. 

The problem is when it updates the recordedmarkup table, it
seems to do 30 rows at one go, every 15 seconds. Each insert requires
sending a message to mysql, mysql waking up, doing it's thing,
probably writing to disk, sending a reply back. 30 times, every 15
seconds. When you think aboout it, it's a wonder this ever worked.

>> As I haven't seen anyone else report this problem, and there must be
>> heaps of people recording digital SD streams so the problem must be to
>> do with my hardware or configuration. I'm hoping one of the more
>> knowledgable myth users might be able to point me in the right
>> direction with some further troubleshooting, or some possible cures.

Annoying isn't it. Almost as bad as taking your car into a mechanic
when it starts making a funny noise. 

> Sorry to ask such an obvious question, but are you sure that DMA is  
> enabled for your drive ???
>
> If so, maybe try "hdparm -tT /dev/hd(n)" to make sure the transfer  
> rate is what it should be.
--
Tony Lill,                         Tony.Lill at AJLC.Waterloo.ON.CA
President, A. J. Lill Consultants        fax/data (519) 650 3571
539 Grand Valley Dr., Cambridge, Ont. N3H 2S2     (519) 241 2461
--------------- http://www.ajlc.waterloo.on.ca/ ----------------
"Welcome to All Things UNIX, where if it's not UNIX, it's CRAP!"


More information about the mythtv-users mailing list