Opened 12 years ago

Closed 11 years ago

#640 closed defect (fixed)

Segmentation fault when streaming to ffserver

Reported by: apolychrono Owned by: Michael Niedermayer
Priority: important Component: ffserver
Version: git-master Keywords: regression crash SIGSEGV
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

In this thread http://ffmpeg.test-lab.ch/viewtopic.php?f=12&t=20#p47 i am describing the steps of Segmentation Fault.

Below is the output with gdb ffmpeg_g:

ffmpeg version N-34329-g26b6455, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov  7 2011 10:38:35 with gcc 4.4.3
  configuration: --enable-static --enable-gpl --enable-nonfree --enable-postproc --enable-libfaac --enable-libx264
  libavutil    51. 22. 0 / 51. 22. 0
  libavcodec   53. 26. 0 / 53. 26. 0
  libavformat  53. 18. 0 / 53. 18. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 45. 3 /  2. 45. 3
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[sdp @ 0x15d1760] Estimating duration from bitrate, this may be inaccurate
Input #0, sdp, from '/home/apolychrono/Videos/sdp/352x288@10_preset_fast.sdp':                                                                                                                                                                                                 
  Metadata:
    title           : No Name
  Duration: N/A, start: -3.391000, bitrate: N/A
    Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 352x288, 10 fps, 10 tbr, 90k tbn, 20 tbc
[mp2 @ 0x15cfca0] codec type or id mismatches
Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm':                                                                                                                                                                                                                          
  Metadata:
    title           : No Name
    Stream #0:0: Audio: adpcm_swf, 22050 Hz, 1 channels, s16, 88 kb/s
    Stream #0:1: Video: h264, yuv420p, 352x288, q=10-51, 1000k tbn, 10 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Program received signal SIGSEGV, Segmentation fault.
transcode_init (output_files=<value optimized out>, nb_output_files=1, input_files=<value optimized out>, nb_input_files=<value optimized out>) at ffmpeg.c:2377
2377                av_log(NULL, AV_LOG_INFO, " [sync #%d.%d]",

thanks

Change History (3)

in reply to:  description comment:1 by Carl Eugen Hoyos, 12 years ago

Replying to apolychrono:

In this thread http://ffmpeg.test-lab.ch/viewtopic.php?f=12&t=20#p47 i am describing the steps of Segmentation Fault.

Please describe all steps necessary to reproduce the problem here (not on external sites) and please add backtrace etc as explained on http://ffmpeg.org/bugreports.html

comment:2 by apolychrono, 12 years ago

Sorry for the incomplete report. So here i think is all that you need.

Steps to reproduce it:

1) RTP streaming of a YUV420p file:

ffmpeg  -re -s 352x288 -f rawvideo -pix_fmt yuv420p  -r 10 -i sample_352x288@10_YUV420p.yuv -an  -vcodec libx264  -preset fast -profile baseline -threads 0 -r 10 -s 352x288 -b:v 200k -flags global_header  -f rtp rtp://127.0.0.1:9999 ;

2) Create the feed for ffserver:

ffmpeg -i stream.sdp  -vcodec copy http://127.0.0.1:8090/feed1.ffm

3) Start the ffserver: ffserver -d -f ffserver.conf

The ffserver.conf is :

 Port 8090
 BindAddress 0.0.0.0
 MaxClients 10
 MaxBandwidth 40000
 NoDaemon

<Feed feed1.ffm>
   File /tmp/feed1.ffm
   FileMaxSize 15M
   ACL allow localhost
   ACL allow 192.168.0.0 192.168.255.255
   ACL allow 10.8.13.202 10.8.13.255
</Feed>

<Stream video1.flv>
    Feed feed1.ffm
    Format flv
    AVOptionVideo flags +global_header
#    AVOptionAudio flags +global_header
#    AudioCodec libmp3lame
#    AudioBitRate 32
#    AudioChannels 1
#    AudioSampleRate 11025
    VideoCodec libx264
    VideoSize 352x288
    VideoBitRate 200K
    VideoFrameRate 10
    AVOptionVideo threads 4
    AVOptionVideo qmin 10
    AVOptionVideo qmax 51
    AVOptionVideo qdiff 4
    AVOptionVideo g 250
    AVOptionVideo keyint_min 25
    AVOptionVideo sc_threshold 40
    AVOptionVideo coder 0
    AVOptionVideo bf 0
    AVOptionVideo b_strategy 1
    AVOptionVideo refs 1
    AVOptionVideo flags +loop
    AVOptionVideo flags2 -bpyramid-wpred-dct8x8+mixed_refs+fastpskip
    AVOptionVideo i_qfactor 0.71
    AVOptionVideo qcomp 0.6
    AVOptionVideo partitions -parti8x8-partp4x4+parti4x4+partp8x8+partb8x8
    AVOptionVideo me_method hex
    AVOptionVideo me_range 16
    AVOptionVideo subq 6
    AVOptionVideo trellis 0
    AVOptionVideo wpredp 0
    VideoGopSize 50
    Preroll 4
    StartSendOnKey
