From: Derk-Jan Hartman Date: Fri, 17 Feb 2006 16:15:50 +0000 (+0000) Subject: * Don't use alloca for audio buffers on OSX and BSD, because the stacksize on both... X-Git-Tag: 0.9.0-test0~12300 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b4392aff1efa491352e2f3f8aed151bc6da321d7;p=vlc * Don't use alloca for audio buffers on OSX and BSD, because the stacksize on both isn't infinite. This might explain the audio-core crashes we have seen in the past on Mac OS X * Fix issues with platforms which don't have alloca() (defined) --- diff --git a/include/aout_internal.h b/include/aout_internal.h index 38facb8115..a7f7c4b285 100644 --- a/include/aout_internal.h +++ b/include/aout_internal.h @@ -34,6 +34,10 @@ typedef struct aout_alloc_t #define AOUT_ALLOC_STACK 1 #define AOUT_ALLOC_HEAP 2 +#if defined( __APPLE__ ) || defined( SYS_BSD ) +#undef HAVE_ALLOCA +#endif + #ifdef HAVE_ALLOCA # define ALLOCA_TEST( p_alloc, p_new_buffer ) \ if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_STACK ) \ diff --git a/modules/audio_filter/resampler/linear.c b/modules/audio_filter/resampler/linear.c index 06d401df8d..94875e740d 100644 --- a/modules/audio_filter/resampler/linear.c +++ b/modules/audio_filter/resampler/linear.c @@ -137,7 +137,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) { filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys; - float *p_in, *p_out = (float *)p_out_buf->p_buffer; + float *p_in_orig, *p_in, *p_out = (float *)p_out_buf->p_buffer; float *p_prev_sample = (float *)p_sys->p_prev_sample; int i_nb_channels = aout_FormatNbChannels( &p_filter->input ); diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 87cc748bda..4dd570ce89 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -406,7 +406,13 @@ static int Open( vlc_object_t * p_this ) else { /* msg dbg relative ? */ - char *psz_absolute = alloca( strlen( p_demux->psz_access ) + 3 + strlen( p_demux->psz_path ) + strlen( psz_ref ) + 1); + int i_path_size = strlen( p_demux->psz_access ) + 3 + + strlen( p_demux->psz_path ) + strlen( psz_ref ) + 1; +#ifdef HAVE_ALLOCA + char *psz_absolute = alloca( i_path_size ); +#else + char *psz_absolute = (char *)malloc( i_path_size ); +#endif char *end = strrchr( p_demux->psz_path, '/' ); if( end ) @@ -439,6 +445,9 @@ static int Open( vlc_object_t * p_this ) b_play = VLC_TRUE; } } +#ifndef HAVE_ALLOCA + free( psz_absolute ); +#endif } } else