Page 1 of 1

2.2 Crashes Live Streaming HLS

Posted: 06 May 2014 15:15
by raytiley
Hi I am trying to track down an issue in latest VLC nightly live streaming HLS. The command I'm using to start the stream looks like this:

Code: Select all

vlc.exe -I rc -vvv dshow:// :dshow-vdev="Osprey-230 Video Device 1" :dshow-size=640x480 :dshow-aspect-ratio="4\:3" :dshow-fps=29.97 :dshow-video-input=0 :dshow-video-output=0 :dshow-adev="Balanced 1 (Osprey-2X0)" :dshow-audio-channels=2 :dshow-audio-samplerate=44100 :dshow-audio-bitspersample=16 --sout=#duplicate{dst={transcode{width=640,height=480,fps=29.97,vcodec=h264,vb=1000,venc=x264{preset=superfast,keyint=90,ref=1},acodec=mp3,ab=96,channels=2,samplerate=44100}:std{access=livehttp{startseg=500,seglen=10,delsegs=true,numsegs=5,index=D:\live\WIFI-1096k-360p\WIFI-1096k-360p.m3u8,index-url=http://10.0.2.105/live/WIFI-1096k-360p/WIFI-1096k-360p-########.ts},mux=ts{use-key-frames},dst=D:\live\WIFI-1096k-360p\WIFI-1096k-360p-########.ts}}}
This will crash vlc almost immediately. Using a debug build I managed to get a backtrace using gdb:

Code: Select all

Program received signal SIGSEGV, Segmentation fault. 0x6f22a8fb in libebml::EbmlId::EbmlId ( this=0x75dff544 <msvcrt!.dllonexit+59>, aValue=1865190780, aLength=191) at ../../../libebml/ebml/EbmlId.h:69 69 ../../../libebml/ebml/EbmlId.h: No such file or directory. (gdb) bt #0 0x6f22a8fb in libebml::EbmlId::EbmlId ( this=0x75dff544 <msvcrt!.dllonexit+59>, aValue=1865190780, aLength=191) at ../../../libebml/ebml/EbmlId.h:69 #1 0x6f1fcb6b in __static_initialization_and_destruction_0 ( __initialize_p=1, __priority=65535) at ../../src/EbmlCrc32.cpp:53 #2 0x6f1fcbb3 in _GLOBAL__sub_I__ZN7libebml9EbmlCrc3210ClassInfosE () at ../../src/EbmlCrc32.cpp:353 #3 0x6f209daa in __do_global_ctors () at ../../mingw-w64/mingw-w64-crt/crt/gccmain.c:44 #4 0x6f1b1305 in __DllMainCRTStartup ( hDllHandle=hDllHandle@entry=0x6f1b0000, dwReason=1, lpreserved=lpreserved@entry=0x0) at ../../mingw-w64/mingw-w64-crt/crt/crtdll.c:200 #5 0x6f1b1443 in DllMainCRTStartup@12 (hDllHandle=0x6f1b0000, dwReason=1, lpreserved=0x0) at ../../mingw-w64/mingw-w64-crt/crt/crtdll.c:171 #6 0x772699a0 in ntdll!RtlQueryEnvironmentVariable () from C:\Windows\system32\ntdll.dll #7 0x6f1b0000 in ?? () #8 0x7726d939 in ntdll!LdrResSearchResource () from C:\Windows\system32\ntdll.dll #9 0x6f1b1420 in __DllMainCRTStartup () at ../../mingw-w64/mingw-w64-crt/crt/crtdll.c:201 #10 0x7726d7fc in ntdll!LdrResSearchResource () from C:\Windows\system32\ntdll.dll ---Type <return> to continue, or q <return> to quit--- #11 0x00000000 in ?? () (gdb)
After some googling I found that the ebml library where the crash is is used by the mkv demuxer, so I removed that dll fromt he plugins folder. Now it crashes in the x264 library. Stacktrace below:

Code: Select all

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1516.0xec0] 0x75e079c8 in msvcrt!memcmp () from C:\Windows\syswow64\msvcrt.dll (gdb) bt #0 0x75e079c8 in msvcrt!memcmp () from C:\Windows\syswow64\msvcrt.dll #1 0x6a32965c in x264_cqm_init (h=h@entry=0x283cff0) at common/set.c:95 #2 0x6a2a3d66 in x264_encoder_open_128 (param=param@entry=0x6bafec) at encoder/encoder.c:1154 #3 0x6a292cfc in Open (p_this=0x6c8d14) at ../../extras/package/win32/../../../modules/codec/x264.c:1401 #4 0x718de5e0 in module_load (obj=obj@entry=0x6c8d14, m=m@entry=0x615268, init=init@entry=0x718de590 <generic_start>, args=args@entry=0x8dcfd44 "\024\215l") at ../../extras/package/win32/../../../src/modules/modules.c:185 #5 0x718de8fd in vlc_module_load (obj=obj@entry=0x6c8d14, capability=capability@entry=0x72b0b55a <pi_channels_maps+346> "encoder", name=0x693df4 "", name@entry=0x693df0 "x264", strict=strict@entry=true, probe=probe@entry=0x718de590 <generic_start>) at ../../extras/package/win32/../../../src/modules/modules.c:277 #6 0x718df004 in module_need (obj=obj@entry=0x6c8d14, cap=cap@entry=0x72b0b55a <pi_channels_maps+346> "encoder", name=name@entry=0x693df0 "x264", strict=strict@entry=true) at ../../extras/package/win32/../../../src/modules/modules.c:366 #7 0x72b051f2 in transcode_video_new (p_stream=p_stream@entry=0x6977cc, id=id@entry=0x6af500) at ../../../extras/package/win32/../../../modules/stream_out/transcode/video .c:240 #8 0x72b06185 in transcode_video_add (p_stream=p_stream@entry=0x6977cc, ---Type <return> to continue, or q <return> to quit---
Some more googling I found this same exception was introduced because of some optimizations in gcc 4.8: http://forum.doom9.org/showthread.php?p=1623567 the solution offered was compiling using the extra cflag: --extra-cflags=-fno-aggressive-loop-optimizations, but in the same post in mentions that this has been fixed in x264: http://git.videolan.org/?p=x264.git;a=c ... 3eb8eeef44 Since VLC uses HEAD for x264 I would think this wouldn't be an issue any longer.

Back in november I developed a patch for the livehttp module: http://git.videolan.org/?p=vlc.git;a=co ... 850987e240 and I know when I developed that patch things were working. Does anyone know of anything that has changed since that might introduce these crashes? Something with the build scripts maybe, or updates to gcc / mingw? I wish I was able to track this down further, but I'm not very experienced C developer, especially with a codebase as large as VLC. If anyone could point me int he right direction, I'm willing to do any grunt work to get this working again.

Thanks

-ray