Commit b4392aff authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* 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)
parent 01dbf688
......@@ -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 ) \
......
......@@ -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 );
......
......@@ -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
......
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