[pulseaudio-commits] 2 commits - src/pulsecore src/tests

David Henningsson diwic at kemper.freedesktop.org
Wed Sep 16 23:14:36 PDT 2015


 src/pulsecore/filter/lfe-filter.c |    2 +-
 src/tests/volume-test.c           |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 392060d0fca30cd3fac68a6feabe25bb87823d9b
Author: Michael Cree <mcree at orcon.net.nz>
Date:   Tue Sep 15 10:08:41 2015 +0530

    tests: Fix test-suite failure on Alpha
    
    Pulseaudio fails to build on the Alpha architecture due to a failure
    in the volume-test of the test suite.  I had reported this to the
    Debian bug tracker [1] but the maintainer has asked that I forward the
    patch to this mail list.  The failure in volume-test occurs because it
    is compiled with -ffast-math which implies -ffinite-math-only of which
    the gcc manual states that it optimizes for floating-point arithmetic
    with the assumption that arguments and results are not NaNs or
    +/-infinity, and futher notes that it may result in incorrect output.
    On the Alpha platform that is somewhat an understatement as the use of
    non-finite floating-point arithmetic with -ffinite-math-only results in
    a floating-point exception and the termination of the program.
    
    The volume-test converts volumes into decibels (so a zero volume
    becomes a negative infinity) and proceeds to add two volumes (in
    decibels), thus does arithmetic with non-finite floating point numbers
    despite being compiled with -ffast-math!
    
    I attach a patch that protects against the arithmetic with non-finite
    numbers for your consideration.  With that patch the test-suite passes
    on Alpha.
    
    Cheers
    Michael.
    
    [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798248

diff --git a/src/tests/volume-test.c b/src/tests/volume-test.c
index bd0b01c..191bc21 100644
--- a/src/tests/volume-test.c
+++ b/src/tests/volume-test.c
@@ -114,7 +114,10 @@ START_TEST (volume_test) {
             double q, qq;
 
             p = pa_sw_volume_multiply(v, w);
-            qq = db + db2;
+            if (isfinite(db) && isfinite(db2))
+                qq = db + db2;
+            else
+                qq = -INFINITY;
             p2 = pa_sw_volume_from_dB(qq);
             q = l*t;
             p1 = pa_sw_volume_from_linear(q);

commit 76e2cec9a2c3a09fc62ce62042d33375d9878471
Author: Arun Raghavan <git at arunraghavan.net>
Date:   Thu Sep 17 09:44:49 2015 +0530

    lfe-filter: Deal with empty input chunks
    
    It is possible that we get a zero-length memchunk to work with.
    Specifically, this happens the resampler (which is called before the
    lfe-filter) consumes all the input data, but does not (yet) produce any
    output data.
    
    Reproduced using:
    
      pulseaudio --resample-method=soxr-mq
      pactl load-module module-null-sink sink_name=lfe_test channels=3 channel_map=front-left,front-right,lfe
      paplay --raw /dev/zero --rate=48000 -d lfe_test
    
    Thanks to the original reporter for the backtrace:
    
    Bug: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1496577

diff --git a/src/pulsecore/filter/lfe-filter.c b/src/pulsecore/filter/lfe-filter.c
index 8c79b55..5f5ace2 100644
--- a/src/pulsecore/filter/lfe-filter.c
+++ b/src/pulsecore/filter/lfe-filter.c
@@ -113,7 +113,7 @@ pa_memchunk * pa_lfe_filter_process(pa_lfe_filter_t *f, pa_memchunk *buf) {
     struct saved_state *s, *s2;
     void *data;
 
-    if (!f->active)
+    if (!f->active || !buf->length)
         return buf;
 
     /* Remove old states (FIXME: we could do better than searching the entire array here?) */



More information about the pulseaudio-commits mailing list