Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 516964 - app-misc/bb video output freezes when using sound
Summary: app-misc/bb video output freezes when using sound
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Sergei Trofimovich (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-12 16:13 UTC by James L. Hammons
Modified: 2016-04-02 17:09 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James L. Hammons 2014-07-12 16:13:32 UTC
Running bb-aalib without sound works, however, if you choose the option to play it with sound, once the sound starts the output in the bb window freezes. It doesn't matter which driver you use (I tried linux, X11, and curses) it freezes just the same.

On another machine (also ~amd64), turning off option 2 (Proccess music via software mixer) seems to work, but outputs no sound (the video doesn't freeze).

I have tried under a few different WMs, including KDE, Windowmaker, and Awesome; I even tried it under the vanilla login shell (with X turned completely off). They all display the same behavior.

One other clue here is that if you launch it in linux or X11 mode (with the -display switch) and you close the window after the music starts, the window closes but the music still continues to play--you have to hit CTRL-C in the terminal window you launched it from to kill the music.

I should probably mention that libmikmod is compiled with alsa, sse2, and threads USE flags only. I will try removing the threads USE flag to see if that makes any difference.
Comment 1 James L. Hammons 2014-07-12 16:24:01 UTC
Just tried it by removing the threads and sse2 USE flags from libmikmod; app-misc/bb video still freezes when the sound starts.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2014-07-12 16:29:38 UTC
Please post your `emerge --info app-misc/bb' output in a comment.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2014-07-12 18:13:42 UTC
Do you use pulseaudio?

I have the same issue with pa. I suspect it's a
libmikmod's badness. USE=-pluseaudio (to use alsa emulation layer) might help.
Comment 4 James L. Hammons 2014-07-12 18:55:48 UTC
@Sergei: I don't have PulseAudio installed on any of my machines. Never saw the need. :-)

@Jeroen:


# emerge --info app-misc/bb
Portage 2.2.10 (default/linux/amd64/13.0/desktop, gcc-4.8.2, glibc-2.17, 3.3.1-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.3.1-gentoo-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_5200+-with-gentoo-2.2
KiB Mem:     4053856 total,   2040220 free
KiB Swap:    4000180 total,   4000180 free
Timestamp of tree: Fri, 04 Jul 2014 13:30:01 +0000
ld GNU ld (GNU Binutils) 2.24
app-shells/bash:          4.2_p47
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.6, 3.2.5-r2, 3.3.3
dev-util/cmake:           2.8.12.1-r3
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.12.6, 1.13.4, 1.14.1
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.6.4, 4.7.3, 4.8.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.12 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo x-portage
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe"
DISTDIR="/mnt/filestore/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://192.168.0.9/gentoo-portage"
USE="10bit 3dnow 3dnowext X a52 aac acl acpi alsa amd64 apng berkdb bittorrent bluetooth branding bzip2 cairo cdda cdr cli consolekit corefonts cracklib crypt cups cxx dbus dri dts dvd dvdr edit emboss encode exif fam ffmpeg firefox flac fluidsynth fortran gdbm gif gpm gtk hwdb iconv ipv6 jack java jpeg lash lcms ldap libnotify lv2 lzma mad melt midi mikmod minizip mmx mmxext mng modules mp3 mp4 mpeg multilib musepack music ncurses nls nptl ofx ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt4 readline scrypt sdl session sndfile speex spell sse sse2 ssl startup-notification svg tcpd tga theora tiff truetype udev udisks unicode upower usb virtuoso vorbis wav wavpack wxwidgets x264 xcb xchatdccserver xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ice1712" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev keyboard mouse joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nouveau vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

app-misc/bb-1.3.0_rc1-r3 was built with the following:
USE="mikmod" ABI_X86="64"

Oddly enough, it *does* work on one of my machines--though it's ~x86. :-P 64-bit issue perhaps?
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2014-07-13 06:55:19 UTC
(In reply to James L. Hammons from comment #4)
> @Sergei: I don't have PulseAudio installed on any of my machines. Never saw
> the need. :-)

Aha, great! May I ask you to test against '=media-libs/libmikmod-3.2.0'?
Comment 6 James L. Hammons 2014-07-13 14:33:17 UTC
Tested. Unfortunately libmikmod-3.2.0 displays the same behavior as later versions.
Comment 7 jospezial 2015-08-19 02:14:39 UTC
Disabling pulseaudio USE flag on libmikmod helps as workaround.

=================================================================
                        Package Settings
=================================================================

media-libs/libmikmod-3.3.7::gentoo was built with the following:
USE="alsa openal threads (-altivec) (-coreaudio) -debug -nas -oss -pulseaudio -static-libs" ABI_X86="64 -32 -x32" CPU_FLAGS_X86="(-sse2)"


media-libs/aalib-1.4_rc5-r6::gentoo was built with the following:
USE="X gpm slang -static-libs" ABI_X86="32 64 -x32"


app-misc/bb-1.3.0_rc1-r3::gentoo was built with the following:
USE="mikmod" ABI_X86="64"
Comment 8 James L. Hammons 2015-08-19 03:20:53 UTC
I don't have PulseAudio enabled on any of my systems, and I already tried libmikmod with *no* use flags enabled (including the latest v3.3.7). It. Does. Not. Work. Full. Stop.

I'll have to try setting up another 32-bit install to see if it's a 32 vs. 64 bit issue (as it worked on one of my 32-bit workstations); this should be good enough to prove it.
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2015-08-19 22:56:07 UTC
(In reply to James L. Hammons from comment #8)
> I don't have PulseAudio enabled on any of my systems, and I already tried
> libmikmod with *no* use flags enabled (including the latest v3.3.7). It.
> Does. Not. Work. Full. Stop.
> 
> I'll have to try setting up another 32-bit install to see if it's a 32 vs.
> 64 bit issue (as it worked on one of my 32-bit workstations); this should be
> good enough to prove it.

I've found at least one cause on hung bb sound stream. Trying to figure out
detail of limbikmod buffers to mitigate it.

Please try to build libmikmod and bb with CFLAGS=-ggdb and try to acquire backtrace from hung bb:

$ gdb --args bb-aalib
<wait for sound>
Ctrl-C
bt full
Comment 10 James L. Hammons 2015-08-20 03:02:56 UTC
> Please try to build libmikmod and bb with CFLAGS=-ggdb and try to acquire
> backtrace from hung bb:
> 
> $ gdb --args bb-aalib
> <wait for sound>
> Ctrl-C
> bt full

Well, I rebuilt libmikmod and bb with CFLAGS=-ggdb (CFLAGS=-ggdb emerge -v1q libmikmod, did the same for bb), and it seems it didn't do much. I'm probably missing something obvious here. Here's the backtrace (I pressed CTRL-C after the music started):

Reading symbols from bb-aalib...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/bb-aalib 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
^C
Program received signal SIGINT, Interrupt.
0x00007ffff6f68fb7 in ioctl () from /lib64/libc.so.6
(gdb) bt full
#0  0x00007ffff6f68fb7 in ioctl () from /lib64/libc.so.6
No symbol table info available.
#1  0x00007ffff647de56 in ?? () from /usr/lib64/libasound.so.2
No symbol table info available.
#2  0x00007ffff64a1f59 in ?? () from /usr/lib64/libasound.so.2
No symbol table info available.
#3  0x00007ffff647734d in ?? () from /usr/lib64/libasound.so.2
No symbol table info available.
#4  0x00007ffff64825fb in ?? () from /usr/lib64/libasound.so.2
No symbol table info available.
#5  0x00007ffff745165d in ?? () from /usr/lib/libmikmod.so.3
No symbol table info available.
#6  0x00007ffff74722fc in MikMod_Update () from /usr/lib/libmikmod.so.3
No symbol table info available.
#7  0x00000000004073b0 in ?? ()
No symbol table info available.
#8  0x00000000004130f0 in ?? ()
No symbol table info available.
#9  0x0000000000402a7e in ?? ()
No symbol table info available.
#10 0x0000000000402bfb in ?? ()
No symbol table info available.
#11 0x0000000000409ca7 in ?? ()
No symbol table info available.
#12 0x000000000040300a in ?? ()
No symbol table info available.
#13 0x000000000040796e in ?? ()
No symbol table info available.
#14 0x00007ffff6eaaa65 in __libc_start_main () from /lib64/libc.so.6
No symbol table info available.
#15 0x00000000004018a9 in ?? ()
No symbol table info available.
(gdb)
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2015-08-20 08:10:10 UTC
(In reply to James L. Hammons from comment #10)
> > Please try to build libmikmod and bb with CFLAGS=-ggdb and try to acquire
> > backtrace from hung bb:
> > 
> > $ gdb --args bb-aalib
> > <wait for sound>
> > Ctrl-C
> > bt full
> 
> Well, I rebuilt libmikmod and bb with CFLAGS=-ggdb (CFLAGS=-ggdb emerge -v1q
> libmikmod, did the same for bb), and it seems it didn't do much. I'm
> probably missing something obvious here. Here's the backtrace (I pressed
> CTRL-C after the music started):
> 
> Reading symbols from bb-aalib...(no debugging symbols found)...done.
> (gdb) run
> Starting program: /usr/bin/bb-aalib 
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> ^C
> Program received signal SIGINT, Interrupt.
> 0x00007ffff6f68fb7 in ioctl () from /lib64/libc.so.6
> (gdb) bt full
> #0  0x00007ffff6f68fb7 in ioctl () from /lib64/libc.so.6
> No symbol table info available.
> #1  0x00007ffff647de56 in ?? () from /usr/lib64/libasound.so.2
> No symbol table info available.
> #2  0x00007ffff64a1f59 in ?? () from /usr/lib64/libasound.so.2
> No symbol table info available.
> #3  0x00007ffff647734d in ?? () from /usr/lib64/libasound.so.2
> No symbol table info available.
> #4  0x00007ffff64825fb in ?? () from /usr/lib64/libasound.so.2
> No symbol table info available.
> #5  0x00007ffff745165d in ?? () from /usr/lib/libmikmod.so.3
> No symbol table info available.
> #6  0x00007ffff74722fc in MikMod_Update () from /usr/lib/libmikmod.so.3
> No symbol table info available.
> #7  0x00000000004073b0 in ?? ()
> No symbol table info available.
> #8  0x00000000004130f0 in ?? ()
> No symbol table info available.
> #9  0x0000000000402a7e in ?? ()
> No symbol table info available.
> #10 0x0000000000402bfb in ?? ()
> No symbol table info available.
> #11 0x0000000000409ca7 in ?? ()
> No symbol table info available.
> #12 0x000000000040300a in ?? ()
> No symbol table info available.
> #13 0x000000000040796e in ?? ()
> No symbol table info available.
> #14 0x00007ffff6eaaa65 in __libc_start_main () from /lib64/libc.so.6
> No symbol table info available.
> #15 0x00000000004018a9 in ?? ()
> No symbol table info available.
> (gdb)

I think I forgot FEATURES=nostrip or FEATURES=splitdebug
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces

But the output looks good enough. It also shows
MikMod_Update to stuck in blocking update and
does not return to main thread.

I'll try to craft a workaround for it today.
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2015-08-22 09:01:33 UTC
Here goes pulseaudio workaround:
    https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ebcf571537f84030611472713e5d08f0524f6ba

Old libmikmod (3.2.0 and older) did not implement pulseaudio driver and used alsa
as a first fallback (at least for me). Alsa driver allows you to call 'MikMod_Update()' as frequently as you like and does not block on sound output.
bb does it every 10 milliseconds.

libmikmod 3.3 introduced native pulseaudio driver implemented over simple API (simple.h). This driver blocks every time you fill up pulseaudio buffer (250ms by default) and unblocks when 1/4 of buffer is played.

That behaviour starves 10ms bb timer: It adds ~65 ms lags and kicks more calls of 'MikMod_Update()' even before redrawing the scene (thus the effect of frozen video).

As a workaround I've disable pulseaudio driver on libmikmod. Should be fixed properly in libmikmod upstream by using asynchronous pulse API.

I still don't understand why James gets that block on ALSA driver.
Comment 13 James L. Hammons 2015-08-22 13:31:05 UTC
OK, I noticed on my 32-bit install that libmikmod had the 'openal' USE flag enabled, so I enabled it on my 64-bit install and now BB works with sound. Don't know why it doesn't work with just 'alsa' and 'threads', but there you go.

Could it be that the mikmod lib configuration chooses an insane default if you don't (i.e., it doesn't really support plain ALSA)?
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2016-04-02 17:09:51 UTC
(In reply to James L. Hammons from comment #13)
> OK, I noticed on my 32-bit install that libmikmod had the 'openal' USE flag
> enabled, so I enabled it on my 64-bit install and now BB works with sound.
> Don't know why it doesn't work with just 'alsa' and 'threads', but there you
> go.
> 
> Could it be that the mikmod lib configuration chooses an insane default if
> you don't (i.e., it doesn't really support plain ALSA)?

Sounds very convincing. For some reason I always ran libmikmod with USE=openal.

Pushed openal requirement as: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3eef583c57b2c3e5978203d6d8b7c03fef730d42

Thank you!