From owner-svn-ports-head@freebsd.org Thu Dec 6 14:26:23 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B56EB132FDC0; Thu, 6 Dec 2018 14:26:23 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4571A6EB14; Thu, 6 Dec 2018 14:26:23 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C93124BA8; Thu, 6 Dec 2018 14:26:23 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6EQMA6058267; Thu, 6 Dec 2018 14:26:22 GMT (envelope-from decke@FreeBSD.org) Received: (from decke@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6EQMI0058265; Thu, 6 Dec 2018 14:26:22 GMT (envelope-from decke@FreeBSD.org) Message-Id: <201812061426.wB6EQMI0058265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: decke set sender to decke@FreeBSD.org using -f From: Bernhard Froehlich Date: Thu, 6 Dec 2018 14:26:22 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r486762 - in head/multimedia/tvheadend: . files X-SVN-Group: ports-head X-SVN-Commit-Author: decke X-SVN-Commit-Paths: in head/multimedia/tvheadend: . files X-SVN-Commit-Revision: 486762 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4571A6EB14 X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.865,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-0.05)[-0.054,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 14:26:23 -0000 Author: decke Date: Thu Dec 6 14:26:22 2018 New Revision: 486762 URL: https://svnweb.freebsd.org/changeset/ports/486762 Log: - Fix sendfile() integration affecting webui - Fix epg compatibility issues in webui - Bump PORTREVISION Both patches are already included upstream. Submitted by: Jongsung Kim (via email to ports@) Added: head/multimedia/tvheadend/files/patch-src_webui_static_app_epg.js (contents, props changed) head/multimedia/tvheadend/files/patch-src_webui_webui.c (contents, props changed) Modified: head/multimedia/tvheadend/Makefile Modified: head/multimedia/tvheadend/Makefile ============================================================================== --- head/multimedia/tvheadend/Makefile Thu Dec 6 14:19:23 2018 (r486761) +++ head/multimedia/tvheadend/Makefile Thu Dec 6 14:26:22 2018 (r486762) @@ -4,7 +4,7 @@ PORTNAME= tvheadend PORTVERSION= 4.2.7 DISTVERSIONPREFIX= v -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= multimedia MAINTAINER= decke@FreeBSD.org Added: head/multimedia/tvheadend/files/patch-src_webui_static_app_epg.js ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/multimedia/tvheadend/files/patch-src_webui_static_app_epg.js Thu Dec 6 14:26:22 2018 (r486762) @@ -0,0 +1,44 @@ +From 5363fb5cefbf8f9f0f4d38f81252ce93942665e4 Mon Sep 17 00:00:00 2001 +From: Jongsung Kim +Date: Tue, 20 Nov 2018 17:36:10 +0900 +Subject: [PATCH 2/2] webui: epg: fix compatibility issue for FreeBSD + +The EPG screen serviced by FreeBSD port of tvheadend has two abnormal control +behaviors: + + Reset All button makes the list empty + Typing and then deleting any search string also makes the list empty. + +This patch fixes the symptoms above. + +Patch tested with the latest FreeBSD port of tvheadend-4.2.7. + +Changes since v1: +- call reset only if required +--- + src/webui/static/app/epg.js | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/webui/static/app/epg.js b/src/webui/static/app/epg.js +index 2c8b914b2..7337177ef 100644 +--- src/webui/static/app/epg.js ++++ src/webui/static/app/epg.js +@@ -902,10 +902,11 @@ tvheadend.epg = function() { + epgFilterTitle.on('valid', function(c) { + var value = c.getValue(); + +- if (value.length < 1) +- value = null; +- +- if (epgStore.baseParams.title !== value) { ++ if (value.length < 1) { ++ delete epgStore.baseParams.title; ++ epgView.reset(); ++ } ++ else if (epgStore.baseParams.title !== value) { + epgStore.baseParams.title = value; + epgView.reset(); + } +-- +2.19.1 + Added: head/multimedia/tvheadend/files/patch-src_webui_webui.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/multimedia/tvheadend/files/patch-src_webui_webui.c Thu Dec 6 14:26:22 2018 (r486762) @@ -0,0 +1,80 @@ +From 411f957733222e24df4ead9fb15332dcb2c116da Mon Sep 17 00:00:00 2001 +From: Jongsung Kim +Date: Tue, 29 May 2018 03:42:04 +0900 +Subject: [PATCH 1/2] 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 | 24 +++++++++++++++++------- + 1 file changed, 17 insertions(+), 7 deletions(-) + +diff --git a/src/webui/webui.c b/src/webui/webui.c +index 12b965230..331d998e9 100644 +--- src/webui/webui.c ++++ src/webui/webui.c +@@ -1570,7 +1570,7 @@ http_serve_file(http_connection_t *hc, const char *fname, + #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,11 +1631,15 @@ http_serve_file(http_connection_t *hc, const char *fname, + 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); + return HTTP_STATUS_INTERNAL; + } ++#elif defined(PLATFORM_FREEBSD) || defined(PLATFORM_DARWIN) ++ o = file_start; ++#endif + + if (preop) { + ret = preop(hc, file_start, content_len, opaque); +@@ -1656,16 +1660,22 @@ http_serve_file(http_connection_t *hc, const char *fname, + 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); +-- +2.19.1 +