UnityPlugin-AVProMovieCapture icon indicating copy to clipboard operation
UnityPlugin-AVProMovieCapture copied to clipboard

CompletedFileWritingAction never called

Open jiaming233 opened this issue 2 years ago • 8 comments

Describe the bug CompletedFileWritingAction never called after screenCapture.StopCapture(); NativePlugin.IsFileWritingComplete(_handle) always return false

Your Setup (please complete the following information):

  • Unity version: Unity2020.3.29f1
  • AVPro Movie Capture version: version: 5.0.2 (plugin v5.0.0f1-trial)
  • Operating system version: Windows 10 (10.0.19045) 64bit
  • Capture component used: CaptureFromScreen
  • Capture settings (resolution, frame-rate, codec): default value

To Reproduce Set _minimumDiskSpaceMB almost close to disk space, and call StopCapture(true) automaticlly when there is no enough space

private void CheckFreeDiskSpace() { if (_minimumDiskSpaceMB > 0) { if (!IsEnoughDiskSpace()) { Debug.LogWarning("[AVProMovieCapture] Free disk space getting too low. Stopping capture."); StopCapture(true); } } }

Logs [16:18:45]info:[AVProMovieCapture] Stopping capture 0 UnityEngine.Debug:Log (object) RenderHeads.Media.AVProMovieCapture.CaptureBase:StopCapture (bool,bool,bool) (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:2643) RenderHeads.Media.AVProMovieCapture.CaptureBase:CheckFreeDiskSpace () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:3002) RenderHeads.Media.AVProMovieCapture.CaptureBase:LateUpdate () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:2927)

[16:20:49]info:[AVProMovieCapture] IsFileWritingComplete False UnityEngine.Debug:Log (object) RenderHeads.Media.AVProMovieCapture.FileWritingHandler:IsFileReady () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/FileWritingHandler.cs:75) RenderHeads.Media.AVProMovieCapture.CaptureBase:RemoveCompletedFileWrites () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:2985) RenderHeads.Media.AVProMovieCapture.CaptureBase:LateUpdate () (at Assets/SDK/RenderHeads/AVProMovieCapture/Runtime/Scripts/Internal/CaptureBase.cs:2940)

....endlesss "IsFileWritingComplete False"

jiaming233 avatar May 25 '23 08:05 jiaming233

Please try updating to the latest version

MorrisRH avatar May 25 '23 11:05 MorrisRH

Please try updating to the latest version

It still occurs with lastest version 5.1.6, running Demo00-ScreenCapture.

For test, I left 12MB in my disk and set _minimumDiskSpaceMB as 10. Then I start capture, when the video file size hit 2 ~ 3MB, StopCapture called, but sometimes the file will never be completed. And then if I click "Play" in Unity Editor to quit, the Editor freeze.

Editor.log

jiaming233 avatar May 26 '23 07:05 jiaming233

Having same issue on iOS.

OzanUst-M avatar Jun 06 '23 11:06 OzanUst-M

@jiaming233, So we think that this is possibly due to post-processing options being enables (such as fast-start), which require copying the file. If you're short of disk space then the copy will fail. So we need to look into how to stop it from locking. Perhaps fail any post processing if disk space is not sufficient.

@OzanUst-M, _minimumDiskSpaceMB is Windows only; it isn't an option on iOS. So it can't be the same issue.

Chris-RH avatar Jun 09 '23 09:06 Chris-RH

Thanks for reply!

I try to disable post operations by commenting following lines in CaptureBase, which didn't work if (_outputTarget == OutputTarget.VideoFile) { applyPostOperations = true; }

Waiting for new release : )

jiaming233 avatar Jun 12 '23 02:06 jiaming233

I made these 2 modifications and the problem have not been reproduced for now. Just for reference.

1 2

jiaming233 avatar Jun 12 '23 02:06 jiaming233

@jiaming233, So we think that this is possibly due to post-processing options being enables (such as fast-start), which require copying the file. If you're short of disk space then the copy will fail. So we need to look into how to stop it from locking. Perhaps fail any post processing if disk space is not sufficient.

@OzanUst-M, _minimumDiskSpaceMB is Windows only; it isn't an option on iOS. So it can't be the same issue.

I was talking about CompletedFileWritingAction being never called. It never happens after video recording is done and file is ready to share.

OzanUst-M avatar Jun 12 '23 08:06 OzanUst-M

@OzanUst-M that is a completely different issue then. Could you open a new issue with all of your details please.

Chris-RH avatar Jun 12 '23 09:06 Chris-RH

Closing this ticket as a workaround to the original issue has been provided (first parameter of 'StopCapture()' should be 'false', not 'true') and it's a duplicate of https://github.com/RenderHeads/UnityPlugin-AVProMovieCapture/issues/343 (further information there).

Cheers,

RichRH avatar Aug 02 '24 11:08 RichRH