RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
224 stars 27 forks source link

Some android devices not working on vulkan api #1869

Closed NieYanzhe closed 1 week ago

NieYanzhe commented 1 month ago

Describe the issue Importing the UnityPlugin-AVProVideo-v3.0.1-Trial.unitypackage can cause the game to not work. I don't use any avpro components.

Your Setup (please complete the following information):

To Reproduce

  1. New Project

  2. Switch Android Platform

  3. Import UnityPlugin-AVProVideo-v3.0.1-Trial.unitypackage

  4. Modify Player Settings

    • Auto Graphics Api: false
    • Graphics APIs: remove OpenGL ES3(only Vulkan)
    • Target API Level: Android 13.0(API level 33)
    • Scripting backend: IL2CPP
    • Api Compatibility Level: .NET Framework
  5. Build Android APK and Run it

Screenshots image

Chris-RH commented 1 month ago

So are you saying that it is not running in a new project with nothing else in it at all other than AVPro? Are you using SRP, URP or HDRP? Have you tried mono? Can you provide a full logcat please?

NieYanzhe commented 1 month ago

So are you saying that it is not running in a new project with nothing else in it at all other than AVPro? Are you using SRP, URP or HDRP? Have you tried mono? Can you provide a full logcat please?

Yes. Just imported AVPro. And a sample scene (skybox and camera and lighting without modify) I didn't even use any video component.

Built-In and URP are same result.

This logcat is Built-In. UnityLogcat.log AndroidStudioAll.log

NieYanzhe commented 1 month ago

So are you saying that it is not running in a new project with nothing else in it at all other than AVPro? Are you using SRP, URP or HDRP? Have you tried mono? Can you provide a full logcat please?

mono is same result.

I suspect that some code or shaders in the plugin are causing Vulkan initialization to fail.

Chris-RH commented 1 month ago

What happens when you use a new project and run the AVPro Video mediaplayer demo scene?

NieYanzhe commented 1 month ago

What happens when you use a new project and run the AVPro Video mediaplayer demo scene?

Nothing will happen.Because the render pipeline is broken. Vulkan is failed

NieYanzhe commented 1 month ago

@Chris-RH Maybe Android 9 is not support.

These devices have the same result。

And Huawei P smart 2019(POT-LX1) crash

Chris-RH commented 1 month ago

hmm, interesting that these are all Adreno GPUs. I wonder if there is an issue with their vulkan driver?

Can you provide full logcats for the devices that are having errors please Are there devices that you have tested that are not having issues?

NieYanzhe commented 1 month ago

hmm, interesting that these are all Adreno GPUs. I wonder if there is an issue with their vulkan driver?

Can you provide full logcats for the devices that are having errors please Are there devices that you have tested that are not having issues?

I tested some other Adreno GPU devices and didn't have this issue. if Android version greater than 9 is well. If Android version is equal or lesser than 9 is not working.

These devices should have no issues with Vulkan driver because building an empty project works well.

I tested these devices are well.

I tested new devices(Android version is 9) that are not working.These full logcats for the devices that are having errors OnePlus 3T-logcat.log Redmi 7-logcat.log

NieYanzhe commented 1 month ago

Hi @Chris-RH , do you have any update

NieYanzhe commented 1 month ago

I think the issue is due to the lack of the VK_EXT_queue_family_foreign extension.

Android 10 has this extensions log.

[Vulkan init] extensions: name=VK_EXT_queue_family_foreign [enabled=1, external=0]

But in Android 9 does not contain the log

Chris-RH commented 1 month ago

I don't have an android 9 device to hand, so will have to wait to see what is in the office next week.

Are you able to use Unity Videoplayer on these devices, or do you get the same errors?

NieYanzhe commented 1 month ago

I don't have an android 9 device to hand, so will have to wait to see what is in the office next week.

Are you able to use Unity Videoplayer on these devices, or do you get the same errors?

Unity Videoplayer does not have this issue.

Ste-RH commented 2 weeks ago

We fixed a Vulkan issue in v3.0.2. Could you update to this version and re-test to see if you still see the issue @NieYanzhe ?

NieYanzhe commented 2 weeks ago

We fixed a Vulkan issue in v3.0.2. Could you update to this version and re-test to see if you still see the issue @NieYanzhe ?

Still the same result, still unable to run properly.

image

I attach the log files: samsung-SM-N960U-Android-9_2024-06-13_162345.log

MorrisRH commented 2 weeks ago

Unfortunately the devices you're testing on do not support the Vulkan extensions we require in order to be able to decode frames from a video directly into a buffer we can use. We specifically require the extension VK_ANDROID_external_memory_android_hardware_buffer (which is dependent on the extension VK_EXT_queue_family_foreign which is what you were seeing in the log).

As a result of this the Vulkan initialisation is failing and Unity is falling back onto the next available graphics API. Because you have not included OpenGLES3 in the list of supported APIs Unity is jumping straight down to OpenGLES2 which we do not support with AVProVideo.

You need to add OpenGLES3 into the list of supported APIs in order for AVPro Video to work with these older devices (make sure to keep Vulkan as the first item if that is the API you would prefer to use).