[vlc-devel] commit: Do not use vmsplice in case of underflow (near end-of-file) ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Dec 10 21:08:04 CET 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Dec 10 22:07:37 2008 +0200| [dfac14e60bc026a7ef7a391e7f99dc1fd0cf8b9c] | committer: Rémi Denis-Courmont 

Do not use vmsplice in case of underflow (near end-of-file)

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

 modules/stream_filter/decomp.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/decomp.c b/modules/stream_filter/decomp.c
index aa183e5..5283f44 100644
--- a/modules/stream_filter/decomp.c
+++ b/modules/stream_filter/decomp.c
@@ -82,6 +82,9 @@ static void *Thread (void *data)
 {
     stream_t *stream = data;
     stream_sys_t *p_sys = stream->p_sys;
+#ifdef __linux__
+    uintptr_t page_mask = sysconf (_SC_PAGE_SIZE) - 1;
+#endif
     int fd = p_sys->write_fd;
     bool error = false;
 
@@ -108,9 +111,11 @@ static void *Thread (void *data)
             struct iovec iov[1] = { { buf + i, len - i, } };
 
 #ifdef __linux__
-            j = vmsplice (fd, iov, 1, SPLICE_F_GIFT);
+            if (((len | i) & page_mask) == 0)
+                j = vmsplice (fd, iov, 1, SPLICE_F_GIFT);
+            else
 #else
-            j = writev (fd, iov, 1);
+                j = writev (fd, iov, 1);
 #endif
             if (j <= 0)
             {




More information about the vlc-devel mailing list