Index: head/multimedia/tvheadend/Makefile =================================================================== --- head/multimedia/tvheadend/Makefile (revision 467704) +++ head/multimedia/tvheadend/Makefile (revision 467705) @@ -1,89 +1,90 @@ # Created by: Bernhard Froehlich # $FreeBSD$ PORTNAME= tvheadend PORTVERSION= 4.2.6 DISTVERSIONPREFIX= v +PORTREVISION= 1 CATEGORIES= multimedia 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 BROKEN_mips= fails to configure: No C compiler found BROKEN_mips64= fails to configure: No C compiler found BROKEN_powerpc64= fails to configure: No C compiler found USES= 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 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 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/files/patch-src_tcp.c =================================================================== --- head/multimedia/tvheadend/files/patch-src_tcp.c (nonexistent) +++ head/multimedia/tvheadend/files/patch-src_tcp.c (revision 467705) @@ -0,0 +1,39 @@ +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 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property