</Stream>

BUT the execution order of the above commands is: 3,2,1

(gdb) r -i 352x288@10_preset_fast.sdp -vcodec copy http://127.0.0.1:8090/feed1.ffm                                                                                                                                                                                             
Starting program: /home/apolychrono/Software/ffmpeg/ffmpeg_g -i 352x288@10_preset_fast.sdp -vcodec copy http://127.0.0.1:8090/feed1.ffm                                                                                                                                        
[Thread debugging using libthread_db enabled]                                                                                                                                                                                                                                  
ffmpeg version N-34329-g26b6455, Copyright (c) 2000-2011 the FFmpeg developers                                                                                                                                                                                                 
  built on Nov  7 2011 10:38:35 with gcc 4.4.3                                                                                                                                                                                                                                 
  configuration: --enable-static --enable-gpl --enable-nonfree --enable-postproc --enable-libfaac --enable-libx264                                                                                                                                                             
  libavutil    51. 22. 0 / 51. 22. 0                                                                                                                                                                                                                                           
  libavcodec   53. 26. 0 / 53. 26. 0                                                                                                                                                                                                                                           
  libavformat  53. 18. 0 / 53. 18. 0                                                                                                                                                                                                                                           
  libavdevice  53.  4. 0 / 53.  4. 0                                                                                                                                                                                                                                           
  libavfilter   2. 45. 3 /  2. 45. 3                                                                                                                                                                                                                                           
  libswscale    2.  1. 0 /  2.  1. 0                                                                                                                                                                                                                                           
  libpostproc  51.  2. 0 / 51.  2. 0                                                                                                                                                                                                                                           
[sdp @ 0x15d1760] Estimating duration from bitrate, this may be inaccurate                                                                                                                                                                                                     
Input #0, sdp, from '352x288@10_preset_fast.sdp':                                                                                                                                                                                                                              
  Metadata:                                                                                                                                                                                                                                                                    
    title           : No Name                                                                                                                                                                                                                                                  
  Duration: N/A, start: -3.391000, bitrate: N/A                                                                                                                                                                                                                                
    Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 352x288, 10 fps, 10 tbr, 90k tbn, 20 tbc                                                                                                                                                                         
[mp2 @ 0x15cfca0] codec type or id mismatches                                                                                                                                                                                                                                  
Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm':                                                                                                                                                                                                                          
  Metadata:
    title           : No Name
    Stream #0:0: Audio: adpcm_swf, 22050 Hz, 1 channels, s16, 88 kb/s
    Stream #0:1: Video: h264, yuv420p, 352x288, q=10-51, 1000k tbn, 10 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Program received signal SIGSEGV, Segmentation fault.
