[MPlayer-dev-eng] init_audio codec loop failure

Adam Chasen adam at chasen.name
Mon Oct 10 05:44:01 CEST 2011


I compiled mplayer without mp3lib, which means the first two codecs
for 0x55 format are mp3lib and mpg123 according to the default
codecs.conf.

I have neither mp3lib nor mpg123 on my system. An strace of mplayer
showed an attempt to access the ad_<lib>.so files for those codecs and
then gave up with "Cannot find codec for audio format 0x55."

I noticed that if I only had 1 of these (possibly) shared libraries
before a known working codec in my codecs.conf file, mplayer would
discover the codec without issue. If I had > 1 possibly shared library
codecs before a known working one, then mplayer would never get to it.

I recompiled with gdb support and traced through to find that
init_audio is called 3 times by init_best_audio_codec. Once for each
level of CODEC_STATUS. I am not sure how the CODEC_STATUS maps to the
status in codecs.conf, but it seems most of the codecs have a status
of 1.

1st run init_audio:
* status=2 which no codec afaik has
* iterates through all of the codecs and does nothing because none are
high enough status

2nd run init_audio:
* status=1 This should hit nearly every available codec
* finds mp3lib
* mp3lib is high enough status to continue
* mp3lib added to "selected" variable
* gets all the way to line 231: "            continue;           // try next..."
* gdb prompt read:
200		    if (!sh_audio->dec_handle)
(gdb)
231		    continue;		// try next...
(gdb)
237	}
* LOOP EXITS (this is unexpected)

3rd run init_audio:
* status=0 This should hit nearly every available codec
* finds mp3lib
* "selected" variable already include mp3lib which means it was tried
and failed, move on to next
* finds mpg123
* mpg123 is high enough status to continue
* mpg123 added to "selected" variable
* gets all the way to line 231: "            continue;           // try next..."
* gdb prompt read:
200		    if (!sh_audio->dec_handle)
(gdb)
231		    continue;		// try next...
(gdb)
237	}
* LOOP EXITS (this is unexpected)

This explains why <1 of the shared library codecs works, we have two
tries, status=1 and status=0, but we should be iterating though all
available codecs each run.

Expected behavior:
* after failing to find the shared library, the loop continues

I may be mis-interpreting gdb, but this is my first time doing
anything of substance in gdb.

As for why we are enabling shared libraries, I do not have the answer
to that question. Same goes for our --disable-mp3lib.

Thanks,
Adam


More information about the MPlayer-dev-eng mailing list