android: util: use NDK ASurfaceTexture API if available
commit7d6c996a75f56b25d3a1b9ca5eace981ffa11bf8
authorLouis Regnier <louis@videolabs.io>
Thu, 23 Apr 2020 21:14:51 +0000 (23 23:14 +0200)
committerThomas Guillem <thomas@gllm.fr>
Tue, 5 May 2020 13:45:52 +0000 (5 15:45 +0200)
tree656e5e763a268e2b49a5563f60e287d4f6a2a50c
parentd36fd20d3e23c3a00250ce6e22138d8397de3527
android: util: use NDK ASurfaceTexture API if available

When the native SurfaceTexture API is available, construct a SurfaceTexture
object from Java through JNI calls and store the producer side
(Surface/ANativeWindow) for the AWindowHandler clients.

The SurfaceTexture constructor is only available since API 26 but the NDK
API for ASurfaceTexture already require API 28

To use new native functions, we wrap ASurfaceTextureAPI structure pointers
inside a new set of native functions, it allow to describe some specifics
behaviors for the NDK API.

If the NDK API requierements are met, native functions for ASurfaceTexture are
used instead of their JNI counterpart. The behavior change is made through the
SurfaceTextureHandler pointer structure.

Then, in all cases, wrap pointers of SurfaceTextureHandler in a common functions
used by OpenGL to attach / update / detach textures.

fixes #20344

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
modules/video_output/android/utils.c
modules/video_output/android/utils.h
modules/video_output/opengl/interop_android.c