]> git.sesse.net Git - vlc/commitdiff
* Don't use alloca for audio buffers on OSX and BSD, because the stacksize on both...
authorDerk-Jan Hartman <hartman@videolan.org>
Fri, 17 Feb 2006 16:15:50 +0000 (16:15 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Fri, 17 Feb 2006 16:15:50 +0000 (16:15 +0000)
  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)

include/aout_internal.h
modules/audio_filter/resampler/linear.c
modules/demux/mp4/mp4.c

index 38facb811545ca5d688c3d8325dc15f0a10280b5..a7f7c4b285bf795116f8441d48288c1ac2d9c368 100644 (file)
@@ -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 )                  \
index 06d401df8d1e1a785e3a524177be2ddce0106bf2..94875e740d159bab9cb77bb6f5434be2dc457b35 100644 (file)
@@ -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 );
index 87cc748bda10105eef77f304aab774e5186f3f0f..4dd570ce892bf8dbedf80bc29030b224797c8c23 100644 (file)
@@ -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