summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2008-12-04 20:57:31 +0000
committersr55 <[email protected]>2008-12-04 20:57:31 +0000
commit766943e7149265a9ae029292eae90e01d960dad6 (patch)
treeb9ba9d5ba96c5b1734cdad4b94e261e8b97b3ec6
parent1b3278e1c4fbf132f14bc2e658bb39369c998af4 (diff)
libhb:
The malloc() function in cygwin doesn't return 16-byte aligned memory which causes it to randomly crash. Replaced with memalign() for the cygwin platform only. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2006 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/decavcodec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index e335ef9f4..7f68100fa 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -1065,7 +1065,14 @@ static void decodeAudio( hb_work_private_t *pv, uint8_t *data, int size )
// the buffer is allocated on our stack. Rather than doing
// complicated, machine dependent alignment here we use the
// fact that malloc returns an aligned pointer on most architectures.
- pv->buffer = malloc( AVCODEC_MAX_AUDIO_FRAME_SIZE );
+
+ #ifdef SYS_CYGWIN
+ // Cygwin's malloc doesn't appear to return 16-byte aligned memory so use memalign instead.
+ pv->buffer = memalign(16, AVCODEC_MAX_AUDIO_FRAME_SIZE);
+ #else
+ pv->buffer = malloc( AVCODEC_MAX_AUDIO_FRAME_SIZE );
+ #endif
+
buffer = pv->buffer;
}
int out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;