Repository navigation
Conversation
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <ioan.1931@gmail.com>
686e739 to
b92c079
Compare
Signed-off-by: deltag0 <victor.terme@autodesk.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
I took a look at the code again to refresh myself, and I found that the |
…penRV into RV-loading-source-leak
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
This reverts commit d3ab2c6515f53412c9d5fb3d24d0d0da0b8b2fdd. Passing the track to ContextPool::Reservation at construction removed the implicit liveness check that trackFromStreamIndex provided. When openAVCodec fails, the track is deleted while the Reservation is still in scope, so ~Reservation read a dangling VideoTrack/AudioTrack, and the Context left in m_contextMap kept the stale pointer for later eviction to write through. Also includes the clang-format brace fix the pre-commit hook applies to the restored J2K branch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Fixed & double checked the use of the addition :D |
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Addressed 1,2,3,4 I think 5 is ok |
|
There's a comment saying something "should never happen" should we try to make sure it never happens, or leave it as is? |
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
| IPGraph::WorkItemID IPGraph::addWorkItem(const VoidFunction& function, const char* tag) | ||
| { | ||
| auto jobDispatcher = reinterpret_cast<JobDispatcher*>(m_jobDispatcher); | ||
| if (tag) |
There was a problem hiding this comment.
The tag is optional so we should not check its value here.
It is the m_jobDispatcher that we should check here to be safe.
| { | ||
| auto jobDispatcher = reinterpret_cast<JobDispatcher*>(m_jobDispatcher); | ||
| jobDispatcher->removeJob(id); | ||
| if (id) |
There was a problem hiding this comment.
It is the m_jobDispatcher that we should check here to be extra safe, not the id
| { | ||
| auto jobDispatcher = reinterpret_cast<JobDispatcher*>(m_jobDispatcher); | ||
| jobDispatcher->waitJob(id); | ||
| if (id) |
There was a problem hiding this comment.
It is the m_jobDispatcher that we should check here to be extra safe, not the id
| poolSize = atoi(c); | ||
| } | ||
| if (poolSize > 0) | ||
| globalContextPool = std::make_unique<ContextPool>(poolSize); |
There was a problem hiding this comment.
This should not compile anymore due to your recent change.
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
|
Closing this PR to reopen it so that we can modify a couple of things. |
…playback (#1459) ### fix: SG-43388: Cap open FFmpeg decoders to stop memory growth during playback ### Linked issues No GitHub issue — tracked internally as SG-43388. This is a minimal alternative to #1316. ### Summarize your change. Re-enable the MovieFFMpeg `ContextPool`, which was disabled during the FFmpeg 6 migration, so the number of open decoders is capped again. ### Describe the reason for the change. Each source has about 5 readers (eval threads, display, audio), and each one keeps its decoder open until the source is unloaded. A 16-thread H.264 1080p decoder holds about 130 MB, so memory grows with every clip played: 27 GB after one hour on a 250-clip sequence. ### Describe what you have tested and on which operating system. Rocky Linux 9, 250-clip H.264 1080p sequence, measured with temporary instrumentation (not included): - Before: open decoders kept rising (299 after 5 min), heap +1.1 GB/min. - After: 31 open decoders (500-thread cap), heap in use flat at about 6 GB over 2.4 h (343k frames, 1,850 decoder reopens), no crashes. ### Add a list of changes, and note any that might need special attention during the review. - Create the pool again; the size comes from `TWK_MOVIEFFMPEG_CONTEXT_POOL_SIZE` (default 500 threads, `0` disables it). - **FFmpeg 6 cannot reopen a closed context:** when the pool closes one, it now also nulls the track's `avCodecContext`, so `openAVCodec()` allocates a new one. - Fix stale pointers the pool would otherwise hit: - `close()` removes the pool entry before freeing. - `initializeAll()` keeps the video reservations alive through `initializeVideo()`. - The audio probe context is no longer registered with the pool, and `initializeAudio()` frees the track's pointer instead of a local copy. - The eviction loop stops if the open list is empty. ### If possible, provide screenshots. N/A 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Bernard Laberge <bernard.laberge@autodesk.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
fix: RV leaks memory because of opened decoders
Summarize your change.
Describe the reason for the change.
Describe what you have tested and on which operating system.
Tested on CY 2025 on Rocky Linux 9.8 and Mac
Opened over 1000 clips with 1GB of caching, peaking at 9GB, but staying bounded.
RAM no longer increases when loading clips without playback being on.
Add a list of changes, and note any that might need special attention during the review.
avcodec_free_context, nullify the tracked pointer to not point to freed memoryNo regressions by adding the context map
If possible, provide screenshots.