[mythtv-users] mythfrontend is always hungry for ALSA Hardware audio buffer
josu.lazkano at gmail.com
Thu Nov 8 22:38:44 UTC 2012
2012/11/8 Mark Greenwood <fatgerman at gmail.com>:
> On Thursday 08 Nov 2012 23:26:12 Josu Lazkano wrote:
>> 2012/11/8 Jean-Yves Avenard <jyavenard at gmail.com>:
>> > On 9 November 2012 07:24, Andrey Zhunev <a-j at a-j.ru> wrote:
>> >> Hello All,
>> >> I just noticed that mythfrontend is asking to allocate a larger buffer for alsa:
>> >> So I increased the value of /proc/asound/card0/pcm0p/sub0/prealloc to
>> >> '1024' - even more than requested. Strangely, mythfrontend asked for more:
>> >> 2012-11-09 00:10:18.681551 I [3892/3892] CoreContext audio/audiooutputalsa.cpp:139 (TryOpenDevice) - ALSA: OpenDevice default
>> >> 2012-11-09 00:10:18.683052 I [3892/3892] CoreContext audio/audiooutputalsa.cpp:678 (SetParameters) - ALSA: SetParameters(format=10, channels=2, rate=48000, buffer_time=500000, period_time=4)
>> >> 2012-11-09 00:10:18.683407 I [3892/3892] CoreContext audio/audiooutputalsa.cpp:736 (SetParameters) - ALSA: Buffer size range from 2048 to 16384
>> >> 2012-11-09 00:10:18.683421 I [3892/3892] CoreContext audio/audiooutputalsa.cpp:739 (SetParameters) - ALSA: Period size range from 1024 to 1024
>> >> 2012-11-09 00:10:18.683483 E [3892/3892] CoreContext audio/audiooutputalsa.cpp:783 (SetParameters) - ALSA: Requested 500000us got 341333 buffer time
>> >> 2012-11-09 00:10:18.683615 I [3892/3892] CoreContext audio/audiooutputalsa.cpp:224 (IncPreallocBufferSize) - ALSA: Hardware audio buffer cur: 1024 need: 1536 max allowed: 32768
>> >> 2012-11-09 00:10:18.683648 E [3892/3892] CoreContext audio/audiooutputalsa.cpp:242 (IncPreallocBufferSize) - ALSA: Try to manually increase audio buffer with: echo 1536 | sudo tee /proc/asound/card0/pcm0p/sub0/prealloc
>> >> 2012-11-09 00:10:18.683666 I [3892/3892] CoreContext audio/audiooutputalsa.cpp:791 (SetParameters) - ALSA: Buffer time = 341333 us
>> >> 2012-11-09 00:10:18.683677 I [3892/3892] CoreContext audio/audiooutputalsa.cpp:797 (SetParameters) - ALSA: Period time = 16 periods
>> >> 2012-11-09 00:10:18.683823 I [3892/3892] CoreContext audio/audiooutputalsa.cpp:806 (SetParameters) - ALSA: Buffer size = 16384 | Period size = 1024
>> > The way it works is this:
>> > We ask ALSA to allocate an audio buffer of a certain length. It
>> > allocates some, and return how much it allocated.
>> > If there's more than 10% difference between what was asked and what we
>> > got, we display a message.
>> > The hardware buffer sized suggested is calculated according to how
>> > much the hardware buffer size currently is, and how much we got.
>> > So, say the HW buffer size is 128kB. We asked for 500ms buffer, and we
>> > got 341ms instead. So myth assumes that we only got 341ms because the
>> > HW buffer size was set to 128kB and that should it be higher, we would
>> > have gotten more.
>> > so we need: 500 * 128 / 341 = 187kB, we round it to the next 64kB
>> > block, it will display that you need to increase the HW buffer to
>> > 192kB...
>> > This works and is accurate for 99.9% of the ALSA setup in my experience.
>> > Now you're the 2nd person to report the problem above. No matter what
>> > you ask ALSA, regardless of the HW memory buffer size, you always get
>> > the same maximum value, is 341333us.
>> > That throws off myth and the message displayed is incorrect.
>> > I would just ignore that message, it is not displayed unless you
>> > increase the verbosity (it used to be displayed all the time)
>> > JY
>> > _______________________________________________
>> > mythtv-users mailing list
>> > mythtv-users at mythtv.org
>> > http://www.mythtv.org/mailman/listinfo/mythtv-users
>> Hello, I have same problem. I add this on the sudoer configuration file:
>> myuser ALL=(ALL) NOPASSWD:/usr/bin/tee /proc/asound/card0/pcm3p/sub0/prealloc
>> Now I can allocate the buffer size as mythfrontend user.
>> But it doesnt change nothing:
>> 1. I check the initial buffer size:
>> $ cat /proc/asound/card0/pcm3p/sub0/prealloc
>> 2. Change the buffer size:
>> $ echo 192 | sudo tee /proc/asound/card0/pcm3p/sub0/prealloc
>> 3. Check the buffer size:
>> $ cat /proc/asound/card0/pcm3p/sub0/prealloc
>> As you can see, it does not change the buffer size. I am doing something wrong?
> It doesn't seem to work if something is using the buffer at the time - try quitting the frontend and trying the command again.
>> Thanks and best regards.
>> Josu Lazkano
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
> mythtv-users mailing list
> mythtv-users at mythtv.org
Thanks for the reply. I have no any audio problem, but I want to
minimize the warnings.
Need I really stop the frontend to change the buffer size? I was
thinking that mythfrontend use to execute this command for me.
Thanks for your help.
More information about the mythtv-users