Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#10862 closed Bug Report - General (Won't Fix)

ALSA buffer size (prealloc) increases by 190 each time a recording is watched in mythfrontend.

Reported by: Michael Williams <mikeww2k@…> Owned by: JYA
Priority: minor Milestone: unknown
Component: MythTV - Audio Output Version: 0.25-fixes
Severity: medium Keywords: ALSA, prealloc
Cc: Ticket locked: no

Description

The buffer (/proc/asound/card0/pcm0p/sub0/prealloc) is being increased by 190 every time a recorded show is watched. This should only increase when it is needed.

Output of "grep ALSA *" in /var/logs/mythtv/

mythfrontend.20120625155836.20931.log:2012-06-25 16:08:34.665187 E [20931/20931] CoreContext? audio/audiooutputalsa.cpp:195 (SetPreallocBufferSize?) - ALSA: Setting hardware audio buffer size to 320 mythfrontend.20120625155836.20931.log:2012-06-25 16:10:03.684508 E [20931/20931] CoreContext? audio/audiooutputalsa.cpp:195 (SetPreallocBufferSize?) - ALSA: Setting hardware audio buffer size to 512 mythfrontend.20120625155836.20931.log:2012-06-25 16:11:15.328751 E [20931/20931] CoreContext? audio/audiooutputalsa.cpp:195 (SetPreallocBufferSize?) - ALSA: Setting hardware audio buffer size to 768 mythfrontend.20120625155836.20931.log:2012-06-25 16:11:35.897720 E [20931/20931] CoreContext? audio/audiooutputalsa.cpp:195 (SetPreallocBufferSize?) - ALSA: Setting hardware audio buffer size to 1152 mythfrontend.20120625155836.20931.log:2012-06-25 16:11:46.456781 E [20931/20931] CoreContext? audio/audiooutputalsa.cpp:195 (SetPreallocBufferSize?) - ALSA: Setting hardware audio buffer size to 1728


I change permissions of /proc/asound/card0/pcm0p/sub0/prealloc to 777 in /etc/rc.local to allow mythfrontend to adjust the buffer when it needs to.


./configure --enable-proc-opt --disable-libcec


mythfrontend version: fixes/0.25 [v0.25.1-43-g73bc45e]


mythfrontend log file is attached.

Attachments (1)

mythfrontend.20120625155836.20931.log (29.8 KB) - added by Michael Williams <mikeww2k@…> 7 years ago.
mythfrontend log file

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Michael Williams <mikeww2k@…>

mythfrontend log file

comment:1 Changed 7 years ago by JYA

Resolution: Won't Fix
Status: newclosed

The issue is with ALSA. We ask for a buffer size, it returns a value. From that returned value, if it's not enough, we make a guess work on what the buffer size should have been.

It ALSA keeps returning a different value each time, not much we can do

Set the prealloc value to 4MB, problem gone

comment:2 Changed 7 years ago by Michael Williams <mikeww2k@…>

Wow, you really did not even bother to read the ticket fully.

Mythtv keeps trying to increase the buffer size every time, no matter what the buffer is set to.

For example, mythtv may set it to a value it likes, then the next time you watch a show, it increases it again, whether it is needed or not. That is a bug and should be fixed.

ALSA does not return a different value each time as you stated above. You change the value and then keep changing it.

comment:3 Changed 7 years ago by JYA

The issue here is an ALSA one, it's something you need to file with ALSA.

The way the buffer calculation work is: we ask alsa for 500ms, it replies with a 400ms one.

We look at the size of the audio buffer, see that it is set to XXX, so we assume it needs XXX + 400/500 * XXX to make up for the difference.

The problem here is alsa always returning a smaller buffer than asked no matter the value of the audio buffer…

You can't see the value returned by ALSA because you don't have the proper verbosity level.

But as it seems you know better, I'll let you fix that one.

comment:4 Changed 7 years ago by Michael Williams <mikeww2k@…>

OK, thanks for explaining it better. I understand what is going on now. Sorry for my confusion.

comment:5 Changed 7 years ago by JYA

Note that I have now removed the code changing the prealloc size automatically.

So now there can't be confusion. If people want bigger buffer, they'll have to manually change it

Note: See TracTickets for help on using tickets.