[vlc-commits] vmem: lock pictures before creating pool

Rémi Denis-Courmont git at videolan.org
Mon Feb 8 22:32:49 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Feb  8 23:25:03 2016 +0200| [a5b262e23b580e655fcc5c74902c1de6d027ac9b] | committer: Rémi Denis-Courmont

vmem: lock pictures before creating pool

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

 modules/video_output/vmem.c |   30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 5a3c63f..11293b7 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -105,22 +105,9 @@ typedef unsigned (*vlc_format_cb)(void **, char *, unsigned *, unsigned *,
                                   unsigned *, unsigned *);
 
 static picture_pool_t *Pool  (vout_display_t *, unsigned);
-static void           Prepare(vout_display_t *, picture_t *, subpicture_t *);
 static void           Display(vout_display_t *, picture_t *, subpicture_t *);
 static int            Control(vout_display_t *, int, va_list);
 
-static void Lock(void *data, picture_t *pic)
-{
-    vout_display_sys_t *sys = data;
-    picture_sys_t *picsys = pic->p_sys;
-    void *planes[PICTURE_PLANE_MAX];
-
-    picsys->id = sys->lock(sys->opaque, planes);
-
-    for (int i = 0; i < pic->i_planes; i++)
-        pic->p[i].p_pixels = planes[i];
-}
-
 static void Unlock(void *data, picture_t *pic)
 {
     vout_display_sys_t *sys = data;
@@ -247,7 +234,7 @@ static int Open(vlc_object_t *object)
     vd->fmt     = fmt;
     vd->info    = info;
     vd->pool    = Pool;
-    vd->prepare = Prepare;
+    vd->prepare = NULL;
     vd->display = Display;
     vd->control = Control;
     vd->manage  = NULL;
@@ -298,10 +285,12 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
         picsys->id = NULL;
 
         picture_resource_t rsc = { .p_sys = picsys };
+        void *planes[PICTURE_PLANE_MAX];
+
+        picsys->id = sys->lock(sys->opaque, planes);
 
         for (unsigned i = 0; i < PICTURE_PLANE_MAX; i++) {
-            /* vmem-lock is responsible for the allocation */
-            rsc.p[i].p_pixels = NULL;
+            rsc.p[i].p_pixels = planes[i];
             rsc.p[i].i_lines  = sys->lines[i];
             rsc.p[i].i_pitch  = sys->pitches[i];
         }
@@ -321,17 +310,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
             picture_Release(pictures[i]);
     }
 
-    picture_pool_Enum(sys->pool, Lock, sys);
     return sys->pool;
 }
 
-static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
-{
-    Unlock(vd->sys, pic);
-    VLC_UNUSED(subpic);
-}
-
-
 static void Display(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
 {
     vout_display_sys_t *sys = vd->sys;
@@ -339,7 +320,6 @@ static void Display(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
     if (sys->display != NULL)
         sys->display(sys->opaque, pic->p_sys->id);
 
-    Lock(sys, pic);
     picture_Release(pic);
     VLC_UNUSED(subpic);
 }



More information about the vlc-commits mailing list