[vlc-commits] soxr: fix input loss with rate > 1

Thomas Guillem git at videolan.org
Tue Mar 5 18:38:58 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar  5 18:31:58 2019 +0100| [ac023f53d3fc18ec7c9d1b6bd0e01226da253e25] | committer: Thomas Guillem

soxr: fix input loss with rate > 1

Oddly, the output len can't be inferior to the input len (this was the case for
rate > 1).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ac023f53d3fc18ec7c9d1b6bd0e01226da253e25
---

 modules/audio_filter/resampler/soxr.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/audio_filter/resampler/soxr.c b/modules/audio_filter/resampler/soxr.c
index 7babe2aaee..1d08d8527f 100644
--- a/modules/audio_filter/resampler/soxr.c
+++ b/modules/audio_filter/resampler/soxr.c
@@ -239,8 +239,14 @@ SoXR_Resample( filter_t *p_filter, soxr_t soxr, block_t *p_in, size_t i_olen )
     const size_t i_oframesize = p_filter->fmt_out.audio.i_bytes_per_frame;
     const size_t i_ilen = p_in ? p_in->i_nb_samples : 0;
 
-    block_t *p_out = i_ilen >= i_olen ? p_in
-                   : block_Alloc( i_olen * i_oframesize );
+    block_t *p_out;
+    if( i_ilen >= i_olen )
+    {
+        i_olen = i_ilen;
+        p_out = p_in;
+    }
+    else
+        p_out = block_Alloc( i_olen * i_oframesize );
 
     soxr_error_t error = soxr_process( soxr, p_in ? p_in->p_buffer : NULL,
                                        i_ilen, &i_idone, p_out->p_buffer,



More information about the vlc-commits mailing list