changeset 1345:76f826e6052d

aac: Convert to new threading model.
author William Pitcock <nenolod@atheme-project.org>
date Mon, 23 Jul 2007 17:38:15 -0500
parents d3fb6dfcd2f8
children 7c5d22f753aa
files src/aac/src/libmp4.c
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/aac/src/libmp4.c	Mon Jul 23 17:27:44 2007 -0500
+++ b/src/aac/src/libmp4.c	Mon Jul 23 17:38:15 2007 -0500
@@ -125,7 +125,8 @@
 {
     buffer_playing = TRUE;
     playback->playing = 1; //XXX should acquire lock?
-    decodeThread = g_thread_create((GThreadFunc)mp4_decode, playback, TRUE, NULL);
+    mp4_decode(playback);
+    decodeThread = g_thread_self();
 }
 
 static void mp4_stop(InputPlayback *playback)
@@ -593,8 +594,6 @@
             buffer_playing = FALSE;
             playback->playing = 0;
             g_static_mutex_unlock(&mutex);
-            g_thread_exit(NULL);
-
             return FALSE;
         }
         rc= mp4ff_read_sample(mp4file, mp4track,
@@ -675,7 +674,7 @@
         buffer_playing = FALSE;
         playback->playing = 0;
         g_static_mutex_unlock(&mutex);
-        g_thread_exit(NULL);
+        return;
     }
     if((buffervalid = vfs_fread(streambuffer, 1, BUFFER_SIZE, file))==0){
         g_print("AAC: Error reading file\n");
@@ -684,7 +683,7 @@
         playback->playing = 0;
         faacDecClose(decoder);
         g_static_mutex_unlock(&mutex);
-        g_thread_exit(NULL);
+        return;
     }
     if(!strncmp((char*)streambuffer, "ID3", 3)){
         gint size = 0;
@@ -733,7 +732,7 @@
         buffer_playing = FALSE;
         playback->playing = 0;
         g_static_mutex_unlock(&mutex);
-        g_thread_exit(NULL);
+        return;
     }
 
     mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels);
@@ -827,7 +826,6 @@
     buffer_playing = FALSE;
     playback->playing = 0;
     g_static_mutex_unlock(&mutex);
-    g_thread_exit(NULL);
 }
 
 static void *mp4_decode( void *args )
@@ -848,7 +846,7 @@
     g_static_mutex_unlock(&mutex);
 
     if (mp4fh == NULL)
-        g_thread_exit(NULL);
+        return NULL;
 
     ret = parse_aac_stream(mp4fh);