[mythtv-users] ALSA:surround51 with MythTV 0.24

Jean-Yves Avenard jyavenard at gmail.com
Wed Mar 9 00:15:12 UTC 2011


Hi

On 9 March 2011 09:26, Achim Hofmann <news at achim-hofmann.com> wrote:
> The first problem is the sample rate. My sound card reports to support
> all usual sample rates between 8 kHz and 48 kHz. Actually this is a lie
> because the only sample rate it really supports is 48 kHz. Okay, this
> can be solved by forcing a resampling to 48 kHz in the advanced audio
> settings of MythTV. Doing so audio sounds fine.

That's why the 48k override option was added : for buggy cards or buggy drivers.

>
> Unfortunately this solution only works when using the ALSA default pcm
> device "ALSA:default:CARD=V8237". When switching to another ALSA pcm
> device like "surround51:CARD=V8237,DEV=0" the following happens:

> 2011-03-08 21:23:28.085 AO: enc(0), passthru(0), canAC3(0), canDTS(0),
> canLPCM(1), configured_channels(2), 2 channels supported(1)
> 2011-03-08 21:23:28.087 AO: Forcing resample to 48 kHz
> 2011-03-08 21:23:28.087 AO: Resampling from 44 kHz to 48 kHz with
> quality medium
> 2011-03-08 21:23:28.088 AO: Resampler allocating 35680
> 2011-03-08 21:23:28.088 AO: Audio processing enabled
> 2011-03-08 21:23:28.088 AO: Opening audio device
> 'surround51:CARD=V8237,DEV=0' ch 2(2) sr 48000 sf signed 16 bit reenc 0
> 2011-03-08 21:23:28.090 ALSA: SetParameters(format=2, channels=2,
> rate=48000, buffer_time=200000, period_time=50000)
> 2011-03-08 21:23:28.090 ALSA: Requested 200000us got 113770 buffer time
> 2011-03-08 21:23:28.090 ALSA, Error: Error opening
> /proc/asound/card0/pcm1p/sub0/prealloc. Fix reading permissions.
> 2011-03-08 21:23:28.090 ALSA, Error: Unable to sufficiently increase
> ALSA hardware buffer size - underruns are likely
> 2011-03-08 21:23:28.091 ALSA: SetParameters(format=2, channels=2,
> rate=48000, buffer_time=200000, period_time=50000)
> 2011-03-08 21:23:28.092 ALSA: Buffer time = 113770 us
> 2011-03-08 21:23:28.092 ALSA: Period time = 2645 us
> 2011-03-08 21:23:28.094 ALSA: Buffer size = 5461 | Period size = 127
> 2011-03-08 21:23:28.098 ALSA: found playback control Master on mixer
> device default
> 2011-03-08 21:23:28.098 ALSA: mixer volume range on mixer device
> default/Master - min 0, max 31, range 31
> 2011-03-08 21:23:28.098 ALSA: mixer device default/Master set up
> successfully
[snip]
> 2011-03-08 21:23:28.101 AudioPlayer: Enabling Audio
> 2011-03-08 21:23:28.101 AO: Reconfigure(): No change -> exiting
> 2011-03-08 21:23:28.101 Dec: Selected track #1 in the Unknown language(0)
> 2011-03-08 21:23:28.101 Dec: Resyncing position map. posmapStarted = 0
> livetv(0) watchingRec(0)
> 2011-03-08 21:23:28.105 Dec: SyncPositionMap prerecorded, from DB: 0 entries
>
> After MythTV tries to access the non-existing file
> /proc/asound/card0/pcm1p/sub0/prealloc it completly forgot that a
> resampling to 48 kHz was requested: AO: Reconfigure(): No change ->
> exiting. Without resampling audio sounds crappy, of course.

And what make you think that because it displays that message it won't resample?

All that message states is that increasing the amount of audio buffer
allocated to ALSA failed..
MythTV requires a minimum of 200ms of buffer, which is bare minimum
I've found to work with most card. When we allocate 200ms of audio
buffer, we got 110ms. A solution to the failure in getting enough
audio buffer, is that the memory allocated to the ALSA driver isn't
enough: the size of the buffer is normally controlled with
/proc/asound/cardX/pcmYp/subZ/prealloc.
For some reason that file doesn't exist.

>From there however, it continues as if nothing happened.
The resampling isn't done by ALSA.


The message "Reconfigure(): No change" only indicates that there has
been no changes in the configuration of the audio framework the 2nd
time it was called.

You conclusion or understanding of what it does is plain wrong.

>
> So from this point I see two possible solutions:
>
> 1. Stop MythTV trying to handle with the non-existing file and hope that
> this way the resampling is done as requested.

resampling is done as requested, irrelevant to what ALSA did.
>From the log, you can see that the internal resampler is created, and
that the audio device is opened in 48kHz mode.

Unfortunately, you didn't include any of the logs of the actual
playback which could have shown what was happening.
But as you only got 113ms of buffer, I'm guessing it's full of buffer
underruns, unless you have a damn fast machine..

>
> 2. Using /etc/asound.conf to force a sample rate of 48k. Unfortunately
> I'm not familiar enough with alsa to write such a configuration.
There's no need for that as resampling is done by myth before feeding
the data to alsa

If you upgrade to yesterday's version of fixes/0.24 ; I have changed
the default for how much buffer is allocated to the audio card.
It has been bumped to 500ms (from 200ms), this fixes somes issues
people with old Creative Live audio cards had been seeing.
It may work better for you. However, seeing that when requesting 200ms
we only got 113ms : I don't think it will make any difference to you.

JY


More information about the mythtv-users mailing list