[FFmpeg-devel] multiple stream detection in libavformat vs. thread locking
Michael Niedermayer
michaelni
Sun Dec 7 20:37:20 CET 2008
On Sun, Dec 07, 2008 at 08:31:14PM +0100, Jindrich Makovicka wrote:
> Hi.
>
> I ran into a problem with detecting multiple streams from a network
> using av_find_stream_info(). Because this function internally calls
> avcodec_open() and avcodec_close(), it cannot be run in multiple
> threads. On the other hand, putting global lock around the whole
> function is inefficient, as the autodetection takes some time for a
> network stream (about one second in my case), and the delay until all
> streams are playing is just too long.
>
> I currently have a working quick-and-dirty solution, but would like to
> know if there is some approach acceptable for the upstream. I think
> mainly of adding functions like
> avcodec_enter_critical_section/avcodec_leave_critical_section to the
> thread API wrappers, and calling them at avcodec_open/close
> beginning&end.
>
> By the way, googling "insufficient thread locking around
> avcodec_open/close" suggests that solving this issue could make quite
> a lot people happier.
which codec needs thread synced open/close anyway?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081207/d29dbff5/attachment.pgp>
More information about the ffmpeg-devel
mailing list