]> code.delx.au - pulseaudio/commitdiff
virtual-surround: check if resampled memblock is not equal to input
authorNiels Ole Salscheider <niels_ole@salscheider-online.de>
Sat, 24 Nov 2012 11:32:51 +0000 (12:32 +0100)
committerTanu Kaskinen <tanuk@iki.fi>
Thu, 29 Nov 2012 03:28:39 +0000 (05:28 +0200)
Since commit e32a408b3cdd46857fdf12210c1bf5bdbf3a96f8, we silence the
input memblock in order to give the resampler enough input samples, if
necessary.
But if there is no need to resample the hrir, the resampled memblock is
actually the same as the input memblock. Thus, we have to make sure that
we do not silence it in this case.

src/modules/module-virtual-surround-sink.c

index 4915278300731bb586fe8bdea40216e0052845e8..adaa58f6914cdfadf7135d00140a2466afff7325 100644 (file)
@@ -738,8 +738,10 @@ int pa__init(pa_module*m) {
     /* add silence to the hrir until we get enough samples out of the resampler */
     while (hrir_copied_length < hrir_total_length) {
         pa_resampler_run(resampler, &hrir_temp_chunk, &hrir_temp_chunk_resampled);
-        /* Silence input block */
-        pa_silence_memblock(hrir_temp_chunk.memblock, &hrir_temp_ss);
+        if (hrir_temp_chunk.memblock != hrir_temp_chunk_resampled.memblock) {
+            /* Silence input block */
+            pa_silence_memblock(hrir_temp_chunk.memblock, &hrir_temp_ss);
+        }
 
         if (hrir_temp_chunk_resampled.memblock) {
             /* Copy hrir data */