To add some context to the question:
Using master branch...
My code is more or less the same as in mp4encrypt app main function. I have linked the library into my multi-threaded application that can execute many threads simultaneously. If I execute only 1 thread, everything seems to works just fine. If I execute many threads I get the assertion below... (always reproducible after running for a short while)

Bento4/Source/C++/Core/Ap4Atom.cpp:763: virtual AP4_Result AP4_AtomListWriter::Action(AP4_Atom*) const: Assertion `bytes_written <= atom->GetSize()' failed.
Is Bento lib reentrant/threadsafe?
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : Is Bento lib reentrant/threadsafe?
Issue date:

--- start body ---
To add some context to the question:
Using master branch...
My code is more or less the same as in mp4encrypt app main function. I have linked the library into my multi-threaded application that can execute many threads simultaneously. If I execute only 1 thread, everything seems to works just fine. If I execute many threads I get the assertion below... (always reproducible after running for a short while)

Bento4/Source/C++/Core/Ap4Atom.cpp:763: virtual AP4_Result AP4_AtomListWriter::Action(AP4_Atom*) const: Assertion `bytes_written <= atom->GetSize()' failed.
--- end body ---

The issue indicates a potential problem with thread safety in the Bento4 library, as the assertion failure occurs when multiple threads are executing simultaneously. This suggests that the library may not be reentrant or thread-safe, leading to race conditions or data corruption when accessed concurrently by multiple threads.