rustdesk icon indicating copy to clipboard operation
rustdesk copied to clipboard

Feat/mediacodec

Open Kayuii opened this issue 2 years ago • 11 comments

Enable the hardware decoding of vp9 and vp8 in mediacodec, and extract the decoding thread.

Kayuii avatar Jun 25 '23 05:06 Kayuii

Good job. Yes, hardware decoding does not have better performance regarding speed, depends on gpu/cpu memory copy performance. Can you furtherly improve this by send GPU decoded frame to the frontend texture directly? You can discuss with @21pages

rustdesk avatar Jun 25 '23 07:06 rustdesk

Great job! Here is a project you can refer to to display the data directly through the gpu without going through the cpu. https://github.com/alexmercerind/media_kit

If there is any problem with the implementation, you can email me, [email protected], or post on this pr.

21pages avatar Jun 25 '23 07:06 21pages

Only work on api-level-30?

rustdesk avatar Jun 26 '23 04:06 rustdesk

android > api-level-26 I haven't found a way to do GPU rendering in the container yet. Alvr proposed a method of using Vulkan API to utilize GPU rendering, but I still don't understand that approach.

Kayuii avatar Jun 26 '23 08:06 Kayuii

irondash In the Irondash project, they solved it by directly rendering the textures inside the container, I also refered to their approach but didn't implement successfully.

Kayuii avatar Jun 26 '23 08:06 Kayuii

Only work on api-level-30?

It can reach API level 26, some features have been tested previously.

Kayuii avatar Jun 26 '23 08:06 Kayuii

https://github.com/irondash/irondash/blob/277f621a78b3121e0f3ad31e720117ef8fc3fbf7/texture/src/lib.rs#L20 https://github.com/irondash/irondash/blob/277f621a78b3121e0f3ad31e720117ef8fc3fbf7/texture/src/lib.rs#L118 I think there should be a way to convert yuv to bgra in gpu, chatgpt tells that OpenGL ES can do that, or decode vp8/vp9 into surface.

21pages avatar Jun 26 '23 08:06 21pages

Only work on api-level-30?

It can reach API level 26, some features have been tested previously.

Can the apk be installed on devices under API level 26 ?

rustdesk avatar Jun 26 '23 08:06 rustdesk

Only work on api-level-30?

It can reach API level 26, some features have been tested previously.

Can the apk be installed on devices under API level 26 ?

It cannot be used below API level 26, because it uses the ImageReader class, which requires API level 26 support.

Kayuii avatar Jun 26 '23 09:06 Kayuii

Only work on api-level-30?

It can reach API level 26, some features have been tested previously.

Can the apk be installed on devices under API level 26 ?

It cannot be used below API level 26, because it uses the ImageReader class, which requires API level 26 support.

Thanks, got it.

rustdesk avatar Jun 26 '23 09:06 rustdesk

@Kayuii do you have interest continue working on this? directly rendering the textures.

Though we do not release this as default apk, but we can release addtional apk with this feature on.

rustdesk avatar Sep 25 '23 06:09 rustdesk