Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 255057 - media-video/mplayer-1.0_rc2_p28288 audio shutters with alsa dmix output
Summary: media-video/mplayer-1.0_rc2_p28288 audio shutters with alsa dmix output
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-15 16:21 UTC by Christian Birchinger (RETIRED)
Modified: 2009-03-08 17:04 UTC (History)
1 user (show)

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 Christian Birchinger (RETIRED) gentoo-dev 2009-01-15 16:21:50 UTC
mplayer SVN r28058 (1.0_rc2_p28058-r1) is the last known version which is
fine and shows none of the below described effects.


mplayer SVN r28288 (1.0_rc2_p28288) has shuttering audio when Alsa output
with dmix is used.

- So far it happens with all tested audio files (tested with .ogg and .mp3).

- .avi file with mp3 audio codec was fine. Even playing the video with
  "-vo null" to mimic the audio only behaviour is also fine.

- Only happens with dmix ("-ao alsa:device=dmixer"). A direct access with
  "-ao alsa:device=intel-hda" is ok.

- "-ao sdl" or "-ao sdl:alsa" works good. Stuff like "-ao oss" is fine too.


Audio Hardware: Card: HDA Intel, Chip: Analog Devices AD1984
ALSA (libs/utils): 1.0.17


.asoundrc:
------------------------------------
# Default Output
pcm.!default
{
    type plug
    slave.pcm "dmixer"
}

ctl.!default
{
    type hw
    card 0
}

# Intel HDA
pcm.intel-hda {
    type softvol
    slave.pcm "hw:0,0"
    control.name "Master"
    control.card 0
}

ctl.intel-hda {
    type hw
    card 0
}


# OSS Emu
pcm.dsp0
{
    type plug
    slave.pcm "dmixer"
}

ctl.mixer0
{
    type hw
    card 0
}


# A bit more control over the mixer
pcm.dmixer
{
    type dmix
    ipc_key 6789  # Any unique number
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        #periods 128
        rate 48000
     }
    bindings {
        0 0
        1 1
    }
}

ctl.dmixer
{
    type hw
    card 0
}
------------------------------------

emerge --info:
----------------------------------------------------------------------------
Portage 2.1.6.4 (default/linux/amd64/2008.0/desktop, gcc-4.1.2,
glibc-2.6.1-r0, 2.6.26-gentoo-r1 x86_64)
=================================================================
System uname:
Linux-2.6.26-gentoo-r1-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T7100_@_1.80GHz-with-glibc2.2.5
Timestamp of tree: Mon, 12 Jan 2009 17:15:03 +0000
distcc 3.0 x86_64-pc-linux-gnu [enabled]
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7-r1, 2.1.6-r1
dev-lang/python:     2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2,
1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=nocona -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/audacious/images"
CONFIG_PROTECT_MASK="/etc/bash_completion.d /etc/ca-certificates.conf
/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf
/etc/revdep-rebuild /etc/sound /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=nocona -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distcc distlocks fixpackages notitles parallel-fetch protect-owned
sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/
http://www.ibiblio.org/pub/Linux/distributions/gentoo/"
LANG="C"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j11"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times
--compress --force --whole-file --delete --stats --timeout=180
--exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="X aac aalib acl acpi alsa amd64 audacious audiofile avi bash-completion
berkdb bluetooth bonobo branding browserplugin bzip2 cairo caps cdparanoia
cdr cli cracklib crypt cups curl dbus dga dlloader dri dvd dvdr dvdread
emboss encode esd evo faad fam fbcon ffmpeg fftw firefox flac gd gdbm gif
glitz glut gnutls gtk gtk2 gtkhtml iconv imap imlib ipv6 isdnlog java
joystick jpeg libnotify libsamplerate mad mbox midi mikmod mmx mmxext
modplug mp3 mpeg mudflap multilib musepack ncurses network nls nptl nptlonly
nsplugin ntpl nvidia offensive ogg opengl openmp oss pam pcre pdf perl png
pnp ppds pppd pulseaudio pwdb python qt3support quicktime readline
reflection samba sdl session sid sndfile sox spell spl sse sse2 ssl
startup-notification svg sysfs theora threads tiff truetype udev unicode usb
userlocales vorbis wma xcb xcomposite xml xorg xosd xscreensaver xulrunner
xv xvid xvmc zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym
copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat
linear meter mmap_emul mulaw multi null plug rate route share shm softvol"
APACHE2_MODULES="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 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" ELIBC="glibc"
INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad
cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
USERLAND="GNU" VIDEO_CARDS="nvidia nv"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK,
LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
----------------------------------------------------------------------------

