[mythtv] Digital sound out debugging

Lawrence Freil lef at freil.com
Wed Jan 31 13:24:12 UTC 2007


I have to done some digital output debugging recently so maybe I can help.
My problem turned out to be a new "feature" in the Radeon video driver that
was cause Myth/X to use so much CPU it couldn't quite keep up with HDTV.
This will teach me to not update a bunch of drivers at the same time!.
In the process I did figure out how at least the low level driver works.

The audio output drivers are in libs/libmyth and the file you are mostly
interested in is audiooutputalsa.cpp and the header associated with it.
You can start seeing what the audio is doing by running mythfrontend with
"-v audio".  This adds displays of several of the interesting parameters
with regard to setup.  I added some additional verbose output in the
attached diff file.  The code used is very similar to aplay when used
with memory mapped mode with a few exceptions.  The myth driver regularly
polls the device to see how much space the card has available and only calls
the write routine (WriteAudio) when it will not block.  The things most
likely to cause problems with digital audio are rate (a lot of cards require
48K samples, I have a rate plugin to fix my mythmusic) and underruns.
One possible way to debug the sample rate/bits and other data issues is to
open a file in the alsa driver and write all the audio samples to the file
at the same time writing to the alsa driver.   You can then try the raw
samples with aplay and determine if it is a format issue.  Also as one test
I modified the driver to not use mmap sound.  This didn't fix my problem
but also didn't introduce any new ones.  You could try this and see if it
relates to a memory mapping issue in alsa.  Also try aplay with the mmap

Hope this helps.

On Jan 31 2007, Peter wrote:

>OK, I'd like a few pointers if possible to debug a sound issue with the 
>Turtle Beach Riviera card. It used to work great, but a recent clean 
>wipe and install of FC6 seems to have squashed that. There are several 
>others on the user list experiencing this issue as well. I'd be 
>perfectly happy debugging the sound problems, but am not sure where to 
>start. If someone with some know how can point me in the right 
>direction, I'll dig in over the next few weekends and see if I can 
>figure out where it's broke.
>A quick intro to the problem. Analog works fine, but digital is bad. In 
>TV/recording playback, no sound comes out (occasional blips, but nothing 
>that lasts). No errors written other than a couple of audio buffer 
>prints. Mythmusic plays back files, but it's jittery and the volume is 
>somewhat erratic (again, no errors printed). Mplayer doesn't work 
>either. aplay works great though (limited as it is). Not sure what all 
>this means as I'm a little fuzzy on how sound in Linux works, but I'm 
>wondering if something in Alsa changed that hasn't been picked up by 
>mplayer or Myth? Or is the Alsa stuff broken? Thanks for any help.
>mythtv-dev mailing list
>mythtv-dev at mythtv.org

Lawrence Freil
lef at freil.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alsa.diff
Type: text/x-patch
Size: 4954 bytes
Desc: alsa.diff
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20070131/e7e8736c/attachment.bin 

More information about the mythtv-dev mailing list