transcode_init (output_files=<value optimized out>, nb_output_files=1, input_files=<value optimized out>, nb_input_files=<value optimized out>) at ffmpeg.c:2377
2377                av_log(NULL, AV_LOG_INFO, " [sync #%d.%d]",
(gdb) bt
#0  transcode_init (output_files=<value optimized out>, nb_output_files=1, input_files=<value optimized out>, nb_input_files=<value optimized out>) at ffmpeg.c:2377
#1  0x00000000004415aa in transcode (argc=<value optimized out>, argv=0x7fffffffe0f8) at ffmpeg.c:2419
#2  main (argc=<value optimized out>, argv=0x7fffffffe0f8) at ffmpeg.c:4506
(gdb) disass $pc-32,$pc+32
Dump of assembler code from 0x440fc3 to 0x441003:
   0x0000000000440fc3 <transcode_init+5603>:    stc    
   0x0000000000440fc4 <transcode_init+5604>:    jrcxz  0x441034 <transcode_init+5716>
   0x0000000000440fc6 <transcode_init+5606>:    add    %cl,0x63(%rax)
   0x0000000000440fc9 <transcode_init+5609>:    push   %rbx
   0x0000000000440fca <transcode_init+5610>:    or     %cl,-0x75(%rax)
   0x0000000000440fcd <transcode_init+5613>:    rex.XB and %cl,-0x73(%r8)
   0x0000000000440fd1 <transcode_init+5617>:    adc    $0x92,%al
   0x0000000000440fd3 <transcode_init+5619>:    shl    $0x4,%rdx
   0x0000000000440fd7 <transcode_init+5623>:    add    0xbd5292(%rip),%rdx        # 0x1016270 <input_streams>
   0x0000000000440fde <transcode_init+5630>:    cmp    %rdx,%rax
   0x0000000000440fe1 <transcode_init+5633>:    je     0x440fff <transcode_init+5663>
=> 0x0000000000440fe3 <transcode_init+5635>:    mov    0x8(%rax),%rdx
   0x0000000000440fe7 <transcode_init+5639>:    mov    (%rax),%ecx
   0x0000000000440fe9 <transcode_init+5641>:    mov    $0x20,%esi
   0x0000000000440fee <transcode_init+5646>:    xor    %edi,%edi
   0x0000000000440ff0 <transcode_init+5648>:    xor    %eax,%eax
   0x0000000000440ff2 <transcode_init+5650>:    mov    (%rdx),%r8d
   0x0000000000440ff5 <transcode_init+5653>:    mov    $0xc2c86c,%edx
   0x0000000000440ffa <transcode_init+5658>:    callq  0xb2f3c0 <av_log>
   0x0000000000440fff <transcode_init+5663>:    mov    0x264(%rbx),%r10d
End of assembler dump.
(gdb) info all-registers
rax            0x0      0
rbx            0x15d0b70        22874992
rcx            0x7ffff6f87500   140737336866048
rdx            0x15d8480        22905984
rsi            0x4      4
rdi            0x7fffffffaee0   140737488334560
rbp            0x0      0x0
rsp            0x7fffffffbc10   0x7fffffffbc10
r8             0x7ffff7fd5700   140737353963264
r9             0x7ffff7fd5700   140737353963264
r10            0x14e1ec0        21896896
r11            0x246    582
r12            0x0      0
r13            0xffffffea       4294967274
r14            0x1      1
r15            0x1      1
rip            0x440fe3 0x440fe3 <transcode_init+5635>
eflags         0x10283  [ CF SF IF RF ]
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0
st0            -nan(0x00000003c)        (raw 0xffff000000000000003c)
st1            -nan(0x000000004)        (raw 0xffff0000000000000004)
st2            -inf     (raw 0xffff0000000000000000)
st3            -nan(0xa000000000000000) (raw 0xffffa000000000000000)
st4            -inf     (raw 0xffff0000000000000000)
st5            -nan(0x606060606060606)  (raw 0xffff0606060606060606)
st6            -nan(0xa000000000000000) (raw 0xffffa000000000000000)
st7            -inf     (raw 0xffff0000000000000000)
fctrl          0x37f    895
fstat          0x0      0
ftag           0xffff   65535
fiseg          0x0      0
fioff          0x0      0
foseg          0x0      0
fooff          0x0      0
fop            0x0      0
xmm0           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm1           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x25 <repeats 16 times>}, v8_int16 = {0x2525, 0x2525, 0x2525, 0x2525, 0x2525, 0x2525, 0x2525, 0x2525}, v4_int32 = {0x25252525, 0x25252525, 0x25252525, 0x25252525}, v2_int64 = {
    0x2525252525252525, 0x2525252525252525}, uint128 = 0x25252525252525252525252525252525}
xmm2           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm3           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x8000000000000000, 0x0}, v16_int8 = {0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0xff, 0x0, 0xff00, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0xff0000, 
    0xff000000, 0x0, 0x0}, v2_int64 = {0xff00000000ff0000, 0x0}, uint128 = 0x0000000000000000ff00000000ff0000}
xmm4           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x72, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x20, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x2072, 0x6170, 0x6172, 0x206d, 0x31, 0x0, 0x0, 0x0}, v4_int32 = {0x61702072, 
    0x206d6172, 0x31, 0x0}, v2_int64 = {0x206d617261702072, 0x31}, uint128 = 0x0000000000000031206d617261702072}
xmm5           {v4_float = {0x0, 0x1, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0, 0x0, 0x0, 0xe0, 0x95, 0x9c, 0xe7, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0xe000, 0x9c95, 0x3fe7, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0xe0000000, 0x3fe79c95, 
    0x0, 0x0}, v2_int64 = {0x3fe79c95e0000000, 0x0}, uint128 = 0x00000000000000003fe79c95e0000000}
