[vlc-devel] [PATCHv2 00/14] Refactor SurfaceTexture for Android

Alexandre Janniaux ajanni at videolabs.io
Wed Jun 24 15:14:24 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.

Note that in this second patchset, vlc_asurfacetexture is already
mostly independent of AWindowHandler, but still has the dependency
on JNI fields. So next patchset will make it independant.

Changes since patchset v1:

+ rename SurfaceTextureHandle into vlc_asurfacetexture_priv
+ use jobject for jsurface instead of void*
+ jfields loaded from InitJniFields instead of AWH, but release
  still handled the previous way with AWindowHandler deletion.
  This will get refactored in a next patchet.
+ using GET_METHOD instead of custom loading, in order
  to check exceptions too.
+ vlc_asurfacetexture_New null checks in mediacodec and check
  in the function itself.
+ typo fixes

Not done:
+ refactor of SurfaceTexture creation in a function

I considered it could be done later if needed as this makes
the SurfaceTexture creation function harder to write otherwise.

Alexandre Janniaux (14):
  android: utils: reorder android JNIEnv helper
  android: utils: reorder SurfaceTexture implementation
  android: utils: refactor SurfaceTexture handling
  android: utils: refactor GET_METHOD usage
  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              |  44 +-
 modules/video_output/android/display.c        |   2 +-
 modules/video_output/android/utils.c          | 878 ++++++++++++------
 modules/video_output/android/utils.h          |  68 +-
 modules/video_output/opengl/interop_android.c |  11 +-
 5 files changed, 654 insertions(+), 349 deletions(-)

--
2.27.0


More information about the vlc-devel mailing list