Commit 2cf478fe authored by Laurent Aimar's avatar Laurent Aimar

Fixed bandlimited invalid writes when downsampling.

parent dbdbf98e
...@@ -224,6 +224,8 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf ) ...@@ -224,6 +224,8 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf )
while( p_sys->i_remainder < p_filter->fmt_out.audio.i_rate ) while( p_sys->i_remainder < p_filter->fmt_out.audio.i_rate )
{ {
if( p_out_buf->i_buffer/i_bytes_per_frame <= i_out )
break;
if( p_sys->d_old_factor >= 1 ) if( p_sys->d_old_factor >= 1 )
{ {
...@@ -250,15 +252,6 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf ) ...@@ -250,15 +252,6 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf )
*(p_out+i) *= d_old_scale_factor; *(p_out+i) *= d_old_scale_factor;
} }
#endif #endif
/* Sanity check */
if( p_out_buf->i_buffer/i_bytes_per_frame <= i_out+1 )
{
p_out += i_nb_channels;
i_out++;
p_sys->i_remainder += p_filter->fmt_in.audio.i_rate;
break;
}
} }
else else
{ {
...@@ -297,7 +290,10 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf ) ...@@ -297,7 +290,10 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf )
{ {
while( p_sys->i_remainder < p_filter->fmt_out.audio.i_rate ) while( p_sys->i_remainder < p_filter->fmt_out.audio.i_rate )
{ {
if( p_out_buf->i_buffer/i_bytes_per_frame <= i_out )
break;
assert( i_out < p_out_buf->i_buffer/i_bytes_per_frame );
if( d_factor >= 1 ) if( d_factor >= 1 )
{ {
/* FilterFloatUP() is faster if we can use it */ /* FilterFloatUP() is faster if we can use it */
...@@ -324,14 +320,6 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf ) ...@@ -324,14 +320,6 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf )
*(p_out+i) *= d_old_scale_factor; *(p_out+i) *= d_old_scale_factor;
} }
#endif #endif
/* Sanity check */
if( p_out_buf->i_buffer/i_bytes_per_frame <= i_out+1 )
{
p_out += i_nb_channels;
i_out++;
p_sys->i_remainder += p_filter->fmt_in.audio.i_rate;
break;
}
} }
else else
{ {
......
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