[MPlayer-users] Fresh svn mplayer crashes on many ac3 streams

Vladimir Mosgalin mosgalin at VM10124.spb.edu
Wed May 25 04:49:06 CEST 2011


Hello everybody.

I just compiled fresh mplayer svn
(MPlayer SVN-r33497-4.6.0 (C) 2000-2011 MPlayer Team)
with gcc-4.6.0-7 from Fedora 15. I experience crashes on lots of videos
with ac3 streams. Some do play, some crash instantly at start of
playback, some can crash randomly in the middle of file. It happens only
with default ac3 decoder; -afm liba52 solves the problem and works
flawlessly, however it's probably not a good thing that out-of-the-box
mplayer crashes.

What sucks is that mplayer with --enable-debug doesn't exhibit the
crash. After some tracking down I found that the problem is -O4
optimization flag of "normal" version vs -O2 for --enable-debug. The
file "ac3dec.c" produces crash if it was compiled with -O3 or higher,
but works fine for -O2. Crash seems to be unrelated to ac3 downmixing and
happens both with -channels 6 and -channels 2.

What is a bit puzzling is that if I dump ac3 stream off file with
-dumpaudio, then mplayer plays it without crashes..
It might be something related to muxing, as it looks like pack of the
files that were encoded/muxed into mkv by a sole person can all crash in
exactly the same way, and other packs of files work.

Here are example backtraces, compiled with "normal" mplayer (without
--enable-debug as that option overrides CFLAGS), but with -O3 -g among
CFLAGS. Full list of CFLAGS for this example was

-Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls -O3
-march=corei7-avx -pipe -ffast-math -funroll-loops -fomit-frame-pointer
-fexcess-precision=fast -g
(and when whole mplayer compiled with these but ac3dec.c with these but
-O2 instead of -O3, it works. -ffast-math -fexcess-precision=fast flags
can be removed, it doesn't change anything - only some magic
optimization from -O3 seems to produce this effect)


Backtrace from video with ac3 stream that crashes right away:

Program received signal SIGSEGV, Segmentation fault.
set_downmix_coeffs (s=0x1f90850) at ac3dec.c:346
346         s->downmix_coeffs[i][1] *= norm1;
(gdb) bt
#0  set_downmix_coeffs (s=0x1f90850) at ac3dec.c:346
#1  ac3_decode_frame (avctx=0x1b56eb0, data=0x1f51a40, data_size=0x7fffffffb9d0, avpkt=<optimized out>)
    at ac3dec.c:1387
#2  0x0000000000bda8ba in avcodec_decode_audio3 (avctx=0x1b56eb0, samples=<optimized out>, 
    frame_size_ptr=<optimized out>, avpkt=<optimized out>) at utils.c:796
#3  0x0000000000682d7c in decode_audio (sh_audio=0x1b675b0, buf=0x1f51a40 "", minlen=1, maxlen=257536)
    at libmpcodecs/ad_ffmpeg.c:229
#4  0x000000000068315b in init (sh_audio=0x1b675b0) at libmpcodecs/ad_ffmpeg.c:159
#5  0x00000000005438c9 in init_audio_codec (sh_audio=0x1b675b0) at libmpcodecs/dec_audio.c:107
#6  init_audio (sh_audio=<optimized out>, codecname=<optimized out>, afm=0x0, status=1, selected=0x7fffffffbb18)
    at libmpcodecs/dec_audio.c:229
#7  0x0000000000543d03 in init_best_audio_codec (sh_audio=0x1b675b0, audio_codec_list=<optimized out>, 
    audio_fm_list=0x19ca6e0) at libmpcodecs/dec_audio.c:282
#8  0x000000000049992b in reinit_audio_chain () at mplayer.c:1713
#9  0x0000000000488fc7 in main (argc=<optimized out>, argv=<optimized out>) at mplayer.c:3688
(gdb) bt full
#0  set_downmix_coeffs (s=0x1f90850) at ac3dec.c:346
        i = 1
        norm1 = 0.414213538
        cmix = <optimized out>
        smix = <optimized out>
        norm0 = 0.414213538
#1  ac3_decode_frame (avctx=0x1b56eb0, data=0x1f51a40, data_size=0x7fffffffb9d0, avpkt=<optimized out>)
    at ac3dec.c:1387
        buf = 0x1fa7470 "\vwV\336\036@\341\374a-\200~5\376\262\341\a\204 \360\204\036\020\200\336\020\020*\257\037>|\371\363\347ϟ>|\371\363\347ϟ>|\373\376u|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\373\377\235_>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>\377\347Wϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347Ͽ\371\305\347\aϟ>{]\363\347ϝ>"... 
        buf_size = 1792
        s = 0x1f90850
        out_samples_flt = 0x1f51a40 
        out_samples_s16 = 0x1f51a40
        blk = <optimized out>
        ch = <optimized out>
        err = 0
        data_size_orig = 257536
        data_size_tmp = <optimized out>
        channel_map = <optimized out>
        output = {0x0, 0x0, 0x275d49a300000000, 0x7fffffffb900, 0x7fffffffb9a0, 0x0, 0x0}
#2  0x0000000000bda8ba in avcodec_decode_audio3 (avctx=0x1b56eb0, samples=<optimized out>,
    frame_size_ptr=<optimized out>, avpkt=<optimized out>) at utils.c:796
        ret = <optimized out>
#3  0x0000000000682d7c in decode_audio (sh_audio=0x1b675b0, buf=0x1f51a40 "", minlen=1, maxlen=257536)
    at libmpcodecs/ad_ffmpeg.c:229
        pkt = {pts = -9223372036854775808, dts = -9223372036854775808,
          data = 0x1b3e6a0 "\vwV\336\036@\341\374a-\200~5\376\262\341\a\204 \360\204\036\020\200\336\020\020*\257\037>|\371\363\347ϟ>|\371\363\347ϟ>|\373\376u|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\373\377\235_>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>\377\347Wϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|---Type <return> to continue, or q <return> to quit---
\371\363\347Ͽ\371\305\347\aϟ>{]\363\347ϝ>"..., size = 1792, stream_index = 0, flags = 0, side_data = 0x0, 
          side_data_elems = 0, duration = 0, destruct = 0, priv = 0xb325e9bf8ba48526, pos = -1, 
          convergence_duration = 0}
        len2 = 0
        pts = 0
        x = 1792
        start = 0x1b3e6a0 "\vwV\336\036@\341\374a-\200~5\376\262\341\a\204 \360\204\036\020\200\336\020\020*\257\037>|\371\363\347ϟ>|\371\363\347ϟ>|\373\376u|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\373\377\235_>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>\377\347Wϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347ϟ>|\371\363\347Ͽ\371\305\347\aϟ>{]\363\347ϝ>"...
        y = <optimized out>
        len = -1
#4  0x000000000068315b in init (sh_audio=0x1b675b0) at libmpcodecs/ad_ffmpeg.c:159
        tries = <optimized out>
        x = <optimized out>
        lavc_context = 0x1b56eb0
        lavc_codec = <optimized out>
#5  0x00000000005438c9 in init_audio_codec (sh_audio=0x1b675b0) at libmpcodecs/dec_audio.c:107
No locals.
#6  init_audio (sh_audio=<optimized out>, codecname=<optimized out>, afm=0x0, status=1, selected=0x7fffffffbb18)
    at libmpcodecs/dec_audio.c:229
        mpadec = <optimized out>
        i = 5
        orig_fourcc = <optimized out>
        force = 0
#7  0x0000000000543d03 in init_best_audio_codec (sh_audio=0x1b675b0, audio_codec_list=<optimized out>, 
    audio_fm_list=0x19ca6e0) at libmpcodecs/dec_audio.c:282
        status = 1
        audio_codec = <optimized out>
        selected = 0x1b6f1a0
        ac_l_default = {0x100e8d7 "", 0x0}
