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

Ronald S. Bultje rsbultje
Sun Dec 7 21:45:28 CET 2008


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).

Ronald




More information about the ffmpeg-devel mailing list