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

decoder: do not reallocate audio buffer on interface changes

This has no effect other than wasting CPU and memory. Audio filters are
supposed to reallocate their buffers as needed.
parent e83cd176
...@@ -74,9 +74,6 @@ struct aout_input_t ...@@ -74,9 +74,6 @@ struct aout_input_t
/* If b_error == 1, there is no input pipeline. */ /* If b_error == 1, there is no input pipeline. */
bool b_error; bool b_error;
/* Did we just change the output format? (expect buffer inconsistencies) */
bool b_changed;
/* last rate from input */ /* last rate from input */
int i_last_input_rate; int i_last_input_rate;
......
...@@ -90,7 +90,6 @@ aout_input_t *aout_DecNew( aout_instance_t *p_aout, ...@@ -90,7 +90,6 @@ aout_input_t *aout_DecNew( aout_instance_t *p_aout,
vlc_mutex_init( &p_input->lock ); vlc_mutex_init( &p_input->lock );
p_input->b_changed = false;
p_input->b_error = true; p_input->b_error = true;
p_input->b_paused = false; p_input->b_paused = false;
p_input->i_pause_date = 0; p_input->i_pause_date = 0;
...@@ -236,9 +235,6 @@ aout_buffer_t * aout_DecNewBuffer( aout_input_t * p_input, ...@@ -236,9 +235,6 @@ aout_buffer_t * aout_DecNewBuffer( aout_input_t * p_input,
/ p_input->input.i_frame_length; / p_input->input.i_frame_length;
block = block_Alloc( length ); block = block_Alloc( length );
/* Suppose the decoder doesn't have more than one buffered buffer */
p_input->b_changed = false;
aout_unlock_input( NULL, p_input ); aout_unlock_input( NULL, p_input );
if( likely(block != NULL) ) if( likely(block != NULL) )
...@@ -285,25 +281,6 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -285,25 +281,6 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
return -1; return -1;
} }
if( p_input->b_changed )
{
/* Maybe the allocation size has changed. Re-allocate a buffer. */
aout_buffer_t * p_new_buffer;
mtime_t duration = (1000000 * (mtime_t)p_buffer->i_nb_samples)
/ p_input->input.i_rate;
p_new_buffer = aout_BufferAlloc( &p_input->input_alloc, duration, NULL);
vlc_memcpy( p_new_buffer->p_buffer, p_buffer->p_buffer,
p_buffer->i_buffer );
p_new_buffer->i_nb_samples = p_buffer->i_nb_samples;
p_new_buffer->i_buffer = p_buffer->i_buffer;
p_new_buffer->i_pts = p_buffer->i_pts;
p_new_buffer->i_length = p_buffer->i_length;
aout_BufferFree( p_buffer );
p_buffer = p_new_buffer;
p_input->b_changed = false;
}
aout_InputCheckAndRestart( p_aout, p_input ); aout_InputCheckAndRestart( p_aout, p_input );
aout_unlock_mixer( p_aout ); aout_unlock_mixer( p_aout );
......
...@@ -347,7 +347,6 @@ static int aout_Restart( aout_instance_t * p_aout ) ...@@ -347,7 +347,6 @@ static int aout_Restart( aout_instance_t * p_aout )
{ {
aout_input_t * p_input = p_aout->pp_inputs[i]; aout_input_t * p_input = p_aout->pp_inputs[i];
b_error |= aout_InputNew( p_aout, p_input, &p_input->request_vout ); b_error |= aout_InputNew( p_aout, p_input, &p_input->request_vout );
p_input->b_changed = 1;
aout_unlock_input( p_aout, p_input ); aout_unlock_input( p_aout, p_input );
} }
......
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