[vlc-commits] soxr: fix input loss with rate > 1
Thomas Guillem
git at videolan.org
Tue May 5 16:02:41 CEST 2020
vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar 5 18:31:58 2019 +0100| [4a050b72cc3ec2f449c99a5aa8b364bdd8d78a27] | 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).
(cherry picked from commit ac023f53d3fc18ec7c9d1b6bd0e01226da253e25)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4a050b72cc3ec2f449c99a5aa8b364bdd8d78a27
---
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 a0a1078f22..373f629106 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