[vlc-devel] [PATCH 16/17] mediacodec: use SurfaceTexture as fallback

Alexandre Janniaux ajanni at videolabs.io
Wed Jan 13 11:07:29 UTC 2021


If we fail to load pass-through, provide SurfaceTexture buffers instead.
---
 modules/codec/omxil/mediacodec.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 4469e73e33..924c3f15ae 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -663,16 +663,7 @@ CreateVideoContext(decoder_t *p_dec)
      || !AWindowHandler_canSetVideoLayout(awh)
      || !has_subtitle_surface;
 
-    if (use_surfacetexture)
-    {
-        p_sys->video.surfacetexture = vlc_asurfacetexture_New(awh, false);
-        assert(p_sys->video.surfacetexture);
-        if (p_sys->video.surfacetexture == NULL)
-            goto error;
-        p_sys->video.p_surface = p_sys->video.surfacetexture->window;
-        p_sys->video.p_jsurface = p_sys->video.surfacetexture->jsurface;
-    }
-    else
+    if (!use_surfacetexture)
     {
         p_sys->video.p_surface = AWindowHandler_getANativeWindow(awh, AWindow_Video);
         p_sys->video.p_jsurface = AWindowHandler_getSurface(awh, AWindow_Video);
@@ -684,6 +675,16 @@ CreateVideoContext(decoder_t *p_dec)
         }
     }
 
+    if (use_surfacetexture || p_sys->video.p_surface == NULL)
+    {
+        p_sys->video.surfacetexture = vlc_asurfacetexture_New(awh, false);
+        assert(p_sys->video.surfacetexture);
+        if (p_sys->video.surfacetexture == NULL)
+            goto error;
+        p_sys->video.p_surface = p_sys->video.surfacetexture->window;
+        p_sys->video.p_jsurface = p_sys->video.surfacetexture->jsurface;
+    }
+
     static const struct vlc_video_context_operations ops =
     {
         .destroy = CleanFromVideoContext,
-- 
2.30.0



More information about the vlc-devel mailing list