RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
48 stars 8 forks source link

Add failure status to FileWritingHandler (or elsewhere in API) #123

Open artoonie opened 3 years ago

artoonie commented 3 years ago

Is your feature request related to a problem? Please describe. Sometimes file writing fails. The only way to detect this is to check for the existence of the file.

In particular, I occasionally get the error:

[Plugin] 🟩 Capture failed, error: The operation could not be completed
[Plugin] 🟩 Underlying error: The operation couldn’t be completed. (OSStatus error -16356.)
[Plugin] 🔹 Finished writing
[Plugin] 🟩 Failed to remove temp files directory

While I'd love this issue to be fixed, I don't yet have a reproducible test case. I'd say around 5% of recordings fail in this manner. Until I can get you a better bug report on that, I'd at least like the API to tell me programmatically when this happens (rather than just logging it).

Describe the solution you'd like In addition to FileWritingHandler. IsFileReady(), it would be nice to have FileWritingHandler.DidFileWriteSucceed() or GetErrors or similar.

Describe alternatives you've considered Use System.IO.File.Exists(), but this scares me because there could be a race condition (e.g. RenderHeads thinks the file has been written, but it hasn't flushed yet and a different thread checks .Exists(), which returns a false negative).

Additional context Again, the underlying issue is the frequency at which file writes fail - and I'm working on finding a reproducible test case for that.

AndrewRH commented 3 years ago

Hi, which platform is this on?

artoonie commented 3 years ago

The failures happen on iOS, though i don’t have much insight into that yet. It is possibly related to #125, though that is a hard crash whereas this is a silent failure, so I'm not convinced they share a root cause.