[MPlayer-dev-eng] [PATCH]: Fallback to null video codec

Filip Kalinski filon at pld.org.pl
Fri Jan 10 15:32:16 CET 2003


On Fri, Jan 10, 2003 at 01:52:53PM +0100, Arpi wrote:
> Hi,
> 
> > Some time ago I was complaining about crashing of mplayer when:
> 
> when?

That was: "[BUG] Audio only playing burns CPU" thread.

> >  if(!sh_video->inited){
> >      mp_msg(MSGT_DECVIDEO,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM
> > ,get_path("codecs.conf"));
> >      mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
> > +    // fall back to null when codec is not found
> > +    init_video(sh_video,"null",NULL,-1);
> >      return 0; // failed
> >  }
> 
> no, this is wrong.
> look at that return 0;
> 
> mplayer should not play (not even demux) video at all, if the
> codec init failed.
> 
> what fileformat and -vo driver you used for reproducing this bug?
> don't say any, i cannot reproduce it here.
> 

Take a mpeg-ps file, run "mplayer <file> -vc foobar -vo null" and press
an arrow key to do the seek. It gets segmentation fault (because there
is no video demuxer).

For example:

GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host= --target=athlon-pld-linux"...
(gdb) run ~/movies/Megaus.mpg -vc foobar -vo null
Starting program: /mnt/data/work/mplayer/main.dev/mplayer ~/movies/Megaus.mpg -vc foobar -vo null
[New Thread 8192 (LWP 8379)]
Using GNU internationalization
Original domain: messages
Original dirname: /usr/share/locale
Current domain: mplayer
Current dirname: /usr/local/share/locale


MPlayer CVS-030101-14:46-3.2 (C) 2000-2002 Arpad Gereoffy (see DOCS)

CPU: Advanced Micro Devices Duron SF Spitfire (Family: 6, Stepping: 0)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx

Reading config file /usr/local/etc/mplayer/mplayer.conf: No such file or directory
Reading config file /home/filon/.mplayer/config
Reading /home/filon/.mplayer/codecs.conf: can't open '/home/filon/.mplayer/codecs.conf': No such file or directory
Reading /usr/local/etc/mplayer/codecs.conf: 49 audio & 130 video codecs
/home/filon/.mplayer/subfont.ttf doesn't look like a font description, ignoring
Cannot load font: /home/filon/.mplayer/subfont.ttf
Using Linux hardware RTC timing (1024Hz).
Input config file /home/filon/.mplayer/input.conf parsed : 52 binds
Can't open menu config file: /home/filon/.mplayer/menu.conf
Menu inited: /usr/local/etc/mplayer/menu.conf

Playing /home/filon/movies/Megaus.mpg
MPEG-PS file format detected.
VIDEO:  MPEG1  352x288  (aspect 8)  25.00 fps  1687.5 kbps (210.9 kbyte/s)
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
MP3lib: init layer2&3 finished, tables done
AUDIO: 48000 Hz, 2 ch, 16 bit (0x10), ratio: 16000->192000 (128.0 kbit)
Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
==========================================================================
Forced video codec: foobar
*** Try to upgrade /home/filon/.mplayer/codecs.conf from etc/codecs.conf
*** If it still does not work, read DOCS/codecs.html!
Cannot find codec matching selected -vo and video format 0x10000001!
==========================================================================
alsa-init: testing and bugreports are welcome.
alsa-init: requested format: 48000 Hz, 2 channels, Signed 16-bit (Little-Endian)
alsa-init: 1 soundcard found, using: hw:0,0
alsa9: 48000 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little Endian
AO: [alsa9] 48000Hz 2ch Signed 16-bit (Little-Endian)
Building audio filter chain for 48000Hz/2ch/16bit -> 48000Hz/2ch/16bit...
Video: No video!!!
Start playing...

[here I do the seek]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 8192 (LWP 8379)]
0x0816a2a8 in demux_seek_mpg (demuxer=0x849b1e8, rel_seek_secs=-nan(0x709b36), flags=0) at demux_mpg.c:365
365             if(!sh_video->i_bps) // unspecified or VBR
(gdb) print sh_video
$1 = (struct {...} *) 0x0

So we have a segfault.

I know, that user will not probably do such thing, but an application
shouldn't segafult even when user is doing something stupid :-)

-- 
Filip Kalinski <filon at pld.org.pl>


More information about the MPlayer-dev-eng mailing list