----------------------------------------------------------------------------
mplayer use build:
Installed versions:  1.0_rc2_p28058-r1(02:44:23 01/13/09)(X a52 aac aalib
alsa ass cdparanoia dga dvd encode esd fbcon gif gtk iconv ipv6 jpeg
kernel_linux live mad mmx mmxext mp3 musepack opengl oss png pulseaudio
quicktime rtc samba sdl sse sse2 theora truetype unicode vorbis xscreensaver
xv xvid xvmc -3dnow -3dnowext -altivec -amrnb -amrwb -arts -bidi -bindist
-bl -cddb -cdio -cpudetection -custom-cflags -custom-cpuopts -debug -dirac
-directfb -doc -dts -dv -dvb -dvdnav -dxr3 -enca -ftp -ggi -jack -joystick
-ladspa -libcaca -lirc -lzo -md5sum -mng -mp2 -nas -nemesi -openal -pnm -pvr
-radio -rar -real -schroedinger -speex -ssse3 -svga -teletext -tga -v4l
-v4l2 -video_cards_mga -video_cards_s3virge -video_cards_tdfx
-video_cards_vesa -vidix -win32codecs -x264 -xanim -xinerama -zoran)
----------------------------------------------------------------------------


Reproducible: Always
Comment 1 Christian Birchinger (RETIRED) gentoo-dev 2009-01-15 16:29:09 UTC
Hard to describe what "shuttering" means here.

It's like a 20ms mute pause every 200ms. A bit like a buffer underrun.
Comment 2 Christian Birchinger (RETIRED) gentoo-dev 2009-01-15 18:41:54 UTC
ok, i narrowed it down:

28219 is the last good version.
28220 triggers the bug



svn diff -r28219:28220

Index: mplayer.c
===================================================================
--- mplayer.c   (revision 28219)
+++ mplayer.c   (revision 28220)
@@ -2015,6 +2015,7 @@
     current_module="play_audio";
 
     while (1) {
+       int sleep_time;
        // all the current uses of ao_data.pts seem to be in aos that handle
        // sync completely wrong; there should be no need to use ao_data.pts
        // in get_space()
@@ -2026,7 +2027,9 @@
        // handle audio-only case:
        // this is where mplayer sleeps during audio-only playback
        // to avoid 100% CPU use
-       usec_sleep(10000); // Wait a tick before retry
+       sleep_time = (ao_data.outburst - bytes_to_write) * 1000 /
  ao_data.samplerate;
+       if (sleep_time < 10) sleep_time = 10; // limit to 100 wakeups per
second
+       usec_sleep(sleep_time * 1000);
     }
 
     while (bytes_to_write) {
Comment 3 Christian Birchinger (RETIRED) gentoo-dev 2009-01-15 19:46:00 UTC
Upstream bugreport sent as:
Subject: [MPlayer-advusers] Audio shuttering with Alsa and dmix since r28220

Suggestion to use "ao_data.bps" instead of "ao_data.samplerate" fixes the
problem here:

sleep_time = (ao_data.outburst - bytes_to_write) * 1000 / ao_data.bps;
Comment 4 Christian Birchinger (RETIRED) gentoo-dev 2009-03-08 17:04:30 UTC
Fix got committed upstream now. Newer media-video/mplayer versions work again.