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

Random crash on video loop

Open heritageint opened this issue 2 years ago • 86 comments

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Describe the issue Have a simple text program that loads a short video (10 seconds) from StreamingAssets folder and plays continually on loop - application is crashing (no MediaPlayerEvent or errors) after a random amount of time, sometimes under 10 minutes, sometimes over 90 minutes.

We've added a timecode to the video itself and is always crashing on the last frame of the video so assume it's hanging when trying to loop.

There does look to be a very small memory leak on each loop, but is crashing whilst still well within capacity.

Tested on multiple specs of PC.

Your Setup (please complete the following information):

  • Unity version: 2022.3.4f1
  • AVPro Video version (number and edition (trial/core/ultra/enterprise)): Core 2.9.0
  • Operating system version: Win 11
  • Device model: i7-13700K 32GB RAM RTX 3060
  • Video specs (resolution, frame-rate, codec, file size): 1920x1080 30FPS .MP4 1MB

To Reproduce

  1. Add MediaPlayer and set to loop,
  2. Load video via StreamingAssets
  3. Play Video

Logs If applicable, add error logs to help explain your problem.

Screenshots If applicable, add screenshots to help explain your problem.

Videos If applicable, add a copy of your video or the URL

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Instead email the link to us [email protected]

heritageint avatar Nov 17 '23 14:11 heritageint

Is this under Media Foundation, DirectShow or WinRT API?

Chris-RH avatar Nov 17 '23 14:11 Chris-RH

Media Foundation

heritageint avatar Nov 17 '23 14:11 heritageint

OK, and to confirm, is it D3D12?

Chris-RH avatar Nov 17 '23 14:11 Chris-RH

D3D11

heritageint avatar Nov 17 '23 15:11 heritageint

Repeatable using the mediaplayer demo scene in Unity editor?

Chris-RH avatar Nov 17 '23 15:11 Chris-RH

We've got our sample app running on test (will try the mediaplayer demo after this has completed) - running the original app in the Editor has been running fine for over 3.5 hours, running the original app with a replacement video (removed last two frames to make exactly 10 seconds long) has been running fine for 1.45 hours, so possibly the video file was causing the problem, but will update you if/when they crash.

heritageint avatar Nov 17 '23 19:11 heritageint

Running the MediaPlayer demo (no changes to project, using RH video) on the client PC (Intel Nuc 11 TNKi3 - 8GB RAM) it crashed after approx. 6 hours. - in all versions of our sample app, and the mediaplayer demo, the crash appears to happen at the loop point (end of the video)

heritageint avatar Nov 21 '23 16:11 heritageint

We have ran old applications using Unity 2021.3.23f1 and AVPro Core 2.8.0 on the Intel NUC that crashed previously and no problems (ran over 24 hours) - we can produce a stripped down sample app that just loads a video and loops to test if an issue has been introduced by newer versions of Unity or AVPro, as it doesn't seem to be the PC itself?

heritageint avatar Nov 24 '23 14:11 heritageint

Hmmm, that's interesting. After 2.8.0, 2.8.2 had the most changes for Windows and is most likely where the error may have started.

Chris-RH avatar Nov 27 '23 09:11 Chris-RH

Do you have a link to V2.8.0 that I could run on test in our sample app, to confirm if that is the issue? We need to find a solution quickly as installing next week.

heritageint avatar Nov 29 '23 10:11 heritageint

All the trial version are available here: https://github.com/RenderHeads/UnityPlugin-AVProVideo/releases

Chris-RH avatar Nov 29 '23 11:11 Chris-RH

Sample app with V2.8.0 has been running solidly for over 21 hours now, so assume an issue was introduced after this version? Please advise how we can target the Release version of 2.8.0 to allow us to publish our application without the Trial version overlay?

There is occasionally a noticeable lag when the loop occurs in this version, which is obviously preferrable to the software crashing, but perhaps the old version makes multiple attempts to loop (if the first fails) and the later version hangs?

heritageint avatar Nov 30 '23 09:11 heritageint

hmm, that's interesting. Thanks for checking. Please can you email us your Unity invoice pdf to [email protected], ideally from the same email account that is on the invoice :)

Chris-RH avatar Nov 30 '23 10:11 Chris-RH

Hi Chris

I sent our invoice last week as requested - I really need to wrap this up today (being able to build with v 2.8) as we're installing tomorrow morning

  • could you chase this up?

Cheers

Bill

heritageint avatar Dec 04 '23 09:12 heritageint

email replied to :)

Chris-RH avatar Dec 04 '23 10:12 Chris-RH

I just wanted to check. is it working again properly with the package that you were sent?

Chris-RH avatar Dec 07 '23 10:12 Chris-RH

Yes. Been running solidly.

