[vlc-commits] vout/android: vout_display_sys_t only needed for sw buffers

Thomas Guillem git at videolan.org
Mon Dec 19 12:06:43 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Dec 15 13:02:10 2016 +0100| [ef68d7861116a7c5d87e752fa8e1430c27d8eea8] | committer: Thomas Guillem

vout/android: vout_display_sys_t only needed for sw buffers

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

 modules/video_output/android/display.c |  8 +++++---
 modules/video_output/android/display.h | 10 +++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index b62ee29..7c5bbd1 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -188,19 +188,21 @@ static picture_t *PictureAlloc(vout_display_sys_t *sys, video_format_t *fmt,
     if (unlikely(p_picsys == NULL))
         return NULL;
 
-    p_picsys->p_vd_sys = sys;
 
     memset(&rsc, 0, sizeof(picture_resource_t));
     rsc.p_sys = p_picsys;
 
     if (b_opaque)
     {
+        p_picsys->hw.b_vd_ref = true;
         p_picsys->hw.p_surface = sys->p_window->p_surface;
         p_picsys->hw.p_jsurface =  sys->p_window->p_jsurface;
         p_picsys->hw.i_index = -1;
         vlc_mutex_init(&p_picsys->hw.lock);
         rsc.pf_destroy = AndroidOpaquePicture_DetachVout;
     }
+    else
+        p_picsys->sw.p_vd_sys = sys;
 
     p_pic = picture_NewFromResource(fmt, &rsc);
     if (!p_pic)
@@ -782,7 +784,7 @@ static void Close(vlc_object_t *p_this)
 static int PoolLockPicture(picture_t *p_pic)
 {
     picture_sys_t *p_picsys = p_pic->p_sys;
-    vout_display_sys_t *sys = p_picsys->p_vd_sys;
+    vout_display_sys_t *sys = p_picsys->sw.p_vd_sys;
 
     if (AndroidWindow_LockPicture(sys, sys->p_window, p_pic) != 0)
         return -1;
@@ -793,7 +795,7 @@ static int PoolLockPicture(picture_t *p_pic)
 static void PoolUnlockPicture(picture_t *p_pic)
 {
     picture_sys_t *p_picsys = p_pic->p_sys;
-    vout_display_sys_t *sys = p_picsys->p_vd_sys;
+    vout_display_sys_t *sys = p_picsys->sw.p_vd_sys;
 
     AndroidWindow_UnlockPicture(sys, sys->p_window, p_pic, false);
 }
diff --git a/modules/video_output/android/display.h b/modules/video_output/android/display.h
index 421c54f..65c2ad6 100644
--- a/modules/video_output/android/display.h
+++ b/modules/video_output/android/display.h
@@ -38,8 +38,6 @@
 
 struct picture_sys_t
 {
-    vout_display_sys_t *p_vd_sys;
-
     union {
         struct {
             void *p_surface;
@@ -47,11 +45,13 @@ struct picture_sys_t
 
             vlc_mutex_t lock;
             decoder_t *p_dec;
+            bool b_vd_ref;
             int i_index;
             void (*pf_release)(decoder_t *p_dec, unsigned int i_index,
                                bool b_render);
         } hw;
         struct {
+            vout_display_sys_t *p_vd_sys;
             void *p_handle;
             ANativeWindow_Buffer buf;
         } sw;
@@ -74,7 +74,7 @@ AndroidOpaquePicture_DetachDecoder(picture_sys_t *p_picsys)
     p_picsys->hw.pf_release = NULL;
     p_picsys->hw.p_dec = NULL;
     /* Release p_picsys if references from VOUT and from decoder are NULL */
-    if (!p_picsys->p_vd_sys && !p_picsys->hw.p_dec)
+    if (!p_picsys->hw.b_vd_ref && !p_picsys->hw.p_dec)
     {
         vlc_mutex_unlock(&p_picsys->hw.lock);
         vlc_mutex_destroy(&p_picsys->hw.lock);
@@ -89,9 +89,9 @@ static inline void AndroidOpaquePicture_DetachVout(picture_t *p_pic)
     picture_sys_t *p_picsys = p_pic->p_sys;
 
     vlc_mutex_lock(&p_picsys->hw.lock);
-    p_pic->p_sys->p_vd_sys = NULL;
+    p_picsys->hw.b_vd_ref = false;
     /* Release p_picsys if references from VOUT and from decoder are NULL */
-    if (!p_picsys->p_vd_sys && !p_picsys->hw.p_dec)
+    if (!p_picsys->hw.b_vd_ref && !p_picsys->hw.p_dec)
     {
         vlc_mutex_unlock(&p_picsys->hw.lock);
         vlc_mutex_destroy(&p_picsys->hw.lock);



More information about the vlc-commits mailing list