笔者酷爱在Debian5.02下用mplayer看电影,平时都好好的,突然有一天,命令行下出现如下提示:
MPlayer interrupted by signal 11 in module: filter_video - MPlayer crashed by bad usage of CPU/FPU/RAM. Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash. - MPlayer crashed. This shouldn't happen. It can be a bug in the MPlayer code _or_ in your drivers _or_ in your gcc version. If you think it's MPlayer's fault, please read DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and won't help unless you provide this information when reporting a possible bug. [ This binary of MPlayer in Debian is currently compiled with '--enable-debug'; the debugging symbols are in the package 'mplayer-dbg'.] |
Oh My God!(当时是说粗口,这里用这句代替一下,毕竟要和谐)
0) 第一阶段探索,使用Debian提供的二进制包机制
$ sudo apt-get install mplayer-dbg $ pwd /home/c-aries/source/debian $ apt-get source mplayer $ cd mplayer-1.0~rc2/ $ gdb mplayer ... #使用gdb调试 (gdb) run -vo fbdev ~/video/拥抱春天.flv ... #因为我没开X,所以调试是在终端下的jfbterm工作,视频必需显示在framebuffer上,所以为 -vo fbdev Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb5c136d0 (LWP 18529)] read_font_desc_ft (fname=0x8ae0800 "/usr/share/fonts/truetype/unifont/unifont.ttf", movie_width=320, movie_height=33124) at font_load_ft.c:797 797 font_load_ft.c: No such file or directory. in font_load_ft.c (gdb) list 792 in font_load_ft.c (gdb) |
此时提示在read_font_desc_ft()里出现Segmentation fault
说明mplayer出错和font(字体)有关
1) 第二阶段探索,使用Debian提供的源码包机制
$ sudo apt-get remove mplayer $ pwd /home/c-aries/source/debian/mplayer-1.0~rc2 $ sudo apt-get build-dep mplayer $ ./configure --prefix=/usr --enable-debug --codecsdir=/usr/lib/codecs/ --enable-fbdev --disable-dvdnav --disable-dvdread --disable-dvdread-internal --enable-mencoder && make ... #我的GNU小本没有光驱,所以--disable-dvd*,其间报错,mencoder无法正常生成 $ gdb ./mplayer ... #学 0) 中的调试方法,发现视频可正常播放,我还想用gdb调试一下mplayer看哪里出错了啊 : ( |
2) 第三阶段探索,使用自己下载的包
由于 1) 中的mencoder编译失败,不爽,所以亲手下载官网的包,重新编译
$ pwd /home/c-aries/source/mplayer $ cat url http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-7.tar.bz2 http://www.mplayerhq.hu/MPlayer/skins/Blue-1.7.tar.bz2 http://www.mplayerhq.hu/MPlayer/patches/asmrules_fix_20061231.diff http://www.mplayerhq.hu/MPlayer/patches/cddb_fix_20070605.diff http://www.linuxfromscratch.org/patches/blfs/6.3/MPlayer-1.0rc1-ext_ffmpeg-1.patch $ wget -c -i url ... #根据url中的文件列表下载文件,省略 $ pwd /home/c-aries/source/mplayer/MPlayer-1.0rc2 $ ./configure --prefix=/usr --enable-debug --codecsdir=/usr/lib/codecs/ --enable-fbdev --disable-dvdnav --disable-dvdread --disable-dvdread-internal --enable-mencoder && make |
结果mplayer和mencoder编译成功,视频播放正常
3) 第四阶段探索,为什么Debian官方包的mplayer不能正常使用?
无意中发现自己以前的笔记中,configure配置时有个 --confdir 参数
$ pwd /home/c-aries/source/mplayer/MPlayer-1.0rc2 $ ./configure --prefix=/usr --enable-debug --codecsdir=/usr/lib/codecs/ --enable-fbdev --disable-dvdnav --disable-dvdread --disable-dvdread-internal --enable-mencoder --confdir=/etc/mplayer && make $ gdb ./mplayer (gdb) run -vo fbdev ~/video/拥抱春天.flv ... #省略 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb6a808f0 (LWP 31599)] read_font_desc_ft ( fname=0xa454100 "/usr/share/fonts/truetype/unifont/unifont.ttf", movie_width=320, movie_height=33124) at font_load_ft.c:797 797 charset[i] = charcode; (gdb) list 792 #ifdef HAVE_FREETYPE21 793 i = 0; 794 charcode = FT_Get_First_Char( face, &gindex ); 795 while (gindex != 0) { 796 if (charcode < 65536 && charcode >= 33) { // sanity check 797 charset[i] = charcode; 798 charcodes[i] = 0; 799 i++; 800 } 801 charcode = FT_Get_Next_Char( face, charcode, &gindex ); (gdb) backtrace #0 read_font_desc_ft ( fname=0xa454100 "/usr/share/fonts/truetype/unifont/unifont.ttf", movie_width=320, movie_height=33124) at font_load_ft.c:797 #1 0x082361a7 in load_font_ft (width=320, height=182, fontp=0x87f7380, font_name=0xa2fe680 "Sans") at font_load_ft.c:1164 #2 0x082326db in vo_update_osd (dxs=320, dys=182) at sub.c:1093 #3 0x08232c83 in vo_draw_text (dxs=320, dys=182, draw_alpha=0x80ed570 <draw_alpha>) at sub.c:1228 #4 0x080edc84 in draw_osd () at vo_fbdev.c:1093 #5 0x0814a492 in control (vf=0xa409ed0, request=7, data=0x0) at vf_vo.c:94 #6 0x08142e54 in control (vf=0xa3ec538, request=7, data=0x0) at vf_scale.c:449 #7 0x0811f685 in filter_video (sh_video=0xa3b0280, frame=0xa3ee710, pts=0) at dec_video.c:415 #8 0x080a3460 in main (argc=4, argv=0xbfbf95c4) at mplayer.c:2046 (gdb) |
发现视频不能正常播放,gdb定位到出现问题的代码 : )
试着和 0) 比较,list可以列出代码了
好玩,用gdb在mplayer的代码中游走,list一下,break一下,print一下探寻问题的症结
原来关键在于 /etc/mplayer/mplayer.conf 文件,Debian官方编译mpalyer时应该使用了 --confdir=/etc/mplayer 配置选项
3) 结论
将 /etc/mplayer/mplayer.conf 中的 'fontconfig=1' 注释掉,改成 '#fontconfig=1' 即可
这是个表面原因,临时的解决方法,不过修改完,Debian官方的mplayer就能正常工作了
以下是我的配置
$ cat /etc/mplayer/mplayer.conf ### mplayer DEBCONF AREA. DO NOT EDIT THIS AREA OR INSERT TEXT BEFORE IT. #video output driver #vo=xv,x11 #c-aries: 添加fbdev支持 vo=fbdev,xv,x11 #device for dvd #dvd-device=/dev/cdrom #truetype font, using fontconfig #fontconfig=1 #c-aries: fontconfig=1是mplayer产生bug的原因 font='Sans' #if you do not like this default, override it by adding # a ao= line below this debconf area #ao=alsa,oss #c-aries: 默认为alsa,oss我不熟悉,没配置 ao=alsa ### END OF DEBCONF AREA. PLACE YOUR EDITS BELOW; THEY WILL BE PRESERVED. |
Debian mplayer官方包真正不能运行的原因,就留给大家学习gdb,一起找出真正的原因吧
有点得过且过,不过话说回来也要循序渐进
调试到现在,不管是用Debian官方包还是自己编译的包,我系统上的mplayer又可以用来看电影了 : )
时间:2010-03-16 15:22
来源:Linuxeden
作者:c-aries
原文链接