Date: Sun, 3 Dec 2017 07:17:18 +0000 (UTC) From: Tobias Kortkamp <tobik@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r455391 - in head/www/palemoon: . files Message-ID: <201712030717.vB37HIsn014930@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tobik Date: Sun Dec 3 07:17:18 2017 New Revision: 455391 URL: https://svnweb.freebsd.org/changeset/ports/455391 Log: www/palemoon: sndio: improve and clamp float->s16 conversion This fixes sound glitches/crackling when playing audio or video clips with float samples with SNDIO=on. PR: 224034 Submitted by: lichray@gmail.com (maintainer) Obtained from: cubeb Added: head/www/palemoon/files/patch-cubeb5ffce9e91b (contents, props changed) Modified: head/www/palemoon/Makefile Modified: head/www/palemoon/Makefile ============================================================================== --- head/www/palemoon/Makefile Sun Dec 3 07:15:48 2017 (r455390) +++ head/www/palemoon/Makefile Sun Dec 3 07:17:18 2017 (r455391) @@ -4,6 +4,7 @@ PORTNAME= palemoon DISTVERSION= 27.6.2 DISTVERSIONSUFFIX=_Release +PORTREVISION= 1 CATEGORIES= www ipv6 MAINTAINER= lichray@gmail.com Added: head/www/palemoon/files/patch-cubeb5ffce9e91b ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/palemoon/files/patch-cubeb5ffce9e91b Sun Dec 3 07:17:18 2017 (r455391) @@ -0,0 +1,41 @@ +From 5ffce9e91b2fde70ba532ea215e3e9e7eed3d41a Mon Sep 17 00:00:00 2001 +From: Alexandre Ratchov <alex@caoua.org> +Date: Thu, 2 Apr 2015 13:09:22 +1300 +Subject: [PATCH] sndio: improve and clamp float->s16 conversion. + +--- + src/cubeb_sndio.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/cubeb_sndio.c b/src/cubeb_sndio.c +index 01f96346..e6d531a4 100644 +--- media/libcubeb/src/cubeb_sndio.c.orig ++++ 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 <math.h> + #include <poll.h> + #include <pthread.h> + #include <sndio.h> +@@ -49,9 +50,16 @@ float_to_s16(void *ptr, long nsamp) + { + int16_t *dst = ptr; + float *src = ptr; +- +- while (nsamp-- > 0) +- *(dst++) = *(src++) * 32767; ++ int s; ++ ++ while (nsamp-- > 0) { ++ s = lrintf(*(src++) * 32768); ++ if (s < -32768) ++ s = -32768; ++ else if (s > 32767) ++ s = 32767; ++ *(dst++) = s; ++ } + } + + static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712030717.vB37HIsn014930>