Bug 178343 - [PATCH] Fix distortions with audio/openal-soft
Summary: [PATCH] Fix distortions with audio/openal-soft
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Marcus von Appen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-05 10:20 UTC by yamagi
Modified: 2013-05-23 07:10 UTC (History)
0 users

See Also:


Attachments
file.diff (666 bytes, patch)
2013-05-05 10:20 UTC, yamagi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yamagi 2013-05-05 10:20:00 UTC
Since version 1.15 audio/openal-soft has an integer overflow bug which
results in heavy distortions in conjunction with the OSS backend. It
can be triggered on at least snd_hda and snd_envy24ht with several
applications. The bug was confirmed by Chris Robinson (author of
openal-soft) and he send me the attached patch. It fixes the problem
and I guess that it should be included into the port until a new 
upstream version is released.

The attached patch adds the file files/patch-Alc-ALu.c to
audio/openal-soft.

How-To-Repeat: Install audio/openal-soft and start any OpenAL based application. For
example games/ioquake3. The sound will distort if the application volume
is high enough.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-05-05 10:20:07 UTC
Responsible Changed
From-To: freebsd-ports-bugs->mva

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Marcus von Appen freebsd_committer freebsd_triage 2013-05-18 09:56:12 UTC
Hi Yamagi,

[...]

thanks for the explanation. I catched up with Chris Robinson and he just
committed the patch, you both talked about:
http://repo.or.cz/w/openal-soft.git/commitdiff/563f16dc2a52de3217c90313ca6bddbbc20f20a0

Do you mind to give that one a try and check,if it fixes the distortion issue
for you?

Thanks
Marcus
Comment 3 yamagi 2013-05-20 19:05:35 UTC
Hello :)

On Sat, 18 May 2013 10:56:12 +0200
Marcus von Appen <mva@FreeBSD.org> wrote:

> thanks for the explanation. I catched up with Chris Robinson and he just
> committed the patch, you both talked about:
> http://repo.or.cz/w/openal-soft.git/commitdiff/563f16dc2a52de3217c90313ca6bddbbc20f20a0
> 
> Do you mind to give that one a try and check,if it fixes the distortion issue
> for you?


YI've just tested the change. Both openal-softs git head and the
revision 563f16d backported to the FreeBSD port work just fine. The
patch solves the problem.

Thank you,
Yamagi


-- 
Homepage:  www.yamagi.org
XMPP:      yamagi@yamagi.org
GnuPG/GPG: 0xEFBCCBCB
Comment 4 dfilter service freebsd_committer freebsd_triage 2013-05-23 07:05:45 UTC
Author: mva
Date: Thu May 23 06:05:32 2013
New Revision: 318843
URL: http://svnweb.freebsd.org/changeset/ports/318843

Log:
  - Fix a sound distortion issue for the OSS backend
  
  PR:		ports/178343
  Submitted by:	Yamagi Burmeister <yamagi@yamagi.org>

Added:
  head/audio/openal-soft/files/patch-Alc-ALu.c   (contents, props changed)
Modified:
  head/audio/openal-soft/Makefile

Modified: head/audio/openal-soft/Makefile
==============================================================================
--- head/audio/openal-soft/Makefile	Thu May 23 05:48:41 2013	(r318842)
+++ head/audio/openal-soft/Makefile	Thu May 23 06:05:32 2013	(r318843)
@@ -2,6 +2,7 @@
 
 PORTNAME=	openal-soft
 PORTVERSION=	1.15.1
+PORTREVISION=	1
 CATEGORIES=	audio
 MASTER_SITES=	http://kcat.strangesoft.net/openal-releases/
 

Added: head/audio/openal-soft/files/patch-Alc-ALu.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/audio/openal-soft/files/patch-Alc-ALu.c	Thu May 23 06:05:32 2013	(r318843)
@@ -0,0 +1,37 @@
+--- Alc/ALu.c.orig	2013-05-23 08:00:01.000000000 +0200
++++ Alc/ALu.c	2013-05-23 08:01:20.000000000 +0200
+@@ -912,24 +912,27 @@
+ }
+ 
+ 
+-static __inline ALfloat aluF2F(ALfloat val)
+-{ return val; }
+-static __inline ALint aluF2I(ALfloat val)
++static __inline ALint aluF2I25(ALfloat val)
+ {
+     /* Clamp the value between -1 and +1. This handles that without branching. */
+     val = val+1.0f - fabsf(val-1.0f);
+     val = (val-2.0f + fabsf(val+2.0f)) * 0.25f;
+-    /* Convert to a signed integer, between -2147483647 and +2147483647. */
+-    return fastf2i((ALfloat)(val*2147483647.0));
++    /* Convert to a signed integer, between -16777215 and +16777215. */
++    return fastf2i(val*16777215.0f);
+ }
++
++static __inline ALfloat aluF2F(ALfloat val)
++{ return val; }
++static __inline ALint aluF2I(ALfloat val)
++{ return aluF2I25(val)<<7; }
+ static __inline ALuint aluF2UI(ALfloat val)
+ { return aluF2I(val)+2147483648u; }
+ static __inline ALshort aluF2S(ALfloat val)
+-{ return aluF2I(val)>>16; }
++{ return aluF2I(val)>>9; }
+ static __inline ALushort aluF2US(ALfloat val)
+ { return aluF2S(val)+32768; }
+ static __inline ALbyte aluF2B(ALfloat val)
+-{ return aluF2I(val)>>24; }
++{ return aluF2I(val)>>17; }
+ static __inline ALubyte aluF2UB(ALfloat val)
+ { return aluF2B(val)+128; }
+ 
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Marcus von Appen freebsd_committer freebsd_triage 2013-05-23 07:06:11 UTC
State Changed
From-To: open->closed

Committed. Thanks!