]> code.delx.au - pulseaudio/commitdiff
Resampler: Don't use the peaks resampler for upsampling
authorpoljar (Damir Jelić) <poljarinho@gmail.com>
Fri, 28 Jun 2013 16:55:04 +0000 (18:55 +0200)
committerpoljar (Damir Jelić) <poljarinho@gmail.com>
Tue, 27 Aug 2013 10:33:10 +0000 (12:33 +0200)
This patch fixes this assertion:
    Assertion 'r->i_ss.rate >= r->o_ss.rate' failed at ../../src/pulsecore/resampler.c:1744, function peaks_init(). Aborting.

src/pulsecore/resampler.c

index 446ddff674be56dcecfde980838c8fe5f6a2a2d7..eda623615a817ededa557b97d4469ad1ae66e301 100644 (file)
@@ -226,6 +226,16 @@ static pa_resample_method_t pa_resampler_fix_method(
                 method = PA_RESAMPLER_AUTO;
             }
             break;
+
+        /* The Peaks resampler only supports downsampling.
+         * Revert to auto if we are upsampling */
+        case PA_RESAMPLER_PEAKS:
+            if (rate_a < rate_b) {
+                pa_log_warn("The 'peaks' resampler only supports downsampling, reverting to resampler 'auto'.");
+                method = PA_RESAMPLER_AUTO;
+            }
+            break;
+
         default:
             break;
     }