-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use media kit as the default video playback for windows #29
Conversation
packages/unity_video_player/unity_video_player_media_kit/lib/unity_video_player_media_kit.dart
Show resolved
Hide resolved
I will keep this as a draft because it's causing crashes to the app. ¹ For some reason, it seems it's blocking the UI thread, so app behaves extremely slow. Sometimes, it's unusable |
The video rendering does occur on render thread. A "hit" due to multiple videos will definitely be there (should improve in release mode). If there are no videos in the view, there should be no frame drops/delays etc. Crash: There shouldn't be any crashes on Windows. I & other users have confirmed the recent fix which addressed last few race(s). There are a number of cases/situations in the test application where we haven't been able to see any crash since latest fixes. As for any crash, let's see what further feedback I get. Personally, I'm unable to. Performance: There isn't any scope of improvement in terms of performance AFAIK. In comparison to package:dart_vlc, the performance offered by package:media_kit is already very-high. Everything is being rendered off the GPU. |
@alexmercerind I know you are busy, when you have time can you review this PR? It's blocking #31 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (+ recommendations) !
You can try use the current package:media_kit branch that I'm working on.
https://github.com/alexmercerind/media_kit/tree/perf/win32-copy-separate-id3d11texture2d
The level of performance should be further improved as compared to main
branch. There are few more performance improvements which I'd like to make, however I won't be able to get this branch/PR over the line before this month (though it's usable in current state).
As far as media-kit/media-kit#28 is concerned, I don't think it will ever be. You have to create your own solution here. Primarily because libmpv does not offer such functionality out-of-the-box & implementing one from scratch will be:
- Redundant.
- Requiring more maintenance cost.
- Of different level of abstraction than that of package:media_kit (if custom implementation is made).
100% of implementation of package:media_kit is in pure Dart, only video rendering is platforms specific C/C++.
You're free to play around.
There seems to be a minor flickering when reordering the views in the multiple view.
I see the last commit with ValueKey
, that should improve IG. I'm not sure however.
One final recommendation I'd like to give is that you can try to specify width
& height
parameters in the VideoController.create
method. It will create a less sized D3D Texture / EGLSurface (and thus squeeze the performance).
Especially in grid layouts, where video won't be visible in large sizes, a fixed width
& height
texture will work & take less resources. However, when viewing same camera on larger screen, a different VideoController
without fixed width
& height
can be used (& disposed upon exit).
Indeed. By doing that, I got a ~15% performance improvement |
I could experience gains of 30% to 40% in performance by using
media_kit
on WindowsFeatures
Screenshots
There seems to be a minor flickering when reordering the views in the multiple view