On 2009-09-27 at 01:38:27 [+0200], Michael Conrad <[email protected]> wrote: > On Fri, 25 Sep 2009 08:58:48 -0400, <[email protected]> wrote: > > Hi to all, > > I'm realizing an application to displaying more than one MPEG4 network > > streaming. I used ffmpeg library to decode the streaming, but if I try > > to decode two streams in the same time, it doesn't work fine. Is it > > possible to use ffmpeg libraries to make this kind of application ? > > It works fine if you use only one thread. In order to have multiple > threads each decoding their own stream, you need to synchronize access to > several functions. One important one is "avcodec_open". Search this > list to find more details.
I've tried to find a way to search this list, but could not find one from the link at the bottom of every mail to this list. In any case, I've looked into the code, so far it seems the "lockmgr" callback is indeed only used when opening or closing codecs. What other calls are not thread-safe? In my application, I am decoding in one thread per stream, but I am using completely independent AVFormatContext and AVCodecContext instances per thread (i.e. calling av_open_input_stream() not per file, but per every stream of the file). Each of my threads is setup to ignore all the packets of any other stream. Therefor I can read and decode each stream completely independent from each other. However, I don't protect calls into the library by any locks, since I figured it is re-entrant (demuxer and decoder data is completely contained within the contexts, or so I hope). I do make sure that av_register_all() is only called once. What other potential pitfalls should I be aware of? Best regards, -Stephan _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
