/*****************************************************************************
* mixer.c : audio output mixing operations
*****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: mixer.c,v 1.27 2003/01/31 10:14:13 sam Exp $
+ * Copyright (C) 2002-2004 VideoLAN
+ * $Id$
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
*****************************************************************************/
int aout_MixerNew( aout_instance_t * p_aout )
{
- p_aout->mixer.p_module = module_Need( p_aout, "audio mixer", NULL );
+ p_aout->mixer.p_module = module_Need( p_aout, "audio mixer", NULL, 0 );
if ( p_aout->mixer.p_module == NULL )
{
msg_Err( p_aout, "no suitable aout mixer" );
}
/* Check for the continuity of start_date */
- while ( p_buffer != NULL && p_buffer->end_date < start_date )
+ while ( p_buffer != NULL && p_buffer->end_date < start_date - 1 )
{
+ /* We authorize a +-1 because rounding errors get compensated
+ * regularly. */
aout_buffer_t * p_next = p_buffer->p_next;
msg_Warn( p_aout, "the mixer got a packet in the past ("I64Fd")",
start_date - p_buffer->end_date );
{
p_input->p_first_byte_to_mix = p_buffer->p_buffer;
}
- mixer_nb_bytes = p_input->p_first_byte_to_mix
- - p_buffer->p_buffer;
+ mixer_nb_bytes = p_input->p_first_byte_to_mix - p_buffer->p_buffer;
if ( !((i_nb_bytes + p_aout->mixer.mixer.i_bytes_per_frame
> mixer_nb_bytes) &&
(i_nb_bytes < p_aout->mixer.mixer.i_bytes_per_frame
+ mixer_nb_bytes)) )
{
- msg_Warn( p_aout,
- "mixer start isn't output start ("I64Fd")",
+ msg_Warn( p_aout, "mixer start isn't output start ("I64Fd")",
i_nb_bytes - mixer_nb_bytes );
/* Round to the nearest multiple */