[vlc-devel] [PATCH 2/3] soxr: don't handle the case where input is not fully processed
Thomas Guillem
thomas at gllm.fr
Mon Nov 2 17:06:10 CET 2015
Keep it simpler, it shouldn't happen since we alloc an output buffer that is
slightly bigger than expected (in order to have enough room for data that is
held by SoxR).
---
modules/audio_filter/resampler/soxr.c | 34 ++--------------------------------
1 file changed, 2 insertions(+), 32 deletions(-)
diff --git a/modules/audio_filter/resampler/soxr.c b/modules/audio_filter/resampler/soxr.c
index 3a84960..5c7a9a7 100644
--- a/modules/audio_filter/resampler/soxr.c
+++ b/modules/audio_filter/resampler/soxr.c
@@ -82,7 +82,6 @@ struct filter_sys_t
{
soxr_t soxr;
double f_fixed_ratio;
- block_t *p_last_in;
};
static block_t *Resample( filter_t *, block_t * );
@@ -206,9 +205,6 @@ Close( vlc_object_t *p_obj )
soxr_delete( p_sys->soxr );
- if( unlikely( p_sys->p_last_in ) )
- block_Release( p_sys->p_last_in );
-
free( p_sys );
}
@@ -225,20 +221,6 @@ Resample( filter_t *p_filter, block_t *p_in )
{
filter_sys_t *p_sys = p_filter->p_sys;
- /* Prepend last remaining input buffer to the current one */
- if( unlikely( p_sys->p_last_in ) )
- {
- p_in = block_Realloc( p_in, p_sys->p_last_in->i_buffer, p_in->i_buffer );
- if( unlikely( p_in == NULL ) )
- return NULL;
-
- memcpy( p_in->p_buffer, p_sys->p_last_in->p_buffer,
- p_sys->p_last_in->i_buffer );
- p_in->i_nb_samples += p_sys->p_last_in->i_nb_samples;
- block_Release( p_sys->p_last_in );
- p_sys->p_last_in = NULL;
- }
-
const size_t i_oframesize = p_filter->fmt_out.audio.i_bytes_per_frame;
const size_t i_ilen = p_in->i_nb_samples;
size_t i_olen, i_idone, i_odone;
@@ -276,20 +258,8 @@ Resample( filter_t *p_filter, block_t *p_in )
}
if( unlikely( i_idone < i_ilen ) )
- {
- msg_Warn( p_filter, "processed input len < input len, "
- "keeping buffer for next Resample call" );
- const size_t i_done_size = i_idone
- * p_filter->fmt_out.audio.i_bytes_per_frame;
-
- /* Realloc since p_in can be used as p_out */
- p_sys->p_last_in = block_Alloc( p_in->i_buffer - i_done_size );
- if( unlikely( p_sys->p_last_in == NULL ) )
- goto error;
- memcpy( p_sys->p_last_in->p_buffer,
- p_in->p_buffer + i_done_size, p_in->i_buffer - i_done_size );
- p_sys->p_last_in->i_nb_samples = p_in->i_nb_samples - i_idone;
- }
+ msg_Err( p_filter, "lost %zd of %zd input frames",
+ i_ilen - i_idone, i_idone);
p_out->i_buffer = i_odone * i_oframesize;
p_out->i_nb_samples = i_odone;
--
2.1.4
More information about the vlc-devel
mailing list