Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix screenshot cache contains many large files, #4899 #4903

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

low-batt
Copy link
Contributor

This commit will change the screenshotCallback method in PlayerCore to remove the cached screenshot file when not displaying a preview.


Description:

This commit will change the screenshotCallback method in PlayerCore to
remove the cached screenshot file when not displaying a preview.
@low-batt low-batt linked an issue Apr 28, 2024 that may be closed by this pull request
1 task
@low-batt low-batt requested a review from uiryuu April 28, 2024 18:54
@svobs
Copy link
Contributor

svobs commented May 2, 2024

Could use a defer after initing lastScreenshotURL, instead of duplicating the code 3 times, like so:

    defer {
      if !saveToFile {
        try? FileManager.default.removeItem(at: lastScreenshotURL)
      }
    }

@low-batt
Copy link
Contributor Author

low-batt commented May 3, 2024

I did not do that because I was worried that there was a reason the current code retains the file until all operations have completed. Since currently that happens asynchronously, deleting the file when exiting the method would create a race condition if there is a reason it must be retained until after it has been sent to the OSD.

How threading is handled between PlayerCore and MPVController is being refactored for the feature release. That will eliminate the "split processing" where some work occurs on the thread MPVController uses to read events and the main thread. This will simplify some of this code.

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.

Screenshot cache contains many large files
2 participants