#8  0x000000000049992b in reinit_audio_chain () at mplayer.c:1713 
No locals.
---Type <return> to continue, or q <return> to quit---
#9  0x0000000000488fc7 in main (argc=<optimized out>, argv=<optimized out>) at mplayer.c:3688
        opt_exit = <optimized out>
        i = <optimized out>
(gdb) 



Another trace from file that crashes like 20 sec after successful playback. -O2 fixes this too
Program received signal SIGSEGV, Segmentation fault.
do_imdct (channels=2, s=0x262f430) at ac3dec.c:618
618                 x[i] = s->transform_coeffs[ch][2*i];
(gdb) bt
#0  do_imdct (channels=2, s=0x262f430) at ac3dec.c:618
#1  decode_audio_block (blk=4, s=0x262f430) at ac3dec.c:1269
#2  ac3_decode_frame (avctx=0x1df5240, data=0x25f20a0, data_size=0x7fffffffba70, avpkt=<optimized out>)
    at ac3dec.c:1409
#3  0x0000000000bda8ba in avcodec_decode_audio3 (avctx=0x1df5240, samples=<optimized out>, 
    frame_size_ptr=<optimized out>, avpkt=<optimized out>) at utils.c:796
#4  0x0000000000682d7c in decode_audio (sh_audio=0x1dfabb0, buf=0x25f10a0 "\234\377\341\376\345\377\t\377\037",
    minlen=4992, maxlen=254848) at libmpcodecs/ad_ffmpeg.c:229
#5  0x00000000005440ea in filter_n_bytes (len=7680, sh=0x1dfabb0) at libmpcodecs/dec_audio.c:392
#6  mp_decode_audio (sh_audio=0x1dfabb0, minlen=7680) at libmpcodecs/dec_audio.c:474
#7  0x0000000000489a3b in fill_audio_out_buffers () at mplayer.c:2199
#8  main (argc=<optimized out>, argv=<optimized out>) at mplayer.c:3811
(gdb) bt full
#0  do_imdct (channels=2, s=0x262f430) at ac3dec.c:618
        i = 0
        x = 0x2644250
        ch = <optimized out>
#1  decode_audio_block (blk=4, s=0x262f430) at ac3dec.c:1269
        bnd = <optimized out> 
        downmix_output = 0
        bit_alloc_stages = "\000\003\000\000\000\000"
        seg = <optimized out>
        different_transforms = 40124496
        gbc = 0x262f438
        fbw_channels = <optimized out>
        channel_mode = 40094016
        i = <optimized out>
        ch = <optimized out>
        cpl_in_use = 40123472
#2  ac3_decode_frame (avctx=0x1df5240, data=0x25f20a0, data_size=0x7fffffffba70, avpkt=<optimized out>)
    at ac3dec.c:1409
        buf = 0x2646050 "\vw`'\034 at C\177\363\006\276\270aG\340?}\232\345\031\017k\322}\275\355\204\315_>\235OB\a\272\324\327v\345\062Uok\303~\231F\272\065\335>\206\254\262\227\316a\271\255J\225\071\264\251W\205\261\004*\351g>r\372\006$\335\b\246I\317I\017n\271\246\226\225\203\367\035\275\214\372\034F\225\226\327|\231\373\332ղ\363\216\266\233\347\260\326\rIn\025\071\357S\216$\231\246\354\357\312TC]S\354\324ҽ\206\325ө\370byoU\"A\377\230\241j\272\207\337ݬ\227\265\261\340\326\366/\215\006\267\333\063ŷ_\373\071\334\364L\257|\360]P\204pVӳq\275\263\062\241\370 S\323\021\376)v\200Ծ"...
        buf_size = 1536
        s = 0x262f430
        out_samples_flt = <optimized out>
        out_samples_s16 = <optimized out>
        blk = <optimized out>
        ch = <optimized out>
        err = <optimized out>
        data_size_orig = <optimized out>
        data_size_tmp = <optimized out>
        channel_map = <optimized out>
---Type <return> to continue, or q <return> to quit---
        output = {0x2644450, 0x2644850, 0x0, 0x0, 0x0, 0x0, 0x0}