On Thu, 7 Dec 2023 at 10:07, Chris-RH @.***> wrote:

I just wanted to check. is it working again properly with the package that you were sent?

— Reply to this email directly, view it on GitHub https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1692#issuecomment-1845049104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZRWV5MFQBGQQ3K2O5ZWI2TYIGINJAVCNFSM6AAAAAA7P4ZJUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBVGA2DSMJQGQ . You are receiving this because you authored the thread.Message ID: @.***>

heritageint avatar Dec 07 '23 10:12 heritageint

Can you confirm this is a bug with 2.9 and it will be addressed, so we can use the latest version in future projects, as will keep using 2.8 for now?

heritageint avatar Dec 11 '23 11:12 heritageint

Is there an update on whether this was a bug with 2.9 and if/when will be fixed?

heritageint avatar Jan 18 '24 12:01 heritageint

We'll update this thread once its fixed and let you know which version that will be :)

Chris-RH avatar Jan 18 '24 12:01 Chris-RH

Has there been any progress with this bug? We've just tried again with AVProCore 2.9.3 and even manually looping a video (waiting for FinishedPlaying event and rewinding) it is still causing a sample app (launches and plays a video from StreamingAssets on loop) to crash in under an hour - no errors are logged but crashes after the FinishedPlaying event - we really need a resolution to this as soon as possible as causing issues with released applications.

heritageint avatar Mar 14 '24 20:03 heritageint

Hi @heritageint,

We've recently used AVPro Video (2.9.1 - Media Foundation / Hardware) for one of our client projects which involved a lot of looping (and seeking) and didn't encounter any issues whilst soaking/running live for days.

Would you be able to send your test video to us to see if it makes a difference/we can reproduce it? [email protected]

Cheers,

RichRH avatar Mar 15 '24 10:03 RichRH

I encountered the same issue. I initially used version 2.8.0. When running for a long time, the memory occupied would increase rapidly, eventually causing the application to crash. Looking at Unity's Profiler, we found that the increase in memory in the untrack part was the main reason. So I tested 2.8.5/2.9.3 and the latest 3.0.0 version. These versions no longer have the above memory problem, but the application will still crash after a long period of operation. I've found a strong correlation between this and the number of playback loops. When using version 3.0.0, using MediaFoundation playback, approximately 2800-3200 loops can be played; when using WinRT, approximately 1900-2200 loops can be played. Whether I use one MediaPlayer or multiple MediaPlayers, the results are basically the same.

TatsuyaPan avatar Mar 20 '24 06:03 TatsuyaPan

That's interesting to know. Do you get crashes under DirectShow as well?

Chris-RH avatar Mar 20 '24 10:03 Chris-RH

That's interesting to know. Do you get crashes under DirectShow as well?

I tested DirectShow with 2.8.0 before try 2.9.x or 3.0.x, got crashes too.

I tried 1 MediaPlayer last night from 6:30pm to 9:30am. It took 4245 loops without crash. But the memory issue came back, my application ate over 10GB memory, total system memory over 94%. AVPro Video v2.9.3-Trail.

TatsuyaPan avatar Mar 21 '24 01:03 TatsuyaPan

Thank you, that's super helpful :)

Chris-RH avatar Mar 21 '24 09:03 Chris-RH

HI @heritageint,

Thanks for sending your test video/scene through - as a quick update I've been soak testing it overnight and haven't yet encountered a crash but have come back to it in a state where it's still running but Media Foundation (Hardware) for some reason isn't returning any new frames.. unless I pause/unpause the editor and it continues as per normal.

I'll try and get to the bottom of it but might take a bit of time given the nature/reproduction requirements of the issue!

Cheers,

RichRH avatar Mar 26 '24 10:03 RichRH

Hi Rich

Just to clarify, I don't believe we've encountered the issue whilst in the Editor, but when built (Windows .exe) it is reliably crashing the application - having just tried it again on a low spec PC (Intel NUC i3 8GB RAM) it only takes about an hour to crash - memory stays static at 30%, GPU at 37%, CPU at 12% - with values staying the same for all apart from the GPU which drops to 0 at the time of the crash.

Cheers

heritageint avatar Mar 26 '24 11:03 heritageint

Ok, thanks for the confirmation @heritageint - I'll try and get a debug build setup to see if I can catch it..

Cheers,

RichRH avatar Mar 26 '24 12:03 RichRH

Hi @heritageint,

Quick update - it's been running all night as a debug build in soak test without issue (memory is also fine - ~60MB). I am running latest code though (equivalent of the unreleased 2.9.4/newly released 3.0.x) - just wanted to check if you've tried v3? (Trial I think should be fine)

Cheers,

RichRH avatar Mar 27 '24 09:03 RichRH