<div dir="ltr"><div><div>Hi All,<br><br></div>My aim is to decode video on sniper simulator using ffmpeg. For this I am using the demuxing_decoding.c with few changes , like addition of thread_count in function main,<br><br>
</div><div>/*sample snippet*/<br></div>in function main()<br>{<br>...........<br><br><div><span class="">if</span> (<a class="" href="https://ffmpeg.org/doxygen/trunk/demuxing__decoding_8c.html#a85e44b1a7e74c90b84b2298caefb5f73">open_codec_context</a>(&<a class="" href="https://ffmpeg.org/doxygen/trunk/demuxing__decoding_8c.html#af35f69f407b98b5244f837e25813bc11">video_stream_idx</a>, fmt_ctx, <a class="" href="https://ffmpeg.org/doxygen/trunk/group__lavu__misc.html#gga9a84bba4713dfced21a1a56163be1f48ac1a46f59be5c6c2d3412ab172d6b8cf5">AVMEDIA_TYPE_VIDEO</a>) >= 0) {
<div class=""><a name="l00256"></a><span class="">  256</span>         video_stream = fmt_ctx-><a class="" href="https://ffmpeg.org/doxygen/trunk/structAVFormatContext.html#acfefb6b6cf21e87a0dcbd1a547ba2348" title="A list of all streams in the file.">streams</a>[<a class="" href="https://ffmpeg.org/doxygen/trunk/demuxing__decoding_8c.html#af35f69f407b98b5244f837e25813bc11">video_stream_idx</a>];</div>

<div class=""><a name="l00257"></a><span class="">  257</span>         video_dec_ctx = video_stream-><a class="" href="https://ffmpeg.org/doxygen/trunk/structAVStream.html#a56f20051fb99339cc588cd3a07ab8c96" title="Codec context associated with this stream.">codec</a>;<br>
<br></div><div class=""><b><span style="background-color:rgb(255,0,0)">/*NEW ADDITION TO CREATE THREADS - set the thread count*/<br></span></b></div><div class=""><b><span style="background-color:rgb(255,0,0)">video_dec_ctc->thread_count = 3;<br>
</span></b><br><br></div>.............<br>}<br><div><br></div><div>This is to create 4 threads for decoding video.<br><br></div><div>I am compiling the program using the command <br>gcc -o demuxDecode demuxing_decoding.c -lavutil -lavformat -lavcodec -lz -lavutil -lm -lpthread<br>
<br></div><div>Now comes the actual problem:<br><br></div><div>The threads are not getting created.. I am not able to understand the problem, since on other machine ( 64 bit laptop's) its happening and not on mine.<br>
<br></div><div>I have a 64 bit Ubuntu 12.04 installed on my system.<br></div><div>The sniper simulator is simulating 4 cores, but since ffmpeg is not creating the threads, the 4 cores are not getting used. Only 1 thread is getting created.<br>
<br></div><div>I have the gcc version 4,6,3 installed,<br><br>----------------------------------------------------------------------------------------------------------------<br>ierumshanaya@ubuntu:/usr/local/lib$ gcc -v<br>
Using built-in specs.<br>COLLECT_GCC=gcc<br>COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper<br>Target: x86_64-linux-gnu<br>Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu<br>
Thread model: posix<br>gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) <br><br>----------------------------------------------------------------------------------------------------------------<br></div><div><b>I have checked for the libpthread.a and libpthread.so library files also, and they are present in the path</b><br>
<br>---------------------------------------------------------------------------------------------------------------<br>ierumshanaya@ubuntu:/usr/local/lib$ locate libpthread<br>/home/ierumshanaya/.local/share/Trash/files/pin-2.13-65163-gcc.4.4.7-linux/source/tools/Probes/tpss_lin_libpthread.cpp<br>
/home/ierumshanaya/sescutils/build-mipseb-linux/obj/glibc-build/linuxthreads/libpthread.a<br>/home/ierumshanaya/sescutils/install/mipseb-linux/lib/libpthread.a<br>/home/ierumshanaya/sniper-5.3/pin_kit/pin-2.13-61206-gcc.4.4.7-linux/source/tools/Probes/tpss_lin_libpthread.cpp<br>
/home/ierumshanaya/sniper-5.3/pin_kit/source/tools/Probes/tpss_lin_libpthread.cpp<br>/lib/x86_64-linux-gnu/<a href="http://libpthread-2.15.so">libpthread-2.15.so</a><br>/lib/x86_64-linux-gnu/libpthread.so.0<br>/lib32/<a href="http://libpthread-2.15.so">libpthread-2.15.so</a><br>
/lib32/libpthread.so.0<br>/usr/lib/x86_64-linux-gnu/libpthread.a<br>/usr/lib/x86_64-linux-gnu/libpthread.so<br>/usr/lib/x86_64-linux-gnu/libpthread_nonshared.a<br>/usr/lib32/libpthread.a<br>/usr/lib32/libpthread.so<br>/usr/lib32/libpthread_nonshared.a<br>
/usr/share/doc/libpthread-stubs0<br>/usr/share/doc/libpthread-stubs0-dev<br>/usr/share/doc/libpthread-stubs0/changelog.Debian.gz<br>/usr/share/doc/libpthread-stubs0/copyright<br>/usr/share/doc/libpthread-stubs0-dev/README<br>
/usr/share/doc/libpthread-stubs0-dev/changelog.Debian.gz<br>/usr/share/doc/libpthread-stubs0-dev/copyright<br>/var/lib/dpkg/info/libpthread-stubs0-dev:amd64.list<br>/var/lib/dpkg/info/libpthread-stubs0-dev:amd64.md5sums<br>
/var/lib/dpkg/info/libpthread-stubs0:amd64.list<br>/var/lib/dpkg/info/libpthread-stubs0:amd64.md5sums<br><br>-----------------------------------------------------------------------------------------------------------------------<br>
</div><div><br></div><div><div class="gmail_extra"><span style="background-color:rgb(255,0,0)"><b>My question now is -</b></span><br><br></div><div class="gmail_extra">1) Is gcc not able to link the pthread library and hence not able to create threads??<br>
</div><div class="gmail_extra">2) Or, is gcc linking it from the lib32 directory and not usr/local/lib and since it is a 64bit machine, this is happening. Then how to solve this issue???<br><br></div><div class="gmail_extra">
3) Since the code is able to create threads on some systems of my friends, it is for sure that adding thread_count is working. So, where is the problem.<br><br></div><div class="gmail_extra">Can someone please give me some pointers.<br>
<br>Thanks,<br>Ierum<br></div></div></div></div>