#3  0x0000000000bda8ba in avcodec_decode_audio3 (avctx=0x1df5240, samples=<optimized out>,
    frame_size_ptr=<optimized out>, avpkt=<optimized out>) at utils.c:796
        ret = <optimized out>
#4  0x0000000000682d7c in decode_audio (sh_audio=0x1dfabb0, buf=0x25f10a0 "\234\377\341\376\345\377\t\377\037",
    minlen=4992, maxlen=254848) at libmpcodecs/ad_ffmpeg.c:229
        pkt = {pts = -9223372036854775808, dts = -9223372036854775808,
          data = 0x251b190 "\vw`'\034 at C\177\363\006\276\270aG\340?}\232\345\031\017k\322}\275\355\204\315_>\235OB\a\272\324\327v\345\062Uok\303~\231F\272\065\335>\206\254\262\227\316a\271\255J\225\071\264\251W\205\261\004*\351g>r\372\006$\335\b\246I\317I\017n\271\246\226\225\203\367\035\275\214\372\034F\225\226\327|\231\373\332ղ\363\216\266\233\347\260\326\rIn\025\071\357S\216$\231\246\354\357\312TC]S\354\324ҽ\206\325ө\370byoU\"A\377\230\241j\272\207\337ݬ\227\265\261\340\326\366/\215\006\267\333\063ŷ_\373\071\334\364L\257|\360]P\204pVӳq\275\263\062\241\370 S\323\021\376)v\200Ծ"..., size = 1536, stream_index = 0, flags = 0, side_data = 0x0, side_data_elems = 0, 
          duration = 0, destruct = 0, priv = 0x58, pos = -1, convergence_duration = 0}
        len2 = 6144
        pts = 26.368000000000002
        x = 1536
        start = 0x251b190 "\vw`'\034 at C\177\363\006\276\270aG\340?}\232\345\031\017k\322}\275\355\204\315_>\235OB\a\272\324\327v\345\062Uok\303~\231F\272\065\335>\206\254\262\227\316a\271\255J\225\071\264\251W\205\261\004*\351g>r\372\006$\335\b\246I\317I\017n\271\246\226\225\203\367\035\275\214\372\034F\225\226\327|\231\373\332ղ\363\216\266\233\347\260\326\rIn\025\071\357S\216$\231\246\354\357\312TC]S\354\324ҽ\206\325ө\370byoU\"A\377\230\241j\272\207\337ݬ\227\265\261\340\326\366/\215\006\267\333\063ŷ_\373\071\334\364L\257|\360]P\204pVӳq\275\263\062\241\370 S\323\021\376)v\200Ծ"...
        y = <optimized out>
        len = -1
#5  0x00000000005440ea in filter_n_bytes (len=7680, sh=0x1dfabb0) at libmpcodecs/dec_audio.c:392
        buf = <optimized out>
        ret = <optimized out>
        minlen = <optimized out>
        maxlen = <optimized out> 
        format_change = 0
        error = 0
        filter_input = {audio = 0x25f0620, len = 0, rate = 48000, nch = 2, format = 9, bps = 0}
        filter_output = <optimized out>
---Type <return> to continue, or q <return> to quit---
#6  mp_decode_audio (sh_audio=0x1dfabb0, minlen=7680) at libmpcodecs/dec_audio.c:474
        res = 0
        declen = 7680
        huge_filter_buffer = 1
        unitsize = 64
        filter_multiplier = <optimized out>
        max_decode_len = 65536
#7  0x0000000000489a3b in fill_audio_out_buffers () at mplayer.c:2199
        res = <optimized out>
        playflags = <optimized out>
        audio_eof = <optimized out>
        sh_audio = 0x1dfabb0
        t = 2034589490
        playsize = 7680
        bytes_to_write = 0
        format_change = <optimized out>
#8  main (argc=<optimized out>, argv=<optimized out>) at mplayer.c:3811
        aq_sleep_time = 0
        opt_exit = <optimized out>
        i = <optimized out>
        




-- 

Vladimir


More information about the MPlayer-users mailing list