Skip to content

fix: 1181 fix colorspace changes when session clear and fix memory leak with orphaned sessions#1182

Open
mcoliver wants to merge 2 commits intoAcademySoftwareFoundation:mainfrom
mcoliver:1181-fix-colorspace-changes-when-session-clear
Open

fix: 1181 fix colorspace changes when session clear and fix memory leak with orphaned sessions#1182
mcoliver wants to merge 2 commits intoAcademySoftwareFoundation:mainfrom
mcoliver:1181-fix-colorspace-changes-when-session-clear

Conversation

@mcoliver
Copy link
Contributor

@mcoliver mcoliver commented Mar 4, 2026

source_setup.py and ocio_source_setup.py scripts track whether a new Display Group has been created using a variable named _haveNewDisplayGroups. When you open OpenRV normally, this is configured correctly, and properties like sRGB output on the #RVDisplayColor node get activated. However, when you run File -> Clear, the C++ Session::clear() function destroys and immediately recreates the Display Group. The python scripts were failing to track this recreation because of missing event listeners.

When I loaded an MP4 file immediately after clearing the session, the C++ code successfully identified the MP4 as sRGB and enabled the RVLinearize step (darkening the image), but the python scripts skipped setting up the #RVDisplayColor node. Because #RVDisplayColor remained off, the linear image was never lifted back into display color space, rendering it way too dark.

I fixed this by adding an explicit listener for the after-clear-session event in both source_setup.py and ocio_source_setup.py. Now, immediately following a session clear, the internal Python flags are properly reset ensuring that the display color setup happens properly when the next file is loaded.

Also included a fix for a hardware memory leak. Every time you open an MP4 and then File -> Clear, OpenRV leaks a VideoToolbox hardware decoding session in macOS. Once you hit the macOS limit for concurrent hardware decoder sessions, FFmpeg will silently fail to allocate a new hardware decoder and fall back to the much slower software decoder (libx264). This fix frees up hardware decoding sessions so they can be available again.

Fixes #1181

Linked issues

Summarize your change.

Describe the reason for the change.

Describe what you have tested and on which operating system.

Add a list of changes, and note any that might need special attention during the review.

If possible, provide screenshots.

mcoliver added 2 commits March 3, 2026 17:20
…onal frame cleanup.

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
…cio_source_setup` plugins to reset internal states after session clear.

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
@mcoliver mcoliver marked this pull request as ready for review March 4, 2026 02:07
@bernie-laberge
Copy link
Contributor

Two great catches ! Thank you @mcoliver !
We'll make sure to fast track that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: When clearing a session, subsequent imports appear much darker

2 participants