[Windows]The packaged crashes after long-term operation due to frequent creation and destruction of MediaPlayer instances.
Summary
I have a requirement in the project to periodically switch the current monitoring screen that is being played. Therefore, it is necessary to frequently create and destroy MediaPlayer instances in the code. After a long period of operation (duration not fixed, could be several hours or one or two days), the software crashes. And last but not least,url type was RTSP.
Minimal project and steps to reproduce
Project and Package already sent to your Email(martin@videolabs.io),Plz check it out. FYI,in the actual environment, surveillance real-time videos are played using the RTSP protocol. However, since surveillance real-time videos can only be played locally(Unable to play on the external network), the project can only be reproduced by modifying it to play local videos(Files From StreamingAssets).
What is the current bug behavior?
crashes after a long period of operation
What is the expected correct behavior?
Even when frequently creating and destroying MediaPlayer instances, the software can run robustly for a long time without crashing.
Does it work on other plaforms? Does it work with the official VLC apps?
Currently, this issue has only been observed(test) on the Windows platform. VLC versions that have been tested include 0.1.7 and lower, all of which exhibit this behavior.
Relevant logs and/or screenshots
Crashlog: Crashes.zip Player.log Player-prev.log
Environment
- OS: Windows10 DESKTOP
- Version: UnityVersion2021.3.1
- Device: Windows10 DESKTOP (Intel(R) Core(TM) i7-9700F CPU @ 3.00GHz 3.00 GHz/RAM 32.0 GB)
- LibVLC version and architecture: 4.0.0-dev-22482-g4cca6109e2
- LibVLCSharp version: 4.0.0.0
- VLC Unity plugin version: VLC for Unity Windows 0.1.7(Or Lower)
- Scripting backend used: Mono
Possible fixes
I have tested it many times, and there is a crash every time. This is fatal for a project that frequently switches play links and runs for a long time. I suspect that when creating and destroying MediaPlayer instances frequently, even if Stop and Dispose are called like in the usage example, the memory is not actually released. Because with each link switch, the computer memory usage gradually increases (even if it occasionally drops, it eventually reaches a memory threshold), leading to a crash.