changeset 694:a429ce72d20e trunk

[svn] - handle a situation where buffer could be NULL (e.g. bail)
author nenolod
date Tue, 20 Feb 2007 08:47:44 -0800
parents a7ba9d27c7b5
children e6b3dddb3c35
files ChangeLog src/aac/src/libmp4.c
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 20 07:18:47 2007 -0800
+++ b/ChangeLog	Tue Feb 20 08:47:44 2007 -0800
@@ -1,3 +1,12 @@
+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 
+    will do for now.
+  
+  trunk/src/aac/src/libmp4.c |   51 ++++++++++++++++++++++++++++++++++++++++++++-
+  1 file changed, 50 insertions(+), 1 deletion(-)
+
+
 2007-02-20 15:00:10 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1470]
   - fix another potential synchronization problem
--- a/src/aac/src/libmp4.c	Tue Feb 20 07:18:47 2007 -0800
+++ b/src/aac/src/libmp4.c	Tue Feb 20 08:47:44 2007 -0800
@@ -496,13 +496,6 @@
 {
     // We are reading an MP4 file
     gint mp4track= getAACTrack(mp4file);
-
-    if (mp4track < 0)
-    {
-        g_print("Unsupported Audio track type\n");
-        return TRUE;
-    }
-
     faacDecHandle   decoder;
     mp4AudioSpecificConfig mp4ASC;
     guchar      *buffer = NULL;
@@ -514,6 +507,12 @@
     gulong      sampleID = 1;
     guint       framesize = 1024;
 
+    if (mp4track < 0)
+    {
+        g_print("Unsupported Audio track type\n");
+        return TRUE;
+    }
+
     gchar *xmmstitle = NULL;
     xmmstitle = mp4_get_song_title(filename);
     if(xmmstitle == NULL)
@@ -668,7 +667,7 @@
         g_static_mutex_unlock(&mutex);
         g_thread_exit(NULL);
     }
-    if((buffer = g_malloc(BUFFER_SIZE)) == NULL){
+    if((buffer = g_malloc(BUFFER_SIZE * 2)) == NULL){
         g_print("AAC: error g_malloc\n");
         vfs_fclose(file);
         buffer_playing = FALSE;
@@ -737,7 +736,7 @@
     mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels);
     playback->output->flush(0);
 
-    while(buffer_playing && buffervalid > 0){
+    while(buffer_playing && buffervalid > 0 && buffer != NULL){
         faacDecFrameInfo    finfo;
         unsigned long   samplesdecoded;
         char*       sample_buffer = NULL;