Index: head/multimedia/tvheadend/Makefile =================================================================== --- head/multimedia/tvheadend/Makefile (revision 482230) +++ head/multimedia/tvheadend/Makefile (revision 482231) @@ -1,93 +1,89 @@ # Created by: Bernhard Froehlich # $FreeBSD$ PORTNAME= tvheadend -PORTVERSION= 4.2.6 +PORTVERSION= 4.2.7 DISTVERSIONPREFIX= v -PORTREVISION= 5 CATEGORIES= multimedia - -PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/ -PATCHFILES= 3cb4f580565b.patch:-p1 MAINTAINER= decke@FreeBSD.org COMMENT= TV streaming server supporting DVB, IPTV, SAT>IP and more LICENSE= GPLv3 LICENSE_FILE= ${WRKSRC}/LICENSE.md BUILD_DEPENDS= bash:shells/bash \ cmake:devel/cmake \ ${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat LIB_DEPENDS= libcurl.so:ftp/curl \ liburiparser.so:net/uriparser RUN_DEPENDS= dtv-scan-tables>=0:multimedia/dtv-scan-tables USES= compiler:c++11-lang gettext gmake pkgconfig python shebangfix ssl USE_GITHUB= yes GNU_CONFIGURE= yes MAKE_JOBS_UNSAFE= yes USE_RC_SUBR= ${PORTNAME} SHEBANG_FILES= ${WRKSRC}/Autobuild.sh \ ${WRKSRC}/configure \ ${WRKSRC}/support/apt-update \ ${WRKSRC}/support/configure.inc \ ${WRKSRC}/support/getmuxlist \ ${WRKSRC}/support/version TVHUSER?= tvheadend TVHGROUP?= tvheadend USERS= ${TVHUSER} GROUPS= ${TVHGROUP} webcamd SUB_LIST+= TVHUSER="${TVHUSER}" \ TVHGROUP="${TVHGROUP}" CONFIGURE_ENV+= PLATFORM=freebsd CONFIGURE_ARGS+=--disable-dvbscan --disable-zlib --disable-hdhomerun_static \ --disable-bintray_cache --disable-ffmpeg_static --disable-pie CFLAGS+= -I${LOCALBASE}/include -Wno-conversion -Wno-int-to-pointer-cast LDFLAGS+= -L${LOCALBASE}/lib -lexecinfo -lssl -lcrypto -lz OPTIONS_DEFINE= AVAHI DVBCSA DVBEN50221 HDHOMERUN INOTIFY TRANSCODING XMLTV OPTIONS_DEFAULT=DVBCSA HDHOMERUN INOTIFY AVAHI_LIB_DEPENDS= libavahi-client.so:net/avahi-app DVBCSA_DESC= Replace internal ffdecsa with dvbcsa DVBCSA_LIB_DEPENDS= libdvbcsa.so:multimedia/libdvbcsa DVBCSA_CONFIGURE_ENABLE= dvbcsa DVBEN50221_DESC= Hardware CAM support DVBEN50221_LIB_DEPENDS= libdvben50221.so:multimedia/dvb-apps DVBEN50221_CONFIGURE_ENABLE= dvben50221 HDHOMERUN_DESC= Native support for HDHomeRun network tuners HDHOMERUN_LIB_DEPENDS= libhdhomerun.so:multimedia/libhdhomerun HDHOMERUN_CONFIGURE_ENABLE= hdhomerun_client INOTIFY_DESC= File system notifications support INOTIFY_LIB_DEPENDS= libinotify.so:devel/libinotify INOTIFY_CONFIGURE_ENABLE= inotify INOTIFY_LDFLAGS= -linotify TRANSCODING_DESC= Transcoding for mobile and web clients TRANSCODING_LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg TRANSCODING_CONFIGURE_ENABLE= libav XMLTV_RUN_DEPENDS= p5-xmltv>=0:textproc/p5-xmltv .include post-patch: @${REINPLACE_CMD} 's|-ldl||' \ ${WRKSRC}/Makefile @${REINPLACE_CMD} 's|-Werror||' \ ${WRKSRC}/Makefile post-install: ${STRIP_CMD} ${STAGEDIR}/${PREFIX}/bin/tvheadend .include Index: head/multimedia/tvheadend/distinfo =================================================================== --- head/multimedia/tvheadend/distinfo (revision 482230) +++ head/multimedia/tvheadend/distinfo (revision 482231) @@ -1,5 +1,3 @@ -TIMESTAMP = 1522131748 -SHA256 (tvheadend-tvheadend-v4.2.6_GH0.tar.gz) = 09b4d4ff436a2006001ef3c3f38553dc4db3ea31bf9871b046a33180a0e8a8b9 -SIZE (tvheadend-tvheadend-v4.2.6_GH0.tar.gz) = 21528720 -SHA256 (3cb4f580565b.patch) = b27328ece106d5c66bba3f3a39ce69b66a3182ea686acd57d393d1ae7255b0bb -SIZE (3cb4f580565b.patch) = 5541 +TIMESTAMP = 1539012290 +SHA256 (tvheadend-tvheadend-v4.2.7_GH0.tar.gz) = 8383990895be767a1b8f6d3a9356c2d5b2ea5d686d2293fbdb1552ffc6ea0640 +SIZE (tvheadend-tvheadend-v4.2.7_GH0.tar.gz) = 21544435 Index: head/multimedia/tvheadend/files/patch-src_webui_webui.c =================================================================== --- head/multimedia/tvheadend/files/patch-src_webui_webui.c (revision 482230) +++ head/multimedia/tvheadend/files/patch-src_webui_webui.c (nonexistent) @@ -1,74 +0,0 @@ -From d19ee83aba20e5a64a6cef6dd528191a71f9aa31 Mon Sep 17 00:00:00 2001 -From: Jongsung Kim -Date: Tue, 29 May 2018 03:42:04 +0900 -Subject: [PATCH] webui: fix http_serve_file() for FreeBSD - -This patch fixes two major problems of FreeBSD port of tvheadend: - -1. very high CPU usage while streaming a recored program -2. unable to stream the recorded program beyond 128MB. - -Unlike Linux sendfile(), FreeBSD sendfile() requires an explicit -file offset, and return value must be checked to catch any error -occurred. (i.e., closed connection) - -Patch tested with the latest FreeBSD port of tvheadend-4.2.6. - ---- src/webui/webui.c.orig 2018-03-26 10:19:37.000000000 +0200 -+++ src/webui/webui.c 2018-06-13 14:47:58.627430000 +0200 -@@ -1570,7 +1570,7 @@ - #if defined(PLATFORM_LINUX) - ssize_t r; - #elif defined(PLATFORM_FREEBSD) || defined(PLATFORM_DARWIN) -- off_t r; -+ off_t o, r; - #endif - - if (fconv) { -@@ -1631,6 +1631,7 @@ - sprintf(range_buf, "bytes %jd-%jd/%jd", - file_start, file_end, (intmax_t)st.st_size); - -+#if defined(PLATFORM_LINUX) - if(file_start > 0) - if (lseek(fd, file_start, SEEK_SET) != file_start) { - close(fd); -@@ -1644,6 +1645,9 @@ - return ret; - } - } -+#elif defined(PLATFORM_FREEBSD) || defined(PLATFORM_DARWIN) -+ o = file_start; -+#endif - - http_send_begin(hc); - http_send_header(hc, range ? HTTP_STATUS_PARTIAL_CONTENT : HTTP_STATUS_OK, -@@ -1656,16 +1660,22 @@ - chunk = MIN(1024 * ((stats ? 128 : 1024) * 1024), content_len); - #if defined(PLATFORM_LINUX) - r = sendfile(hc->hc_fd, fd, NULL, chunk); -+ if (r < 0) { -+ ret = -1; -+ break; -+ } - #elif defined(PLATFORM_FREEBSD) -- sendfile(fd, hc->hc_fd, 0, chunk, NULL, &r, 0); -+ ret = sendfile(fd, hc->hc_fd, o, chunk, NULL, &r, 0); -+ if (ret < 0) -+ break; -+ o += r; - #elif defined(PLATFORM_DARWIN) - r = chunk; -- sendfile(fd, hc->hc_fd, 0, &r, NULL, 0); --#endif -- if(r < 0) { -- ret = -1; -+ ret = sendfile(fd, hc->hc_fd, o, &r, NULL, 0); -+ if (ret < 0) - break; -- } -+ o += r; -+#endif - content_len -= r; - if (stats) - stats(hc, r, opaque); Property changes on: head/multimedia/tvheadend/files/patch-src_webui_webui.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/multimedia/tvheadend/files/patch-Makefile.webui =================================================================== --- head/multimedia/tvheadend/files/patch-Makefile.webui (revision 482230) +++ head/multimedia/tvheadend/files/patch-Makefile.webui (nonexistent) @@ -1,29 +0,0 @@ ---- Makefile.webui.orig 2017-01-20 19:41:51.000000000 +0100 -+++ Makefile.webui 2017-02-08 10:35:04.215801000 +0100 -@@ -189,22 +189,22 @@ - $(VV)$(CSS_PY) --in="$^" utf-check - $(VV)cat $^ > $@.tmp - $(VV)$(RUN_JS) < $@.tmp > $@.tmp2 -- @stat --printf="%-35n %7s\n" $@.tmp $@.tmp2 -+ @stat -f "%-35N %7b" $@.tmp $@.tmp2 - $(VV)$(GZIPCMD) -c $@.tmp2 > $@.tmp - @rm $@.tmp2 - @mv $@.tmp $@ -- @stat --printf="%-35n %7s\n" $@ -+ @stat -f "%-35N %7b" $@ - endef - - define GO_CSS - $(VV)$(CSS_PY) --in="$^" utf-check - $(VV)$(CSS_PY) --in="$^" > $@.tmp - $(VV)$(RUN_CSS) < $@.tmp > $@.tmp2 -- @stat --printf="%-35n %7s\n" $@.tmp $@.tmp2 -+ @stat -f "%-35N %7b" $@.tmp $@.tmp2 - $(VV)$(GZIPCMD) -c $@.tmp2 > $@.tmp - @rm $@.tmp2 - @mv $@.tmp $@ -- @stat --printf="%-35n %7s\n" $@ -+ @stat -f "%-35N %7b" $@ - endef - - define merge-po Property changes on: head/multimedia/tvheadend/files/patch-Makefile.webui ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/multimedia/tvheadend/files/patch-src_tcp.c =================================================================== --- head/multimedia/tvheadend/files/patch-src_tcp.c (revision 482230) +++ head/multimedia/tvheadend/files/patch-src_tcp.c (nonexistent) @@ -1,39 +0,0 @@ -From dc7804e1410971dabbe087193ca2b47f02131524 Mon Sep 17 00:00:00 2001 -From: Jongsung Kim -Date: Mon, 16 Apr 2018 13:01:41 +0900 -Subject: [PATCH] tcp: fix tcp_socket_dead() for FreeBSD - -The FreeBSD port of tvheadend couldn't stream Live TV, and debug -log shows webui judged the peer socket closed immediately after -starting streaming: - -2018-04-15 06:30:04.996 [ DEBUG]:webui: Start streaming /stream/mux/c4bc67bdaa13457e33740ca883cc4d75?ticket=7D1B56AD0E434C5F7EBFA4677A7FBE4C94097974 -2018-04-15 06:30:04.996 [ DEBUG]:webui: Stop streaming /stream/mux/c4bc67bdaa13457e33740ca883cc4d75?ticket=7D1B56AD0E434C5F7EBFA4677A7FBE4C94097974, client hung up - -It looks because tcp_socket_dead() misunderstood the zero-return -from recv(). For the FreeBSD, recv() might return zero for alive -sockets which have nothing to read. - -Patch tested with the latest FreeBSD port of tvheadend-4.2.6. ---- - src/tcp.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/tcp.c b/src/tcp.c -index 40f6c1c0cc..9b865eb292 100644 ---- src/tcp.c -+++ src/tcp.c -@@ -453,8 +453,13 @@ tcp_socket_dead(int fd) - return -errno; - if (err) - return -err; -+#ifdef PLATFORM_FREEBSD -+ if (recv(fd, NULL, 0, MSG_PEEK | MSG_DONTWAIT) < 0) -+ return -errno; -+#else - if (recv(fd, NULL, 0, MSG_PEEK | MSG_DONTWAIT) == 0) - return -EIO; -+#endif - return 0; - } - Property changes on: head/multimedia/tvheadend/files/patch-src_tcp.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/multimedia/tvheadend/files/patch-src_wrappers.c =================================================================== --- head/multimedia/tvheadend/files/patch-src_wrappers.c (revision 482230) +++ head/multimedia/tvheadend/files/patch-src_wrappers.c (revision 482231) @@ -1,30 +1,24 @@ ---- src/wrappers.c.orig 2017-05-16 11:15:24.000000000 +0000 -+++ src/wrappers.c 2017-06-21 18:00:42.352871000 +0000 -@@ -290,6 +290,19 @@ - } while (r > 0); - } - -+#ifdef PLATFORM_FREEBSD -+int64_t -+tvh_usleep(int64_t us) -+{ -+ return usleep(us); -+} -+ -+int64_t -+tvh_usleep_abs(int64_t us) -+{ -+ return usleep(us - getfastmonoclock()); -+} -+#else +Use the implementation from Darwin for tvh_usleep() and tvh_usleep_abs() +in FreeBSD. + +Submitted by: Bernhard Froehlich +--- src/wrappers.c.orig 2018-10-08 12:37:05.000000000 +0000 ++++ src/wrappers.c 2018-10-16 14:27:38.788502000 +0000 +@@ -324,7 +324,7 @@ int64_t tvh_usleep(int64_t us) { -@@ -323,6 +336,7 @@ - return val; - return r ? -r : 0; - } -+#endif - - /* - * qsort +-#if defined(PLATFORM_DARWIN) ++#if defined(PLATFORM_DARWIN) || defined(PLATFORM_FREEBSD) + return usleep(us); + #else + struct timespec ts; +@@ -345,7 +345,7 @@ + int64_t + tvh_usleep_abs(int64_t us) + { +-#if defined(PLATFORM_DARWIN) ++#if defined(PLATFORM_DARWIN) || defined(PLATFORM_FREEBSD) + /* Convert to relative wait */ + int64_t now = getmonoclock(); + int64_t relative = us - now;