From: Jaroslav Kysela Date: Fri, 13 Nov 2015 19:46:03 +0000 (+0100) Subject: IPTV: file - don't use cached reads X-Git-Tag: v4.2.1~1552 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c81984eeef0f8a6d211ca0a6bea23f4c6b8bdd0e;p=thirdparty%2Ftvheadend.git IPTV: file - don't use cached reads --- diff --git a/src/input/mpegts/iptv/iptv_file.c b/src/input/mpegts/iptv/iptv_file.c index f8c43275c..6b7f627bb 100644 --- a/src/input/mpegts/iptv/iptv_file.c +++ b/src/input/mpegts/iptv/iptv_file.c @@ -43,9 +43,14 @@ iptv_file_thread ( void *aux ) iptv_mux_t *im = aux; file_priv_t *fp = im->im_data; struct timespec ts; - int r, fd = fp->fd, pause = 0; + ssize_t r; + int fd = fp->fd, pause = 0; char buf[32*1024]; + off_t off = 0; +#if defined(PLATFORM_DARWIN) + fcntl(fd, F_NOCACHE, 1); +#endif pthread_mutex_lock(&iptv_lock); while (!fp->shutdown && fd > 0) { while (!fp->shutdown && pause) { @@ -70,6 +75,12 @@ iptv_file_thread ( void *aux ) sbuf_append(&im->mm_iptv_buffer, buf, r); if (iptv_input_recv_packets(im, r) == 1) pause = 1; +#ifndef PLATFORM_DARWIN +#if !ENABLE_ANDROID + posix_fadvise(fd, off, r, POSIX_FADV_DONTNEED); +#endif +#endif + off += r; } pthread_mutex_unlock(&iptv_lock); return NULL;