diff options
author | faust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-04-01 12:35:17 +0000 |
---|---|---|
committer | faust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-04-01 12:35:17 +0000 |
commit | 2041a9a551970ce01da6a768c9e6220bfc6f7a25 (patch) | |
tree | 8fbca523a85c4875f416a1470f988c2b6411d8ac /liba52/parse.c | |
parent | 3076975c63c8c3e3b38b0fae5edbb55d808cd931 (diff) | |
download | mpv-2041a9a551970ce01da6a768c9e6220bfc6f7a25.tar.bz2 mpv-2041a9a551970ce01da6a768c9e6220bfc6f7a25.tar.xz |
prevent crash in case we are unable to get aligned buffer
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12090 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'liba52/parse.c')
-rw-r--r-- | liba52/parse.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/liba52/parse.c b/liba52/parse.c index 4ef47b38fa..bd87a35ec3 100644 --- a/liba52/parse.c +++ b/liba52/parse.c @@ -31,6 +31,7 @@ #include "a52_internal.h" #include "bitstream.h" #include "tables.h" +#include "mm_accel.h" #ifdef HAVE_MEMALIGN /* some systems have memalign() but no declaration for it */ @@ -53,9 +54,6 @@ sample_t * a52_init (uint32_t mm_accel) sample_t * samples; int i; - imdct_init (mm_accel); - downmix_accel_init(mm_accel); - samples = memalign (16, 256 * 12 * sizeof (sample_t)); #if defined(__MINGW32__) && defined(HAVE_SSE) for(i=0;i<10;i++){ @@ -66,13 +64,18 @@ sample_t * a52_init (uint32_t mm_accel) } else break; } - if((int)samples%16){ - printf("unable to get 16 bit aligned memory => expect crashes when using SSE instructions\n"); - } #endif + if(((int)samples%16) && (mm_accel&MM_ACCEL_X86_SSE)){ + mm_accel &=~MM_ACCEL_X86_SSE; + printf("liba52: unable to get 16 byte aligned memory disabling usage of SSE instructions\n"); + } + if (samples == NULL) - return NULL; - + return NULL; + + imdct_init (mm_accel); + downmix_accel_init(mm_accel); + for (i = 0; i < 256 * 12; i++) samples[i] = 0; |