From owner-svn-ports-head@freebsd.org Fri May 25 13:09:12 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 04DA4EACEC4; Fri, 25 May 2018 13:09:12 +0000 (UTC) (envelope-from tobik@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 9E0DB80CAB; Fri, 25 May 2018 13:09:11 +0000 (UTC) (envelope-from tobik@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 7040D212B3; Fri, 25 May 2018 13:09:11 +0000 (UTC) (envelope-from tobik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4PD9B0r092030; Fri, 25 May 2018 13:09:11 GMT (envelope-from tobik@FreeBSD.org) Received: (from tobik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4PD9Au8092029; Fri, 25 May 2018 13:09:10 GMT (envelope-from tobik@FreeBSD.org) Message-Id: <201805251309.w4PD9Au8092029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tobik set sender to tobik@FreeBSD.org using -f From: Tobias Kortkamp Date: Fri, 25 May 2018 13:09:10 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r470834 - in head/www/palemoon: . files X-SVN-Group: ports-head X-SVN-Commit-Author: tobik X-SVN-Commit-Paths: in head/www/palemoon: . files X-SVN-Commit-Revision: 470834 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.26 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: Fri, 25 May 2018 13:09:12 -0000 Author: tobik Date: Fri May 25 13:09:10 2018 New Revision: 470834 URL: https://svnweb.freebsd.org/changeset/ports/470834 Log: www/palemoon: Consolidate sndio patches and apply softvol fix [1] This will prevent Pale Moon from changing the slot volumes of sndiod which can lead to them being too silent or even muted when Pale Moon happens to reuse one of them later. It'll also fix a bug where Pale Moon won't pick up slot volumes changes done externally and thus provides inaccurate volume controls. [1] https://marc.info/?l=openbsd-ports&m=152641946326955&w=2 PR: 228479 Submitted by: tobik Approved by: lichray@gmail.com (maintainer) Added: head/www/palemoon/files/patch-sndio (contents, props changed) Deleted: head/www/palemoon/files/patch-bug1153151 head/www/palemoon/files/patch-bug1153179 head/www/palemoon/files/patch-cubeb5ffce9e91b Modified: head/www/palemoon/Makefile Modified: head/www/palemoon/Makefile ============================================================================== --- head/www/palemoon/Makefile Fri May 25 13:01:27 2018 (r470833) +++ head/www/palemoon/Makefile Fri May 25 13:09:10 2018 (r470834) @@ -3,6 +3,7 @@ PORTNAME= palemoon DISTVERSION= 27.9.2 +PORTREVISION= 1 DISTVERSIONSUFFIX=_Release CATEGORIES= www ipv6 Added: head/www/palemoon/files/patch-sndio ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/palemoon/files/patch-sndio Fri May 25 13:09:10 2018 (r470834) @@ -0,0 +1,145 @@ +Bug 1153151 - make libcubeb sndio use non-blocking i/o +Bug 1153179 - fix latency reporting in libcubeb sndio + +From cubeb: +From 5ffce9e91b2fde70ba532ea215e3e9e7eed3d41a Mon Sep 17 00:00:00 2001 +From: Alexandre Ratchov +Date: Thu, 2 Apr 2015 13:09:22 +1300 +Subject: [PATCH] sndio: improve and clamp float->s16 conversion. + +https://marc.info/?l=openbsd-ports&m=152641946326955&w=2 +Apply volume in software as do other backends. This is necessary +because sndio volume may be controlled externally and there's no +volume getter in libcubeb to notify the caller about volume +changes. + +--- media/libcubeb/src/cubeb_sndio.c.orig 2018-05-24 13:59:58 UTC ++++ media/libcubeb/src/cubeb_sndio.c +@@ -4,6 +4,7 @@ + * This program is made available under an ISC-style license. See the + * accompanying file LICENSE for details. + */ ++#include + #include + #include + #include +@@ -41,17 +42,39 @@ struct cubeb_stream { + uint64_t wrpos; /* number of written frames */ + cubeb_data_callback data_cb; /* cb to preapare data */ + cubeb_state_callback state_cb; /* cb to notify about state changes */ ++ float volume; /* current volume */ + void *arg; /* user arg to {data,state}_cb */ + }; + + static void +-float_to_s16(void *ptr, long nsamp) ++s16_setvol(void *ptr, long nsamp, float volume) + { + int16_t *dst = ptr; ++ int32_t mult = volume * 32768; ++ int32_t s; ++ while (nsamp-- > 0) { ++ s = *dst; ++ s = (s * mult) >> 15; ++ *(dst++) = s; ++ } ++} ++ ++static void ++float_to_s16(void *ptr, long nsamp, float volume) ++{ ++ int16_t *dst = ptr; + float *src = ptr; ++ float mult = volume * 32768; ++ int s; + +- while (nsamp-- > 0) +- *(dst++) = *(src++) * 32767; ++ while (nsamp-- > 0) { ++ s = lrintf(*(src++) * mult); ++ if (s < -32768) ++ s = -32768; ++ else if (s > 32767) ++ s = 32767; ++ *(dst++) = s; ++ } + } + + static void +@@ -59,7 +82,7 @@ sndio_onmove(void *arg, int delta) + { + cubeb_stream *s = (cubeb_stream *)arg; + +- s->rdpos += delta; ++ s->rdpos += delta * s->bpf; + } + + static void * +@@ -103,7 +126,9 @@ sndio_mainloop(void *arg) + break; + } + if (s->conv) +- float_to_s16(s->buf, nfr * s->pchan); ++ float_to_s16(s->buf, nfr * s->pchan, s->volume); ++ else ++ s16_setvol(s->buf, nfr * s->pchan, s->volume); + start = 0; + end = nfr * s->bpf; + } +@@ -127,7 +152,7 @@ sndio_mainloop(void *arg) + state = CUBEB_STATE_ERROR; + break; + } +- s->wrpos = 0; ++ s->wrpos += n; + start += n; + } + } +@@ -179,7 +204,7 @@ sndio_stream_init(cubeb *context, + if (s == NULL) + return CUBEB_ERROR; + s->context = context; +- s->hdl = sio_open(NULL, SIO_PLAY, 0); ++ s->hdl = sio_open(NULL, SIO_PLAY, 1); + if (s->hdl == NULL) { + free(s); + DPR("sndio_stream_init(), sio_open() failed\n"); +@@ -242,6 +267,7 @@ sndio_stream_init(cubeb *context, + free(s); + return CUBEB_ERROR; + } ++ s->volume = 1.; + *stream = s; + DPR("sndio_stream_init() end, ok\n"); + (void)context; +@@ -318,7 +344,7 @@ sndio_stream_get_position(cubeb_stream *s, uint64_t *p + { + pthread_mutex_lock(&s->mtx); + DPR("sndio_stream_get_position() %lld\n", s->rdpos); +- *p = s->rdpos; ++ *p = s->rdpos / s->bpf; + pthread_mutex_unlock(&s->mtx); + return CUBEB_OK; + } +@@ -328,7 +354,11 @@ sndio_stream_set_volume(cubeb_stream *s, float volume) + { + DPR("sndio_stream_set_volume(%f)\n", volume); + pthread_mutex_lock(&s->mtx); +- sio_setvol(s->hdl, SIO_MAXVOL * volume); ++ if (volume < 0.) ++ volume = 0.; ++ else if (volume > 1.0) ++ volume = 1.; ++ s->volume = volume; + pthread_mutex_unlock(&s->mtx); + return CUBEB_OK; + } +@@ -338,7 +368,7 @@ sndio_stream_get_latency(cubeb_stream * stm, uint32_t + { + // http://www.openbsd.org/cgi-bin/man.cgi?query=sio_open + // in the "Measuring the latency and buffers usage" paragraph. +- *latency = stm->wrpos - stm->rdpos; ++ *latency = (stm->wrpos - stm->rdpos) / stm->bpf; + return CUBEB_OK; + } +