# HG changeset patch # User nenolod # Date 1171990064 28800 # Node ID a429ce72d20ebb337599266ace752c9825e2e174 # Parent a7ba9d27c7b52d0e1777ffafcb9e9f22d1b4a6ba [svn] - handle a situation where buffer could be NULL (e.g. bail) diff -r a7ba9d27c7b5 -r a429ce72d20e ChangeLog --- 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 + 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 revision [1470] - fix another potential synchronization problem diff -r a7ba9d27c7b5 -r a429ce72d20e src/aac/src/libmp4.c --- 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;