[mythtv] Solving my performance problems...

Steve Brown sbrown at cortland.com
Thu Dec 18 08:53:35 EST 2003


Isaac Richards wrote:

>On Sunday 14 December 2003 01:33 pm, Steve Brown wrote:
>  
>
>>I hypothesized that part of the problem was the latency of the usleep
>>spinlocks in NuppelVideoPlayer. As an experiment, I instrumented all the
>>waits and found that only 2 of them were frequently used, specifically,
>>the ones at ::GetFrame:614 (appx) and ::OutputVideoLoop:1284 (appx). I
>>replaced them with QWaitConditions. Also, ::setPrebuffering  is called
>>by 2 threads, but doesn't protect the "prebuffering" variable. I didn't
>>find any evidence of a race in my testing, but added a lock anyway.
>>Hdtv now plays without stuttering whether ota or from disk. The channel
>>changing problems remain.
>>
>>If you are interested in playing with the patch, let me know off-list. I
>>don't want to clutter the list with a half-baked, experimental patch.
>>    
>>
>
>Have you done anything more with this?
>
>Isaac
>_______________________________________________
>  
>
It seems my earlier enthusiasm for the patch was premature. It helps 
with some streams, but not others. Up-converted standard tv now plays 
without stuttering, but real hdtv still has the problem, though less 
frequently.

After more investigation, the stuttering is caused by the sound card 
starving. I salted some snd_pcm_delay calls in AddSamples. As the htdv 
sample plays, the number of queued sound samples slowly decrease until 
the underrun occurs. The up-converted sample seems to maintain about 10k 
or so queued samples and does not underrun. Without the patch, it 
underruns as well. My 2.8GHz cpu is running about 65% when all this is 
going on. I have jitter and experimental av sync on and am using xvmc.

The patch seems to be a minor optimization, not a solution to a 
throughput problem. Perhaps it will help if combined with the i/o 
changes also being discussed on the thread.

I have upgraded to Alsa 1.0.0-rc2 as there were some fixes for my i8x0 
sound card and to Qt 3.3.0b1 because of a timer bug in QWaitCondition.

In the longer term, I'm curious how sound under/overrun can be avoided 
when playing mpeg off the air. I'd think that even a slight mispatch in 
audio rates would, in time, either exhaust or overfill the sound queue 
and result in a sound glitch.

Steve





More information about the mythtv-dev mailing list