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/
45 stars 8 forks source link

Program Freezes When using Dual Monitor #315

Open koko-DL opened 11 months ago

koko-DL commented 11 months ago

Describe the bug Program freezes (or drop at less than 0.03FPS) when using dual monitor and audio capture when recording. (Also, it seams memory leak is happenning)

Your Setup (please complete the following information):

To Reproduce Steps to reproduce the behavior:

  1. Clone the attached project based on Unity's HDRP demo (emailed)
  2. Open the scene "Char_Test.unity" under Assets(HDRP) Defender - Character Demo\Scenes
  3. Press "Play" button to play the scene
  4. Press the "Do something" button on the game screen for several times
  5. Wait a while after "Do something" finished, and notice the FPS will not come back, Editor freezes

Logs N/A

Screenshots N/A

Videos N/A

koko-DL commented 10 months ago

Hi, is there any update on this issue?

RichRH commented 10 months ago

Hi @koko-DL,

Thanks for sending your test scene - I see you're sleeping the main thread for 3 seconds which in turn blocks any new frames being rendered/sent to the video encoder, but as Unity's audio is on another thread it is still amassing samples. Then when the main thread unblocks the mismatched data is causing the low-level video encoder to massively stall to attempt to re-sync.

We're looking at a possible solution that may avoid the stalls in this scenario but fundamentally blocking the main thread is unadvised (yielding, coroutines etc.. are better).

Cheers,

koko-DL commented 10 months ago

Hi, thank you for your reply.

In the sample project, I sleep in the main thread to simulate the condition that reproduces the issue. However, in our real project, it only occurs when switching scenes. Additionally, we are using coroutines with yield instructions to prevent main thread blocks.

Our project is intended to run on a console for several days, so freezing is a critical problem. It would be acceptable for us if the stalls and memory leaks can be resolved, even if the recording result is not satisfactory in this condition.

stale[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.