X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Faudio_output%2Fmixer.c;h=972f12e44b0dd196d54bc14ca802aa9380133a23;hb=9b52a805d106bf9fa8dc9de4d628cecf84c51410;hp=315cf44babc52475638e3c9bdca1cc6dd9a87a2f;hpb=c87d50dd850bac965aaf9e81b97e0c166fc22a4f;p=vlc diff --git a/src/audio_output/mixer.c b/src/audio_output/mixer.c index 315cf44bab..972f12e44b 100644 --- a/src/audio_output/mixer.c +++ b/src/audio_output/mixer.c @@ -2,7 +2,7 @@ * mixer.c : audio output mixing operations ***************************************************************************** * Copyright (C) 2002-2004 VideoLAN - * $Id: mixer.c,v 1.30 2004/03/03 20:39:52 gbazin Exp $ + * $Id$ * * Authors: Christophe Massiot * @@ -261,23 +261,23 @@ static int MixBuffer( aout_instance_t * p_aout ) { 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 */ i_nb_bytes /= p_aout->mixer.mixer.i_bytes_per_frame; i_nb_bytes *= p_aout->mixer.mixer.i_bytes_per_frame; - p_input->p_first_byte_to_mix = p_buffer->p_buffer - + i_nb_bytes; + + if( i_nb_bytes < 0 ) break; /* FIXME: reset state properly */ + + p_input->p_first_byte_to_mix = p_buffer->p_buffer + i_nb_bytes; } } }