Hi,<div><br></div><div>Is there an example of how to use av_lockmgr_register()?  I am not 100% clear upon reading the documentation of what the callback function that I pass in is supposed to do.</div><div><br></div><div>Also, I'm wondering if using av_lockmgr_register will allow me to have multi-threaded decoding in h.264.  Currently when I try setting the following lines:</div>

<div><br></div><div><div>    pCodecCtx->thread_count = 4;</div><div>    pCodecCtx->thread_type = FF_THREAD_FRAME;</div><div><br></div><div>where pCodecCtx is my AVCodecContext for the h.264 codec, the pictures I receive back are garbled.  Would using av_lockmgr_register fix this?</div>

<div><br></div><div>Cheers,</div><div>Karthik</div><br><div class="gmail_quote">On Wed, Nov 9, 2011 at 3:54 PM, John Stebbins <span dir="ltr"><<a href="mailto:stebbins@jetheaddev.com">stebbins@jetheaddev.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 11/09/2011 10:06 AM, Karoly Horvath wrote:<br>
> Hi guys,<br>
><br>
> I have multiple threads which do simultaneous demultiplexing for different streams.<br>
><br>
> Most of the times it works fine, but sometimes a see these messages at startup:<br>
> [NULL @ 0x7fffa4006120] insufficient thread locking around avcodec_open/close()<br>
> Also it sometimes fails to do avcodec_open (it's the same stream, nothing changed..)<br>
><br>
> I have a global mutex for the threads so at any point only one thread can make those API calls.<br>
><br>
> Any idea what the problem is?<br>
><br>
><br>
<br>
</div>Contrary to what the error message says avcodec_open/close are not the only Libav API calls<br>
that need lock protection.  So if you are making other calls into Libav that are not protected<br>
by your global mutex, this could cause the issue.<br>
<br>
As the other poster said, using av_lockmgr_register() will allow Libav to create any locks it<br>
needs and it will do all necessary locking for itself.  So you should use this anyway.<br>
<font color="#888888"><br>
--<br>
John      GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7<br>
<br>
<br>
</font><br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br></div>