[vlc-commits] mediacodec: use SurfaceTexture as fallback

Alexandre Janniaux git at videolan.org
Thu Jan 14 09:41:07 UTC 2021


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Wed Jan 13 12:07:29 2021 +0100| [0cb23fd42fbfde786467da6250a29cef1c2f31bb] | committer: Alexandre Janniaux

mediacodec: use SurfaceTexture as fallback

If we fail to load pass-through, provide SurfaceTexture buffers instead.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0cb23fd42fbfde786467da6250a29cef1c2f31bb
---

 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,



More information about the vlc-commits mailing list