Commit 2e12c3f3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

ugly resampler: no need to allocate a buffer when down-sampling

parent e8beaf5c
......@@ -90,9 +90,12 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
/ p_filter->fmt_in.audio.i_rate;
unsigned int i_sample_bytes = i_nb_channels * sizeof(int32_t);
block_t *p_out_buf = block_Alloc( i_out_nb * i_sample_bytes );
if( p_filter->fmt_out.audio.i_rate > p_filter->fmt_in.audio.i_rate )
{
p_out_buf = block_Alloc( i_out_nb * i_sample_bytes );
if( !p_out_buf )
goto out;
}
int32_t *p_out = (int32_t*)p_out_buf->p_buffer;
const int32_t *p_in = (int32_t*)p_in_buf->p_buffer;
......@@ -120,6 +123,8 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
p_out_buf->i_pts = p_in_buf->i_pts;
p_out_buf->i_length = p_out_buf->i_nb_samples *
1000000 / p_filter->fmt_out.audio.i_rate;
if( p_in_buf != p_out_buf )
out:
block_Release( p_in_buf );
return p_out_buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment