[Libav-user] multithreaded problems

John Stebbins stebbins at jetheaddev.com
Thu Nov 10 00:54:37 CET 2011


On 11/09/2011 10:06 AM, Karoly Horvath wrote:
> Hi guys,
>
> I have multiple threads which do simultaneous demultiplexing for different streams.
>
> Most of the times it works fine, but sometimes a see these messages at startup:
> [NULL @ 0x7fffa4006120] insufficient thread locking around avcodec_open/close()
> Also it sometimes fails to do avcodec_open (it's the same stream, nothing changed..)
>
> I have a global mutex for the threads so at any point only one thread can make those API calls.
>
> Any idea what the problem is?
>
>

Contrary to what the error message says avcodec_open/close are not the only Libav API calls
that need lock protection.  So if you are making other calls into Libav that are not protected
by your global mutex, this could cause the issue.

As the other poster said, using av_lockmgr_register() will allow Libav to create any locks it
needs and it will do all necessary locking for itself.  So you should use this anyway.

-- 
John      GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111109/938d74c6/attachment.asc>


More information about the Libav-user mailing list