changeset 695:e6b3dddb3c35 trunk

[svn] - no idea why we were using a dynamically allocated buffer for raw aac
author nenolod
date Tue, 20 Feb 2007 08:52:37 -0800
parents a429ce72d20e
children c787612e29ff
files ChangeLog src/aac/src/libmp4.c
diffstat 2 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 20 08:47:44 2007 -0800
+++ b/ChangeLog	Tue Feb 20 08:52:37 2007 -0800
@@ -1,3 +1,11 @@
+2007-02-20 16:47:44 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [1474]
+  - handle a situation where buffer could be NULL (e.g. bail)
+  
+  trunk/src/aac/src/libmp4.c |   17 ++++++++---------
+  1 file changed, 8 insertions(+), 9 deletions(-)
+
+
 2007-02-20 15:18:47 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1472]
   - shoutcast title streaming. sucks, could probably be improved upon, but 
--- a/src/aac/src/libmp4.c	Tue Feb 20 08:47:44 2007 -0800
+++ b/src/aac/src/libmp4.c	Tue Feb 20 08:52:37 2007 -0800
@@ -647,7 +647,7 @@
 static void my_decode_aac( InputPlayback *playback, char *filename, VFSFile *file )
 {
     faacDecHandle   decoder = 0;
-    guchar      *buffer = 0;
+    guchar      buffer[BUFFER_SIZE];
     gulong      bufferconsumed = 0;
     gulong      samplerate = 0;
     guchar      channels;
@@ -667,17 +667,8 @@
         g_static_mutex_unlock(&mutex);
         g_thread_exit(NULL);
     }
-    if((buffer = g_malloc(BUFFER_SIZE * 2)) == NULL){
-        g_print("AAC: error g_malloc\n");
-        vfs_fclose(file);
-        buffer_playing = FALSE;
-        faacDecClose(decoder);
-        g_static_mutex_unlock(&mutex);
-        g_thread_exit(NULL);
-    }
     if((buffervalid = vfs_fread(buffer, 1, BUFFER_SIZE, file))==0){
         g_print("AAC: Error reading file\n");
-        g_free(buffer);
         vfs_fclose(file);
         buffer_playing = FALSE;
         faacDecClose(decoder);
@@ -723,7 +714,6 @@
 #endif
     if(playback->output->open_audio(FMT_S16_NE,samplerate,channels) == FALSE){
         g_print("AAC: Output Error\n");
-        g_free(buffer); buffer=0;
         faacDecClose(decoder);
         vfs_fclose(file);
         playback->output->close_audio();
@@ -812,7 +802,6 @@
     playback->output->buffer_free();
     playback->output->close_audio();
     buffer_playing = FALSE;
-    g_free(buffer);
     faacDecClose(decoder);
     g_free(xmmstitle);
     vfs_fclose(file);