[vlc-commits] wayland/shm: no need to retain the shm_pool

Rémi Denis-Courmont git at videolan.org
Sat Oct 4 21:44:43 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct  4 22:44:04 2014 +0300| [99613a827f33078bc30b32c816fa3db1d77576da] | committer: Rémi Denis-Courmont

wayland/shm: no need to retain the shm_pool

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

 modules/video_output/wl/shm.c |   21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/wl/shm.c b/modules/video_output/wl/shm.c
index 22fe55d..3a7cb0a 100644
--- a/modules/video_output/wl/shm.c
+++ b/modules/video_output/wl/shm.c
@@ -47,7 +47,6 @@ struct vout_display_sys_t
     vout_window_t *embed; /* VLC window */
     struct wl_event_queue *eventq;
     struct wl_shm *shm;
-    struct wl_shm_pool *shm_pool;
 
     picture_pool_t *pool; /* picture pool */
 
@@ -122,9 +121,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
     memset(base, 0x80, length); /* gray fill */
 #endif
 
-    sys->shm_pool = wl_shm_create_pool(sys->shm, fd, length);
+    struct wl_shm_pool *shm_pool = wl_shm_create_pool(sys->shm, fd, length);
     close(fd);
-    if (sys->shm_pool == NULL)
+    if (shm_pool == NULL)
     {
         munmap(base, length);
         return NULL;
@@ -149,7 +148,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
     {
         struct wl_buffer *buf;
 
-        buf = wl_shm_pool_create_buffer(sys->shm_pool, offset, width, height,
+        buf = wl_shm_pool_create_buffer(shm_pool, offset, width, height,
                                         stride, WL_SHM_FORMAT_XRGB8888);
         if (buf == NULL)
             break;
@@ -171,24 +170,22 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
         pics[count++] = pic;
     }
 
+    wl_shm_pool_destroy(shm_pool);
+    wl_display_flush(sys->embed->display.wl);
+
     if (length > 0)
         munmap(base, length); /* Left-over buffers */
     if (count == 0)
-        goto error;
-
-    wl_display_flush(sys->embed->display.wl);
+        return NULL;
 
     sys->pool = picture_pool_New (count, pics);
     if (unlikely(sys->pool == NULL))
     {
         while (count > 0)
             picture_Release(pics[--count]);
-        goto error;
+        return NULL;
     }
     return sys->pool;
-error:
-    wl_shm_pool_destroy(sys->shm_pool);
-    return NULL;
 }
 
 static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
@@ -229,8 +226,6 @@ static void ResetPictures(vout_display_t *vd)
         return;
 
     picture_pool_Delete(sys->pool);
-    wl_shm_pool_destroy(sys->shm_pool);
-
     sys->pool = NULL;
 }
 



More information about the vlc-commits mailing list