diff --git a/src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp b/src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp index e08bd40f..76f9f486 100644 --- a/src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp +++ b/src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp @@ -5467,19 +5467,26 @@ MovieFFMpegIO::MovieFFMpegIO(CodecFilterFunction codecFilter, sdparams); } - if (!globalContextPool) - { - int poolSize = 500; - if (const char* c = getenv("TWK_MOVIEFFMPEG_CONTEXT_POOL_SIZE")) - { - poolSize = atoi(c); - } - if (poolSize > 0) globalContextPool = new ContextPool(poolSize); - else - { - report("Disabling mio_ffmpeg context thread pool.", true); - } - } + // Note : No longer using the global context pool (since FFmpeg 6.0) + // Rationale: The global context pool was based on the premise that a context + // could be opened and closed multiple times. + // However, with FFmpeg 6.0, this premise is no longer valid and was causing crashes. + // As per the FFmpeg 6 documentation: https://ffmpeg.org/doxygen/trunk/deprecated.html: + // "Opening and closing a codec context multiple times is not supported anymore – use multiple codec contexts instead." + + // if (!globalContextPool) + // { + // int poolSize = 500; + // if (const char* c = getenv("TWK_MOVIEFFMPEG_CONTEXT_POOL_SIZE")) + // { + // int poolSize = atoi(c); + // } + // if (poolSize > 0) globalContextPool = new ContextPool(poolSize); + // else + // { + // report("Disabling mio_ffmpeg context thread pool.", true); + // } + // } } MovieFFMpegIO::~MovieFFMpegIO()