[FFmpeg-devel] multiple stream detection in libavformat vs. thread locking

Michael Niedermayer michaelni
Sun Dec 7 21:50:35 CET 2008


On Sun, Dec 07, 2008 at 03:45:28PM -0500, Ronald S. Bultje wrote:
> Hi,
> 
> On Sun, Dec 7, 2008 at 2:37 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > which codec needs thread synced open/close anyway?
> 
> Any codec using global initialized data.
> 
> static init=0;
> if (!init) {
>   init=1; // case 1
>   init_data();
>   //init=1; // case 2
> }
> 
> In case of context switch in init_data(), you get either memleaks
> (case 2) or crashers when accessing that data (case 1).

it should be

if(last_element_not_yet_initialized)
    initialize_stuff()

besides there should be no *alloc() calls, because these lead to memleaks
either way on some OS with unloading libs ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- 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/20e2fe5b/attachment.pgp>



More information about the ffmpeg-devel mailing list