[vlc-devel] [PATCH 00/13] Refactor SurfaceTexture for Android

Alexandre Janniaux ajanni at videolabs.io
Fri Jun 12 11:40:43 CEST 2020


Hi,

This patchset is the second step for Android refactor, generalizing
the work of Louis Régnier on SurfaceTexture to create them directly
in the core, regardless of the Android API version.

In the long term, it will bring three main benefits:

+ The JNI binding doesn't need to provide the SurfaceTexture anymore
  and thus doesn't need to create the current TextureView. This will
  be the case after this patchset.

+ The SurfaceTexture can be created by any clients, and in particular
  MediaCodec, which will stop needing a AWindow instance given through
  libvlc_media_player_set_android_context in the end (not this patchset
  though because of the AWindowHandler dependency) and the future
  GL implementation for GPU filters which was the initial push for this
  refactor.

+ In the future, we may provide single-buffered SurfaceTexture and
  reduce the amount of memory used on the phones for filters.

The patchset is divided in multiple steps:

+ patch 1 and 2 are reordering patches so as to avoid the forward
  declaration of most functions.

+ patch 3 refactors the current handling of SurfaceTexture (JNI, NDK)
  into a dedicated structure.

+ patch 4, 5, 6 are loading SurfaceTexture and Surface classes and
  constructors to be able to create SurfaceTexture with any API
  version.

+ patch 7 refactors the current SurfaceTexture creation in the case
  of NDK in order to generalize to JNI.

+ patch 8 does the actual generalization to all Android API instead
  of using a surface given by the JNI binding

+ patch 9 exposes the new SurfaceTexture API for creation and
  deletion, but introduce a hack to keep the "shared surface"
  behaviour while refactoring. It will be removed in last patch.

+ patch 10 switch MediaCodec to create the SurfaceTexture directly
  instead of relying on the SurfaceTexture in the AWindowHandler.

+ patch 11 removes some usage of the AWindowHandler where the
  SurfaceTexture object should be used.

+ patch 12 removes the now useless JNI SurfaceTexture AWindow wrapper

+ patch 13 cleans up previous hacks and remove any concept of
  SurfaceTexture from the public API of AWindowHandler.

Thank you for reviewing,

Regards,
--
Alexandre Janniaux
Videolabs


Alexandre Janniaux (13):
  android: utils: reorder android JNIEnv helper
  android: utils: reorder SurfaceTexture implementation
  android: utils: refactor SurfaceTexture handling
  android: utils: load SurfaceTexture constructors
  android: utils: load Surface JNI API
  android: utils: load SurfaceTexture JNI API
  android: utils: refactor creation of SurfaceTexture
  android: utils: extend vlc_asurfacetexture to all version
  android: utils: expose vlc_surfacetexture API
  mediacodec: create SurfaceTexture in decoder
  android: utils: switch from AWH to surfacetexture
  android: utils: remove AWindow SurfaceTexture functions
  android: utils: remove AWindow_SurfaceTexture

 modules/codec/omxil/mediacodec.c              |  38 +-
 modules/video_output/android/display.c        |   2 +-
 modules/video_output/android/utils.c          | 837 ++++++++++++------
 modules/video_output/android/utils.h          |  68 +-
 modules/video_output/opengl/interop_android.c |  11 +-
 5 files changed, 619 insertions(+), 337 deletions(-)

--
2.27.0


More information about the vlc-devel mailing list