xmm6           {v4_float = {0x0, 0x1, 0x0, 0x0}, v2_double = {0x1, 0x0}, v16_int8 = {0x6d, 0x7d, 0xbf, 0xbb, 0x27, 0xaf, 0xf5, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x7d6d, 0xbbbf, 0xaf27, 0x3ff5, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0xbbbf7d6d, 
    0x3ff5af27, 0x0, 0x0}, v2_int64 = {0x3ff5af27bbbf7d6d, 0x0}, uint128 = 0x00000000000000003ff5af27bbbf7d6d}
xmm7           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x68, 0xc8, 0xbc, 0x3b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 0xc868, 0x3bbc, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x3bbcc868, 0x0, 0x0}, 
  v2_int64 = {0x3bbcc86800000000, 0x0}, uint128 = 0x00000000000000003bbcc86800000000}
xmm8           {v4_float = {0x0, 0xfffffffd, 0x0, 0x0}, v2_double = {0xffffffffffffffd2, 0x0}, v16_int8 = {0xe0, 0xe6, 0x35, 0x67, 0x9e, 0x6, 0x47, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xe6e0, 0x6735, 0x69e, 0xc047, 0x0, 0x0, 0x0, 0x0}, 
  v4_int32 = {0x6735e6e0, 0xc047069e, 0x0, 0x0}, v2_int64 = {0xc047069e6735e6e0, 0x0}, uint128 = 0x0000000000000000c047069e6735e6e0}
xmm9           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm10          {v4_float = {0x0, 0xffffffff, 0x0, 0x0}, v2_double = {0xffffffffffffffff, 0x0}, v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf0, 0xbf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 0x0, 0xbff0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 
    0xbff00000, 0x0, 0x0}, v2_int64 = {0xbff0000000000000, 0x0}, uint128 = 0x0000000000000000bff0000000000000}
xmm11          {v4_float = {0x9689a800, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x6a, 0xa2, 0x65, 0x50, 0xf2, 0xea, 0x8f, 0xbd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xa26a, 0x5065, 0xeaf2, 0xbd8f, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x5065a26a, 
    0xbd8feaf2, 0x0, 0x0}, v2_int64 = {0xbd8feaf25065a26a, 0x0}, uint128 = 0x0000000000000000bd8feaf25065a26a}
xmm12          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x29, 0xf2, 0x88, 0x6c, 0xa6, 0x49, 0xde, 0x3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xf229, 0x6c88, 0x49a6, 0x3ede, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x6c88f229, 
    0x3ede49a6, 0x0, 0x0}, v2_int64 = {0x3ede49a66c88f229, 0x0}, uint128 = 0x00000000000000003ede49a66c88f229}
---Type <return> to continue, or q <return> to quit---
xmm13          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0xb3, 0x12, 0x58, 0x17, 0x64, 0x46, 0xe6, 0x3b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x12b3, 0x1758, 0x4664, 0x3be6, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x175812b3, 
    0x3be64664, 0x0, 0x0}, v2_int64 = {0x3be64664175812b3, 0x0}, uint128 = 0x00000000000000003be64664175812b3}
xmm14          {v4_float = {0x0, 0x3, 0x0, 0x0}, v2_double = {0x2d, 0x0}, v16_int8 = {0xc0, 0x9, 0xf2, 0x16, 0xb5, 0xdf, 0x46, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x9c0, 0x16f2, 0xdfb5, 0x4046, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x16f209c0, 
    0x4046dfb5, 0x0, 0x0}, v2_int64 = {0x4046dfb516f209c0, 0x0}, uint128 = 0x00000000000000004046dfb516f209c0}
xmm15          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x1 <repeats 16 times>}, v8_int16 = {0x101, 0x101, 0x101, 0x101, 0x101, 0x101, 0x101, 0x101}, v4_int32 = {0x1010101, 0x1010101, 0x1010101, 0x1010101}, v2_int64 = {0x101010101010101, 
    0x101010101010101}, uint128 = 0x01010101010101010101010101010101}
mxcsr          0x1fb2   [ DE UE PE IM DM ZM OM UM PM ]
(gdb)

thanks

comment:3 by Carl Eugen Hoyos, 11 years ago

Component: FFmpegFFserver
Keywords: regression crash SIGSEGV added; rtp flv ffserver removed
Priority: normalimportant
Resolution: fixed
Status: newclosed

Sorry for never looking into this, it seems FFserver lacks an active maintainer;-(

I believe the crash was fixed at some point, FFserver currently ignores command line arguments, see ticket #1970 (it contains the revision that introduced above crash afaict).

Note: See TracTickets for help on using tickets.