[ltp] media playback timing with power status change
Theodore Ts'o
linux-thinkpad@linux-thinkpad.org
Fri, 16 May 2003 13:27:29 -0400
On Thu, May 15, 2003 at 03:52:43PM -0400, Aaron Krowne wrote:
>
> I've owned a (second hand, refurbished) T20 for about a year now. One
> of the things I noticed early on was that sometimes the timing for media
> playback (chiefly music in xmms, but also videos in mplayer) gets
> completely out of whack. It seems like it is slowed down incredibly, but
> erratic and staticy. In short, unwatchable/listenable.
>
> This only seems to happen when the power status (battery or wall) is
> changed between suspends or reboots. There is no problem if I unsuspend
> on battery and play an mp3, or if I unsuspend on wall and do the same.
> But if I unplug the wall power and play an mp3, or plug it in from a
> battery unsuspend, the problem occurs. And going back to the original
> unsuspend/boot-up power state without actually unsuspending or rebooting
> does not fix the problem.
Solution: compile the your sound driver as a module, and unload and
reload it.
If you're using debian, just put the following file in
/etc/apm/event.d/sound:
#!/bin/sh
# This script will shutdown the sound system on suspend and resumes it
# on resume, since the cs4281 doesn't survive a suspend.
#
case "$1" in
resume*|change*)
esdctl off
# rmmod cs4281 ; insmod cs4281
rmmod cs46xx ; insmod cs46xx
/etc/init.d/aumix start
esdctl on
esac
Or just execute the commands yourself after your machine comes out of
suspend. Replace "cs46xx" with the appropriate driver. (For the X20
laptop, the sound driver was cs4281; for my T21, it's cs46xx. Your
mileage may vary.)
- Ted