Skip to content

Commit 5fe3c40

Browse files
committed
Resolve #2247
1 parent cf28973 commit 5fe3c40

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

av/codec/context.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,14 @@ def decode(self, packet: Packet | None = None):
462462
you do not want the library to automatically re-order frames for you
463463
(if they are encoded with a codec that has B-frames).
464464
465+
.. warning::
466+
467+
This method is **not thread-safe**. Calling :meth:`decode` concurrently
468+
from multiple threads on the same :class:`CodecContext` will corrupt
469+
internal FFmpeg state and likely cause a crash (segfault). FFmpeg 8.1
470+
enforces this more strictly than earlier releases. If you need to decode
471+
from multiple threads, give each thread its own :class:`CodecContext`.
472+
465473
"""
466474
if not self.codec.ptr:
467475
raise ValueError("cannot decode unknown codec")

0 commit comments

Comments
 (0)