[vlc-commits] shm: fix capture with non page-size frame size (maybe fixes #7579)

Rémi Denis-Courmont git at videolan.org
Tue Oct 16 17:48:18 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Oct 16 18:47:35 2012 +0300| [22203a5835c4cb44be70653c94375af309141168] | committer: Rémi Denis-Courmont

shm: fix capture with non page-size frame size (maybe fixes #7579)

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

 modules/access/shm.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/access/shm.c b/modules/access/shm.c
index 68cd4bc..9a017f9 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -119,6 +119,7 @@ struct demux_sys_t
 {
     const void  *addr;
     size_t       length;
+    size_t       size;
     es_out_id_t *es;
     mtime_t      pts, interval;
     /* pts is protected by the lock. The rest is read-only. */
@@ -169,7 +170,7 @@ static int Open (vlc_object_t *obj)
     if (sys->length == 0)
         goto error;
     pagesize--;
-    sys->length = (sys->length + pagesize) & ~pagesize; /* pad */
+    sys->size = (sys->length + pagesize) & ~pagesize; /* pad */
 
     char *path = var_InheritString (demux, "shm-file");
     if (path != NULL)
@@ -182,7 +183,7 @@ static int Open (vlc_object_t *obj)
             goto error;
         }
 
-        void *mem = mmap (NULL, sys->length, PROT_READ, MAP_SHARED, fd, 0);
+        void *mem = mmap (NULL, sys->size, PROT_READ, MAP_SHARED, fd, 0);
         close (fd);
         if (mem == MAP_FAILED)
         {
@@ -271,7 +272,7 @@ static void Close (vlc_object_t *obj)
 
 static void map_detach (demux_sys_t *sys)
 {
-    munmap ((void *)sys->addr, sys->length);
+    munmap ((void *)sys->addr, sys->size);
 }
 
 #ifdef HAVE_SYS_SHM_H



More information about the vlc-commits mailing list