h264 encode crash
on MAC book step 1. git clone https://github.com/cisco/openh264 step 2. make step 3. cd testbin gdb ../h264enc run welsenc.cfg
then crash.
the crash stack:
gdb) bt
#0 0x00007fff88cbfb3b in std::string::assign ()
#1 0x0000000100002161 in ParseConfig ()
#2 0x00000001000043ac in ProcessEncodingSvcWithConfig ()
#3 0x0000000100004a2f in main ()
could someone take a look?
it seems related to reading input config file in welsenc.cpp at: if (strTag[1].length() > 0) sFileSet.strSeqFile = strTag[1];
I was unable to repro this so far on my MacPro OSX 10.9.
no crash on IMac OSX 10.9
I have tested at 4 MAC, one is 10.7.5, crash, two is 10.8.5, crash, one 10.9, work well.
I also test on Ubuntu 10.04 LTS, it also will crash.
I think I have found one root cause.
welsenc.cpp @ line 852: memset (&fs,0,sizeof(SFilesSet));
the fs is struct but it contain some stl string object. the memset will cause the object corrupt. then it cause crash later when use the ojbects.
after fix it, the MAC book can work well, but still crash at Ubuntu. I will raise a fix first, then to debug on Linux.
I found another root cause. If a CReadConfig object is copied, the m_cfgFile maybe be closed multiple times. This will cause glibc double free. The solution is here: change the prototype of ParseLayerConfig to int ParseLayerConfig( CReadConfig & cRdLayerCfg, const int iLayer, SEncParamExt& pSvcParam ) After this change, the encoder will not crash on Ubuntu 64
licaiguo, Yes. you are right!!! why pass the object by the copy construct here?
I will raise a fix at once.
after the two merges, encoder can work well at my side, so I close the issue now.