changeset 17625:c5f33a8021c7

Align memory at 16 byte boundaries. This fixes crashes related to AltiVec as reported at http://mplayerhq.hu/pipermail/mplayer-advusers/2006-January/001381.html patch by Luca Barbato, lu_zero #at# gentoo #dot# org
author diego
date Tue, 14 Feb 2006 09:55:14 +0000
parents 7b30bef00830
children 5627625b0cdb
files libmpcodecs/dec_audio.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_audio.c	Tue Feb 14 09:34:30 2006 +0000
+++ b/libmpcodecs/dec_audio.c	Tue Feb 14 09:55:14 2006 +0000
@@ -68,7 +68,7 @@
       sh_audio->a_in_buffer_size=sh_audio->audio_in_minsize;
       mp_msg(MSGT_DECAUDIO,MSGL_V,MSGTR_AllocatingBytesForInputBuffer,
           sh_audio->a_in_buffer_size);
-      sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size);
+      sh_audio->a_in_buffer=memalign(16,sh_audio->a_in_buffer_size);
       memset(sh_audio->a_in_buffer,0,sh_audio->a_in_buffer_size);
       sh_audio->a_in_buffer_len=0;
   }
@@ -79,7 +79,7 @@
   mp_msg(MSGT_DECAUDIO,MSGL_V,MSGTR_AllocatingBytesForOutputBuffer,
       sh_audio->audio_out_minsize,MAX_OUTBURST,sh_audio->a_buffer_size);
 
-  sh_audio->a_buffer=malloc(sh_audio->a_buffer_size);
+  sh_audio->a_buffer=memalign(16,sh_audio->a_buffer_size);
   if(!sh_audio->a_buffer){
       mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_CantAllocAudioBuf);
       return 0;
@@ -327,7 +327,7 @@
   if(out_maxsize<8192) out_maxsize=MAX_OUTBURST; // not sure this is ok
 
   sh_audio->a_out_buffer_size=out_maxsize;
-  sh_audio->a_out_buffer=malloc(sh_audio->a_out_buffer_size);
+  sh_audio->a_out_buffer=memalign(16,sh_audio->a_out_buffer_size);
   memset(sh_audio->a_out_buffer,0,sh_audio->a_out_buffer_size);
   sh_audio->a_out_buffer_len=0;
   }