[Libav-user] multithreaded problems

Karthik Kailash karthik at freestreammedia.com
Thu Nov 10 02:07:22 CET 2011


Hi,

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.

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:

    pCodecCtx->thread_count = 4;
    pCodecCtx->thread_type = FF_THREAD_FRAME;

where pCodecCtx is my AVCodecContext for the h.264 codec, the pictures I
receive back are garbled.  Would using av_lockmgr_register fix this?

Cheers,
Karthik

On Wed, Nov 9, 2011 at 3:54 PM, John Stebbins <stebbins at jetheaddev.com>wrote:

> 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
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111109/9696c7cc/attachment.html>


More information about the Libav-user mailing list